cURL / Mailing Lists / curl-library / Single Mail

curl-library

IP address connection fail-over is broken for non-blocking sockets

From: David Strauss <david_at_davidstrauss.net>
Date: Wed, 9 Oct 2013 16:36:49 -0700

In Curl_connecthost(), there's a loop to call singleipconnect() for
each address. This loop breaks when it gets a non-bad file descriptor.
But, 99% of libcurl invocations use non-blocking sockets, especially
in the current era of even the "easy" interface using the "multi"
back-end.

This effectively causes singleipconnect() to "succeed" in all but the
most catastrophic scenarios. libcurl then runs off with this file
descriptor as the connection, even if the connection fails
asynchronously.

Could we support iterating through IPs in a more useful way even with
non-blocking sockets? If not, could there be a flag to force blocking
behavior to allow fail-over to occur?

-- 
David Strauss
   | david_at_davidstrauss.net
   | +1 512 577 5827 [mobile]
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-10