Merge pull request #667 from kedixa/dev

fix dns client bug when trailing dot
This commit is contained in:
xiehan
2021-12-03 21:19:41 +08:00
committed by GitHub
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ WFDnsTask *WFDnsClient::create_dns_task(const std::string& name,
status.try_origin_state = DNS_STATUS_TRY_ORIGIN_FIRST;
if (!name.empty() && name.back() == '.')
status.next_domain = p->uris.size();
status.next_domain = p->search_list.size();
else if (__get_ndots(name) < p->ndots)
status.try_origin_state = DNS_STATUS_TRY_ORIGIN_LAST;
+6 -3
View File
@@ -237,9 +237,12 @@ public:
void set_request_name(const std::string& name)
{
this->request_name = name;
while (!this->request_name.empty() && this->request_name.back() == '.')
this->request_name.pop_back();
std::string req_name(name);
while (req_name.size() > 1 && req_name.back() == '.')
req_name.pop_back();
this->request_name = std::move(req_name);
}
protected: