threaded-resolver: never use NULL hints with getaddrinfo
authorDaniel Stenberg <daniel@haxx.se>
Fri, 10 Jan 2014 07:37:43 +0000 (08:37 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 10 Jan 2014 07:48:40 +0000 (08:48 +0100)
commit041d1e14d66916b7701991646ac88cf1f90a0cda
tree3243c13d23301223cdc3ea488ce1bd0e5ff13206
parent21aa79f46399c39c1c64b9f53270cb41aa310f17
threaded-resolver: never use NULL hints with getaddrinfo

The net effect of this bug as it appeared to users, would be that
libcurl would timeout in the connect phase.

When disabling IPv6 use but still using getaddrinfo, libcurl would
wrongly not init the "hints" struct field in init_thread_sync() which
would subsequently lead to a getaddrinfo() invoke with a zeroed hints
with ai_socktype set to 0 instead of SOCK_STREAM. This would lead to
different behaviors on different platforms but basically incorrect
output.

This code was introduced in 483ff1ca75cbea, released in curl 7.20.0.

This bug became a problem now due to the happy eyeballs code and how
libcurl now traverses the getaddrinfo() results differently.

Bug: http://curl.haxx.se/mail/lib-2014-01/0061.html
Reported-by: Fabian Frank
Debugged-by: Fabian Frank
lib/asyn-thread.c