mirror of
https://github.com/curl/curl.git
synced 2026-08-25 07:03:31 +03:00
always-multi: always use non-blocking internals
Remove internal separated behavior of the easy vs multi intercace. curl_easy_perform() is now using the multi interface itself. Several minor multi interface quirks and bugs have been fixed in the process. Much help with debugging this has been provided by: Yang Tse
This commit is contained in:
parent
9fd88abb70
commit
c43127414d
54 changed files with 490 additions and 884 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -87,13 +87,6 @@ CURLcode Curl_proxy_connect(struct connectdata *conn)
|
|||
* Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This
|
||||
* function will issue the necessary commands to get a seamless tunnel through
|
||||
* this proxy. After that, the socket can be used just as a normal socket.
|
||||
*
|
||||
* This badly needs to be rewritten. CONNECT should be sent and dealt with
|
||||
* like any ordinary HTTP request, and not specially crafted like this. This
|
||||
* function only remains here like this for now since the rewrite is a bit too
|
||||
* much work to do at the moment.
|
||||
*
|
||||
* This function is BLOCKING which is nasty for all multi interface using apps.
|
||||
*/
|
||||
|
||||
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
|
|
@ -244,19 +237,13 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
return CURLE_RECV_ERROR;
|
||||
}
|
||||
|
||||
/* if we're in multi-mode and we would block, return instead for a retry */
|
||||
if(Curl_if_multi == data->state.used_interface) {
|
||||
if(0 == Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, 0))
|
||||
/* return so we'll be called again polling-style */
|
||||
return CURLE_OK;
|
||||
else {
|
||||
DEBUGF(infof(data,
|
||||
"Multi mode finished polling for response from "
|
||||
"proxy CONNECT\n"));
|
||||
}
|
||||
}
|
||||
if(0 == Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, 0))
|
||||
/* return so we'll be called again polling-style */
|
||||
return CURLE_OK;
|
||||
else {
|
||||
DEBUGF(infof(data, "Easy mode waiting response from proxy CONNECT\n"));
|
||||
DEBUGF(infof(data,
|
||||
"Multi mode finished polling for response from "
|
||||
"proxy CONNECT\n"));
|
||||
}
|
||||
|
||||
/* at this point, either:
|
||||
|
|
@ -572,6 +559,12 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
if(closeConnection && data->req.newurl)
|
||||
conn->bits.proxy_connect_closed = TRUE;
|
||||
|
||||
if(data->req.newurl) {
|
||||
/* this won't be used anymore for the CONNECT so free it now */
|
||||
free(data->req.newurl);
|
||||
data->req.newurl = NULL;
|
||||
}
|
||||
|
||||
/* to back to init state */
|
||||
conn->tunnel_state[sockindex] = TUNNEL_INIT;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue