mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
fix dns client bug when trailing dot
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user