diff options
author | Ben Greear <greearb@candelatech.com> | 2013-04-08 15:24:49 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-07-17 23:55:58 +0200 |
commit | 11220678c4b78dfb209797b8537df40638d9dfe3 (patch) | |
tree | 7bd0148ded5dc54a3661dda7687114fc1b70056c /lib/asyn-ares.c | |
parent | 448d55ef0a2d6a0d8a18778f6d6a6a432d05bbb6 (diff) | |
download | curl-11220678c4b78dfb209797b8537df40638d9dfe3.tar.gz |
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>
Diffstat (limited to 'lib/asyn-ares.c')
-rw-r--r-- | lib/asyn-ares.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 392e50a08..081667dc3 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -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; } |