From c43127414d89ccb9ef6517081f68986d991bcfb3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 17 Jan 2013 12:59:23 +0100 Subject: 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 --- lib/http_proxy.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'lib/http_proxy.c') 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, , et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, , 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; -- cgit v1.2.3