FTP: fix proxy connect race condition

When using the multi interface, a SOCKS proxy, and a connection that
wouldn't immediately consider itself connected (which my Linux tests do
by default), libcurl would be tricked into doing _two_ connects to the
SOCKS proxy when it setup the data connection and then of course the
second attempt would fail miserably and cause error.

This problem is a regression that was introduced by commit
4a42e5cdaa that was introduced in the 7.21.7 release.

Bug: http://curl.haxx.se/mail/lib-2011-08/0199.html
Reported by: Fabian Keil
This commit is contained in:
Daniel Stenberg
2011-08-18 23:35:15 +02:00
parent d44896508c
commit b998d95b4d
4 changed files with 21 additions and 14 deletions

View File

@@ -659,7 +659,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
*connected = FALSE; /* a very negative world view is best */
if(conn->bits.tcpconnect) {
if(conn->bits.tcpconnect[sockindex]) {
/* we are connected already! */
*connected = TRUE;
return CURLE_OK;
@@ -698,7 +698,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
if(code)
return code;
conn->bits.tcpconnect = TRUE;
conn->bits.tcpconnect[sockindex] = TRUE;
*connected = TRUE;
Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
Curl_verboseconnect(conn);