diff options
author | Daniel Stenberg <daniel@haxx.se> | 2013-01-17 12:59:23 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-01-17 19:40:35 +0100 |
commit | c43127414d89ccb9ef6517081f68986d991bcfb3 (patch) | |
tree | f6a639061f5e199089a923b052904aa24901243c /lib/http_proxy.c | |
parent | 9fd88abb7032346e88636165e688232e36f5c336 (diff) | |
download | curl-c43127414d89ccb9ef6517081f68986d991bcfb3.tar.gz |
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
Diffstat (limited to 'lib/http_proxy.c')
-rw-r--r-- | lib/http_proxy.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c index ada89576e..ed0fe9503 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -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; |