diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-12-13 16:15:19 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-12-13 16:15:19 +0000 |
commit | b528bde470afc6d5a6e3e72f4823428f9ec78a9a (patch) | |
tree | c69443b0c4d0698d3ed9b0e818e46c6bd073b3b1 /lib | |
parent | 57572e550f446b1532efb06a5cd2c7af59c5f62f (diff) |
conn->bits.tcpconnect now keeps track of if this connection is connected
or not
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connect.c | 4 | ||||
-rw-r--r-- | lib/url.c | 16 | ||||
-rw-r--r-- | lib/urldata.h | 3 |
3 files changed, 20 insertions, 3 deletions
diff --git a/lib/connect.c b/lib/connect.c index 1a4c193eb..151864fd7 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -380,8 +380,8 @@ CURLcode Curl_is_connected(struct connectdata *conn, return CURLE_OPERATION_TIMEOUTED; } } - if(conn->protocol & PROT_FILE) { - /* we are connected, awesome! */ + if(conn->bits.tcpconnect) { + /* we are connected already! */ *connected = TRUE; return CURLE_OK; } @@ -1677,6 +1677,12 @@ CURLcode Curl_protocol_connect(struct connectdata *conn, struct SessionHandle *data = conn->data; CURLcode result=CURLE_OK; + if(conn->bits.tcpconnect) + /* We already are connected, get back. This may happen when the connect + worked fine in the first call, like when we connect to a local server + or proxy. */ + return CURLE_OK; + Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */ if(data->set.verbose) @@ -2299,6 +2305,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* Setup a "faked" transfer that'll do nothing */ if(CURLE_OK == result) { + conn->bits.tcpconnect = TRUE; /* we are "connected */ result = Curl_Transfer(conn, -1, -1, FALSE, NULL, /* no download */ -1, NULL); /* no upload */ } @@ -2795,14 +2802,21 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* Connect only if not already connected! */ result = ConnectPlease(conn, hostaddr, &connected); - if(connected) + if(connected) { result = Curl_protocol_connect(conn, hostaddr); + if(CURLE_OK == result) + conn->bits.tcpconnect = TRUE; + } + else + conn->bits.tcpconnect = FALSE; + if(CURLE_OK != result) return result; } else { Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */ + conn->bits.tcpconnect = TRUE; if(data->set.verbose) verboseconnect(conn, hostaddr); } diff --git a/lib/urldata.h b/lib/urldata.h index 0a54b0ee4..334b0e633 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -243,6 +243,9 @@ struct ConnectBits { bool forbidchunk; /* used only to explicitly forbid chunk-upload for specific upload buffers. See readmoredata() in http.c for details. */ + bool tcpconnect; /* the tcp stream (or simimlar) is connected, this + is set the first time on the first connect function + call */ }; /* |