From 05f3ca880fa092e4fd8684d39cb52401fedc9db7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 12 Nov 2001 14:08:41 +0000 Subject: made CURLOPT_HTTPPROXYTUNNEL work for plain HTTP as well --- lib/http.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'lib/http.c') diff --git a/lib/http.c b/lib/http.c index 2fe8e08dd..6d1330c25 100644 --- a/lib/http.c +++ b/lib/http.c @@ -398,19 +398,22 @@ CURLcode Curl_http_connect(struct connectdata *conn) * us to the host we want to talk to. Only after the connect * has occured, can we start talking SSL */ - if (conn->protocol & PROT_HTTPS) { - if (data->change.proxy) { - /* HTTPS through a proxy can only be done with a tunnel */ - result = Curl_ConnectHTTPProxyTunnel(conn, conn->firstsocket, - conn->hostname, conn->remote_port); - if(CURLE_OK != result) - return result; - } - /* now, perform the SSL initialization for this socket */ - result = Curl_SSLConnect(conn); - if(result) + if(data->change.proxy && + ((conn->protocol & PROT_HTTPS) || data->set.tunnel_thru_httpproxy)) { + + /* either HTTPS over proxy, OR explicitly asked for a tunnel */ + result = Curl_ConnectHTTPProxyTunnel(conn, conn->firstsocket, + conn->hostname, conn->remote_port); + if(CURLE_OK != result) return result; + + if(conn->protocol & PROT_HTTPS) { + /* now, perform the SSL initialization for this socket */ + result = Curl_SSLConnect(conn); + if(result) + return result; + } } if(conn->bits.user_passwd && !data->state.this_is_a_follow) { @@ -530,7 +533,9 @@ CURLcode Curl_http(struct connectdata *conn) host, ppath, conn->protocol&PROT_HTTPS?TRUE:FALSE); } - if ((data->change.proxy) && !(conn->protocol&PROT_HTTPS)) { + if (data->change.proxy && + !data->set.tunnel_thru_httpproxy && + !(conn->protocol&PROT_HTTPS)) { /* The path sent to the proxy is in fact the entire URL */ ppath = data->change.url; } -- cgit v1.2.3