On Fri, 9 Dec 2011, Chandran, Naveen wrote:

Please find attached for your reference (problematic_code.c), the sample code that repeats this problem (verified with the latest curl version - curl-7.23.1).

Ugh. I found the flaw and fixed it. Please try the attached patch, which fixed the issue for my tests. I'm gonna commit and push this to the git repo right now.

Thanks a lot for your excellent report and test case!

--

 / daniel.haxx.se
From 07e3b7512c9a2723daac046501c7ea40ede4bd28 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <[email protected]>
Date: Fri, 9 Dec 2011 22:51:08 +0100
Subject: [PATCH] create_conn: don't switch to HTTP protocol if tunneling is
 enabled

This is a regression since who knows when. When spotting that a HTTP
proxy is used we must not uncondititionally enable the HTTP protocol
since if we do tunneling through the proxy we're still using the target
protocol.

Reported by: Naveen Chandran
---
 lib/url.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/url.c b/lib/url.c
index 2c5cb39..42e1756 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4900,8 +4900,9 @@ static CURLcode create_conn(struct SessionHandle *data,
       return CURLE_UNSUPPORTED_PROTOCOL;
 #else
       /* force this connection's protocol to become HTTP if not already
-         compatible */
-      if(!(conn->handler->protocol & CURLPROTO_HTTP))
+         compatible - if it isn't tunneling through */
+      if(!(conn->handler->protocol & CURLPROTO_HTTP) &&
+         !conn->bits.tunnel_proxy)
         conn->handler = &Curl_handler_http;
 
       conn->bits.httpproxy = TRUE;
-- 
1.7.7.3

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to