diff options
| author | Maxim Prohorov <prohorov.max@gmail.com> | 2012-03-13 22:52:39 +0100 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2012-03-13 22:52:39 +0100 | 
| commit | 97386c3c84251ca6a185916b28e61c100a901c1a (patch) | |
| tree | 4036916a1b22d327b39ee9c222e20e4935bb70d9 | |
| parent | e25590a2b38e1a2a653c3905cce67545da66c8c3 (diff) | |
resolve with c-ares: don't resolve IPv6 when not working
If the Curl_ipv6works() function says no, there is no reason to try AAAA
names even if libcurl was built with IPv6 support enabled.
Bug: http://curl.haxx.se/mail/lib-2012-03/0045.html
| -rw-r--r-- | lib/asyn-ares.c | 21 | 
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 9f16e39f1..5b760128e 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -582,13 +582,22 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,      res->last_status = ARES_ENOTFOUND;  #ifdef ENABLE_IPV6 /* CURLRES_IPV6 */      if(family == PF_UNSPEC) { -      res->num_pending = 2; +      if(Curl_ipv6works()) { +        res->num_pending = 2; + +        /* areschannel is already setup in the Curl_open() function */ +        ares_gethostbyname((ares_channel)data->state.resolver, hostname, +                            PF_INET, query_completed_cb, conn); +        ares_gethostbyname((ares_channel)data->state.resolver, hostname, +                            PF_INET6, query_completed_cb, conn); +      } +      else { +        res->num_pending = 1; -      /* areschannel is already setup in the Curl_open() function */ -      ares_gethostbyname((ares_channel)data->state.resolver, hostname, -                         PF_INET, query_completed_cb, conn); -      ares_gethostbyname((ares_channel)data->state.resolver, hostname, -                         PF_INET6, query_completed_cb, conn); +        /* areschannel is already setup in the Curl_open() function */ +        ares_gethostbyname((ares_channel)data->state.resolver, hostname, +                            PF_INET, query_completed_cb, conn); +      }      }      else  #endif /* CURLRES_IPV6 */  | 
