mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
asyn-ares: Don't blank ares servers if none configured.
Best to just let c-ares use it's defaults if none are configured in (lib)curl. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
parent
448d55ef0a
commit
11220678c4
@ -590,8 +590,19 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data,
|
||||
char *servers)
|
||||
{
|
||||
CURLcode result = CURLE_NOT_BUILT_IN;
|
||||
int ares_result;
|
||||
|
||||
/* If server is NULL or empty, this would purge all DNS servers
|
||||
* from ares library, which will cause any and all queries to fail.
|
||||
* So, just return OK if none are configured and don't actually make
|
||||
* any changes to c-ares. This lets c-ares use it's defaults, which
|
||||
* it gets from the OS (for instance from /etc/resolv.conf on Linux).
|
||||
*/
|
||||
if(!(servers && servers[0]))
|
||||
return CURLE_OK;
|
||||
|
||||
#if (ARES_VERSION >= 0x010704)
|
||||
int ares_result = ares_set_servers_csv(data->state.resolver, servers);
|
||||
ares_result = ares_set_servers_csv(data->state.resolver, servers);
|
||||
switch(ares_result) {
|
||||
case ARES_SUCCESS:
|
||||
result = CURLE_OK;
|
||||
@ -608,7 +619,7 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data,
|
||||
}
|
||||
#else /* too old c-ares version! */
|
||||
(void)data;
|
||||
(void)servers;
|
||||
(void)(ares_result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user