]> granicus.if.org Git - curl/commitdiff
create_conn: only switch protocol handler if necessary
authorDaniel Stenberg <daniel@haxx.se>
Wed, 25 May 2011 13:57:38 +0000 (15:57 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 25 May 2011 13:57:38 +0000 (15:57 +0200)
When switching to HTTP because a HTTP proxy is being used, the existing
handler is now checked if it already is "compatible". This allows the https
handler remain while other non-http handlers will be redirected.

Bug: http://curl.haxx.se/mail/lib-2011-05/0214.html
Reported by: Jerome Robert

lib/url.c

index ac3399b9e8e32fdd48a72948a44a40485e86b342..d37fe6dfc9c5adce09bab732de90b321f2d24f83 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -4812,8 +4812,11 @@ static CURLcode create_conn(struct SessionHandle *data,
       /* asking for a HTTP proxy is a bit funny when HTTP is disabled... */
       return CURLE_UNSUPPORTED_PROTOCOL;
 #else
-      /* force this connection's protocol to become HTTP */
-      conn->handler = &Curl_handler_http;
+      /* force this connection's protocol to become HTTP if not already
+         compatible */
+      if(!(conn->handler->protocol & CURLPROTO_HTTP))
+        conn->handler = &Curl_handler_http;
+
       conn->bits.httpproxy = TRUE;
 #endif
     }