cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getaddrinfo() of multi-IP returns the same one first

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 19 Oct 2005 15:51:07 -0700

On Thu, Oct 20, 2005 at 12:27:22AM +0200, Daniel Stenberg wrote:
> For the purpose of repeating this, I created this host name: bad10.haxx.se.
>
> It resolves to 5 IP addresses, one being 127.0.0.1 and the rest being
> 10.10.10.1-4. The plan was that the 10.* ones should fail and the 127.* one
> would work (if you run a local server).
>
> But for some reason, when I run the app (or plain curl) it _always_ tries
> the 127.0.0.1 address first. It seems getaddrinfo() simply returns the
> addresses like that. The 10.* addresses seem to appear in different order
> different times.
>
> Why is this? If I do 'nslookup bad10.haxx.se' it seems to output the
> addresses in different order...
>
> Am I hallucinating?
>
> Anyone with a clue to offer?

I tried it here and I get a random addresses every time, as expected. Are you
sure you don't have a caching nameserver in the data path?

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2005-10-20