cURL / Mailing Lists / curl-users / Single Mail

curl-users

Fwd: If a given url has serveral host IP addresses, which one curl will take?

From: Wang Meng <qingyu1990_at_gmail.com>
Date: Mon, 2 Nov 2015 16:31:18 +0800

hi,
     I hacked the glibc function gethostbyname_r by nsswitch, so curl will
reslove some special hostname through my own defined function. The function
will pick up one address randomly to be the first of h_addr_list.
     I curl a host by curl-7.12.1 & curl curl-7.19.7.But i got different
results(The host has 8 addresses).
     I wrote a script deal with `curl -v` result to see which address curl
will connected more.
     By curl 7.12.1, it only connect two addresses, and one of it will be
connected more.
     By curl 7.19.7, it works well, the 8 addresses have the same
opportunity to be connected.
     I have read the source code. It seems 7.12.1 & 7.19.7 has no
difference in dealing with the gethostbyname_r result and the hacked
fuction solving result is correct.
     So, what casued this?
     THANKS!
     platform: linux 2.36

Meng Wang.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-02