cURL / Mailing Lists / curl-library / Single Mail


Re: multihomed connections

From: Dan Fandrich <>
Date: Tue, 8 Jun 2004 11:38:05 -0700

On Tue, Jun 08, 2004 at 08:18:40PM +0200, Gisle Vanem wrote:
> The other "bug" in libcurl is not a bug at all, but rather inconsitent
> behaviour depending on which resolver is used.
> Without C-ares (i.e. USE_THREADING_GETADDRINFO):
> >set CURL_TRACE=1
> >curl -v4
> * Couldn't find host in the .netrc file, using defaults
> 416: not yet
> 139: dump_addrinfo:
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> fam 2, CNAME <none>,
> 353: getaddrinfo_thread() status 0, thread retval 0, 361: elapsed 15 ms
> * About to connect() to port 80
> * Connect failed; Connection refused
> * Closing connection #0
> curl: (7) Connect failed; Connection refused
> Okay, the "refused" came from the last IP. Using tcpdump, I see curl
> tries the addresses in the above order. But with a C-ares version, the
> result is "timed out". Since the last IP it tried was
> It would be nice if libcurl could tell us all the IP it tried and the result of
> each failed attempt.
> I.e. C-ares returns a completely different IP-order compared to what getaddrinfo()
> says. It looks like the DNS for this host is misconfigured too. Isn't addresses
> supposed to be listed in *prefered* order?

If the DNS server is configured for round-robin, then the "preferred"
order is to balance requests evenly over the various addresses. The
preferred address could be different each time.

> BTW. try "adig" and watch the IP-order changes constantly.
> Whereas the dig or host programs gives a more stable list of IPs.

I'll bet adig does a new DNS request each time, whereas dig and host return
a cached result.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2004-06-08