On Thu, 21 May 2015, Sean Boudreau wrote:

Isn't it also possible for proxytype to be derived from CURLOPT_PROXY by parse_proxy()? ie. I could set CURLOPT_PROXY "socks5://<addr>:<port>" and still end up with tunnel_proxy set but not httpproxy?

Oh right. Looking at it a bit more, I think it would be enough to _only_ address it there. Like the attached patch. Basically switching off tunneling in case a non-HTTP proxy has been selected.

--

 / daniel.haxx.se
From 29585db6450ccf8c83553541fac99f57714d9928 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <[email protected]>
Date: Fri, 22 May 2015 09:06:44 +0200
Subject: [PATCH] parse_proxy: switch off tunneling if non-HTTP proxy

non-HTTP proxy implies not using CURLOPT_HTTPPROXYTUNNEL

Bug: http://curl.haxx.se/mail/lib-2015-05/0056.html
Reported-by: Sean Boudreau
---
 lib/url.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/url.c b/lib/url.c
index 9bbb681..8a60508 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4523,11 +4523,10 @@ static char *detect_proxy(struct connectdata *conn)
 
 /*
  * If this is supposed to use a proxy, we need to figure out the proxy
  * host name, so that we can re-use an existing connection
  * that may exist registered to the same proxy host.
- * proxy will be freed before this function returns.
  */
 static CURLcode parse_proxy(struct SessionHandle *data,
                             struct connectdata *conn, char *proxy)
 {
   char *prox_portno;
@@ -5571,12 +5570,14 @@ static CURLcode create_conn(struct SessionHandle *data,
         conn->handler = &Curl_handler_http;
 
       conn->bits.httpproxy = TRUE;
 #endif
     }
-    else
+    else {
       conn->bits.httpproxy = FALSE; /* not a HTTP proxy */
+      conn->bits.tunnel_proxy = FALSE; /* no tunneling if not HTTP */
+    }
     conn->bits.proxy = TRUE;
   }
   else {
     /* we aren't using the proxy after all... */
     conn->bits.proxy = FALSE;
-- 
2.1.4

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

Reply via email to