diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-02-25 11:38:13 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-02-25 11:38:13 +0000 |
commit | b819c72700d5f01cab5848f1cd3c880205d01c81 (patch) | |
tree | 94a69e7075bcdfde79837c6d9568a7ef7cea8e1e /lib/multi.c | |
parent | d2cfb7fd13e1559cfa1cb1439a3faa683da99a25 (diff) |
- Adam D. Moss made the HTTP CONNECT procedure less blocking when used from
the multi interface. Note that it still does a part of the connection in a
blocking manner.
Diffstat (limited to 'lib/multi.c')
-rw-r--r-- | lib/multi.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lib/multi.c b/lib/multi.c index 2a7f50baa..e55cb6994 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -47,6 +47,7 @@ #include "multiif.h" #include "sendf.h" #include "timeval.h" +#include "http.h" /* The last #include file should be: */ #include "memdebug.h" @@ -62,6 +63,7 @@ typedef enum { CURLM_STATE_CONNECT, /* resolve/connect has been sent off */ CURLM_STATE_WAITRESOLVE, /* awaiting the resolve to finalize */ CURLM_STATE_WAITCONNECT, /* awaiting the connect to finalize */ + CURLM_STATE_WAITPROXYCONNECT, /* awaiting proxy CONNECT to finalize */ CURLM_STATE_PROTOCONNECT, /* completing the protocol-specific connect phase */ CURLM_STATE_WAITDO, /* wait for our turn to send the request */ @@ -791,7 +793,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(easy, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; easy->result = CURLE_OK; - } else { + } + else { easy->result = CURLE_COULDNT_CONNECT; multistate(easy, CURLM_STATE_COMPLETED); } @@ -871,10 +874,13 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, WAITDO! */ result = CURLM_CALL_MULTI_PERFORM; - if(protocol_connect) { + if(protocol_connect) multistate(easy, CURLM_STATE_WAITDO); - } else { - multistate(easy, CURLM_STATE_WAITCONNECT); + else { + if (easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + else + multistate(easy, CURLM_STATE_WAITCONNECT); } } } @@ -903,8 +909,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) multistate(easy, CURLM_STATE_DO); - else - multistate(easy, CURLM_STATE_WAITCONNECT); + else { + if (easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + else + multistate(easy, CURLM_STATE_WAITCONNECT); + } } } @@ -917,6 +927,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } break; + case CURLM_STATE_WAITPROXYCONNECT: + /* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */ + easy->result = Curl_http_connect(easy->easy_conn, &protocol_connect); + + if(CURLE_OK == easy->result) { + if (!easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITCONNECT); + } + break; + case CURLM_STATE_WAITCONNECT: /* awaiting a completion of an asynch connect */ easy->result = Curl_is_connected(easy->easy_conn, |