aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
AgeCommit message (Collapse)Author
2010-12-23multi: connect fail => use next IP addressDaniel Stenberg
When using the multi interface and connecting to a host name that resolves to multiple IP addresses, there was no logic that made it continue to the next IP if connecting to the first address times out. This is now corrected.
2010-12-03fix getinfo CURLINFO_LOCAL* for reused connections (take 2) follow-upYang Tse
- Show address string from proper buffer in case of connection failure. - Try next address when inet_ntop() fails.
2010-12-01connect: fix compiler warning: unused variableYang Tse
2010-11-30fix getinfo CURLINFO_LOCAL* for reused connections (take 2)Yang Tse
2010-11-30fix getinfo CURLINFO_LOCAL* for reused connections follow-upYang Tse
Reinstate IPV6 build variable that got removed.
2010-11-30fix getinfo CURLINFO_LOCAL* for reused connectionsYang Tse
2010-11-11ip_version: moved to connection structDaniel Stenberg
The IP version choice was previously only in the UserDefined struct within the SessionHandle, but since we sometimes alter that option during a request we need to have it on a per-connection basis. I also moved more "init conn" code into the allocate_conn() function which is designed for that purpose more or less.
2010-09-17Curl_timeleft: avoid returning "no timeout" by mistakeDaniel Stenberg
As this function uses return code 0 to mean that there is no timeout, it needs to check that it doesn't return a time left value that is exactly zero. It could lead to libcurl doing an extra 1000 ms select() call and thus not timing out as accurately as it should. I fell over this bug when working on the bug 3061535 but this fix does not correct that problem alone, although this is a problem that needs to be fixed. Reported by: Rodric Glaser Bug: http://curl.haxx.se/bug/view.cgi?id=3061535
2010-09-14multi: don't do extra expire calls for the connectionDaniel Stenberg
The timeout is set for the connect phase already at the start of the request so we should not add a new one, and we MUST not set expire to 0 as that will remove any other potentially existing timeouts.
2010-09-06portabilty: use proper variable type to hold socketsDaniel Stenberg
Curl_getconnectinfo() is changed to return a proper curl_socket_t for the last socket so that it'll work more portably (and cause less compiler warnings).
2010-08-21Curl_is_connected: use correct errnoDirk Manske
The correctly extracted errno contents were mistakenly overwritten by a newer value that wasn't the correct error value. Bug: http://curl.haxx.se/mail/lib-2010-08/0242.html
2010-08-10callbacks: acknowledge progress callback error returnsDaniel Stenberg
When the progress callback is called during the TCP connection, an error return would accidentally not abort the operation as intended but would instead be counted as a failure to connect to that particular IP and libcurl would just continue to try the next. I made singleipconnect() and trynextip() return CURLcode properly. Added bonus: it corrected the error code for bad --interface usages, like tested in test 1084 and test 1085. Reported by: Adam Light Bug: http://curl.haxx.se/mail/lib-2010-08/0105.html
2010-06-24multi_socket: re-use of same socket without notifying appDaniel Stenberg
When a hostname resolves to multiple IP addresses and the first one tried doesn't work, the socket for the second attempt may get dropped on the floor, causing the request to eventually time out. The issue is that when using kqueue (as on mac and bsd platforms) instead of select, the kernel removes the first fd from kqueue when it is closed (in trynextip, connect.c:503). Trynextip() then goes on to open a new socket, which gets assigned the same number as the one it just closed. Later in multi.c, socket_cb is not called because the fd is already in multi->sockhash, so the new socket is never added to kqueue. The correct fix is to ensure that socket_cb is called to remove the fd when trynextip() closes the socket, and again to re-add it after singleipsocket(). I'm not sure how to cleanly do that, but the attached patch works around the problem in an admittedly kludgy way by delaying the close to ensure that the newly-opened socket gets a different fd. Daniel's added comment: I didn't spot a way to easily do a nicer fix so I've proceeded with Ben's patch. Bug: http://curl.haxx.se/bug/view.cgi?id=3017819 Patch by: Ben Darnell
2010-06-08avoid redundant work when reusing same connectionYang Tse
2010-06-08fix function result checkingYang Tse
2010-06-07Curl_updateconninfo() error handling fixYang Tse
2010-06-05replace socklen_t with curl_socklen_tYang Tse
2010-06-05getinfo: added *_PRIMARY_PORT, *_LOCAL_IP and *_LOCAL_PORTFrank Meier
2010-05-07multi interface: missed storing connection timeDaniel Stenberg
Dirk Manske reported a regression. When connecting with the multi interface, there were situations where libcurl wouldn't store connect time correctly as it used to (and is documented to) do. Using his fine sample program we could repeat it, and I wrote up test case 573 using that code. The problem does not easily show itself using the local test suite though. The fix, also as suggested by Dirk, is a bit on the ugly side as it adds yet another call to Curl_verboseconnect() and setting the TIMER_CONNECT time. That situation is subject for some closer inspection in the future.
2010-03-24remove the CVSish $Id$ linesDaniel Stenberg
2010-03-23mark connection as connectedDaniel Stenberg
Kenny To filed the bug report #2963679 with patch to fix a problem he experienced with doing multi interface HTTP POST over a proxy using PROXYTUNNEL. He found a case where it would connect fine but bits.tcpconnect was not set correct so libcurl didn't work properly. (http://curl.haxx.se/bug/view.cgi?id=2963679)
2010-02-04fix printf-style format stringsYang Tse
2010-02-02Fix compiler warning: conditional expression is constantYang Tse
2010-01-28fix printf-style format stringsYang Tse
2010-01-22wrap long lines and do some indent policingDaniel Stenberg
2010-01-11- Made sure that the progress callback is repeatedly called at a regularDaniel Stenberg
interval even during very slow connects.
2009-12-30VMS specific preprocessor symbol checking adjustmentsYang Tse
2009-10-01- Tom Mueller correctly reported in bug report #2870221Daniel Stenberg
(http://curl.haxx.se/bug/view.cgi?id=2870221) that libcurl returned an incorrect return code from the internal trynextip() function which caused him grief. This is a regression that was introduced in 7.19.1 and I find it strange it hasn't hit us harder, but I won't persue into figuring out exactly why.
2009-10-01- Constantine Sapuntzakis: The current implementation will always setDaniel Stenberg
SO_SNDBUF to CURL_WRITE_SIZE even if the SO_SNDBUF starts out larger. The patch doesn't do a setsockopt if SO_SNDBUF is already greater than CURL_WRITE_SIZE. This should help folks who have set up their computer with large send buffers.
2009-08-29add cast to silent compiler warning with 64bit systems.Gunter Knauf
2009-07-09- Eric Wong introduced curlx_nonblock() that the curl tool now (re-)uses forDaniel Stenberg
setting a file descriptor non-blocking. Used by the functionality Eric himself brough on June 15th.
2009-05-07Curl_sndbufset is (at times) defined in the header, no need to do it again hereDaniel Stenberg
2009-05-07- Made the SO_SNDBUF setting for the data connection socket for ftp uploads asDaniel Stenberg
well. See change 28 Apr 2009.
2009-05-02Use build-time configured curl_socklen_t instead of socklen_tYang Tse
2009-04-30fix compiler warning: unused parameterYang Tse
2009-04-28- Constantine Sapuntzakis filed bug report #2783090Daniel Stenberg
(http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows we need to grow the SO_SNDBUF buffer somewhat to get really good upload speeds. http://support.microsoft.com/kb/823764 has the details. Friends confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.
2009-04-21libcurl's memory.h renamed to curl_memory.hYang Tse
2009-02-28for portability reasons: s/inet_pton/Curl_inet_pton/Yang Tse
2009-02-27- Senthil Raja Velu reported a problem when CURLOPT_INTERFACE andDaniel Stenberg
CURLOPT_LOCALPORT were used together (the local port bind failed), and Markus Koetter provided the fix!
2008-12-30changed HAVE_SIN6_SCOPE_ID define to HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID since ↵Gunter Knauf
just found that ares already uses this define.
2008-12-16Added the use of Watt-32 tcp/ip stack for Win32 targets.Gisle Vanem
2008-11-14Added some #ifdefs around header files and change the EAGAIN test toDan Fandrich
fix compilation on Cell (reported by Jeff Curley).
2008-11-13Refactor configure script detection of functions used to set sockets intoYang Tse
non-blocking mode, and decouple function detection from function capability.
2008-11-06Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single oneYang Tse
which now also takes a protocol address family argument.
2008-11-03- Bug #2218480 (http://curl.haxx.se/bug/view.cgi?id=2218480) pointed out aDaniel Stenberg
problem with my CURLINFO_PRIMARY_IP fix from October 7th that caused a NULL pointer read. I also took the opportunity to clean up this logic (storing of the connection's IP address) somewhat as we had it stored in two different places and ways previously and they are now unified.
2008-10-24Stop using in6addr_any because it's not available everywhere (e.g. Symbian)Dan Fandrich
and isn't strictly needed here.
2008-10-24fix compiler warningYang Tse
2008-10-17portability fix to avoid memory alignment problemsYang Tse
2008-10-13There's no guarantee that a socket was involved at this point, so avoid ↵Yang Tse
displaying any error code. And on the other hand a message after setsockopt() certainly must use SOCKERRNO.
2008-10-11fix compiler warningYang Tse