From d72351c6a776c203d0943fab2df37309f53e3d69 Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <alessandro@ghedini.me>
Date: Sat, 24 May 2014 23:32:51 +0200
Subject: [PATCH] url: use proper default port for HTTP proxy

Port 1080 is default for SOCKS proxies, use port 80 for HTTP.

Bug: http://bugs.debian.org/749171
---
 lib/url.c | 4 +++-
 lib/url.h | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/url.c b/lib/url.c
index 2922292..899ea9e 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -506,7 +506,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
   /* Set the default size of the SSL session ID cache */
   set->ssl.max_ssl_sessions = 5;
 
-  set->proxyport = CURL_DEFAULT_PROXY_PORT; /* from url.h */
+  set->proxyport = CURL_DEFAULT_HTTP_PROXY_PORT; /* from url.h */
   set->proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */
   set->httpauth = CURLAUTH_BASIC;  /* defaults to basic */
   set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */
@@ -4353,6 +4353,8 @@ static CURLcode parse_proxy(struct SessionHandle *data,
   endofprot = strstr(proxy, "://");
   if(endofprot) {
     proxyptr = endofprot+3;
+    if(checkprefix("socks", proxy))
+      data->set.proxyport = CURL_DEFAULT_SOCKS_PROXY_PORT;
     if(checkprefix("socks5h", proxy))
       conn->proxytype = CURLPROXY_SOCKS5_HOSTNAME;
     else if(checkprefix("socks5", proxy))
diff --git a/lib/url.h b/lib/url.h
index cd46a92..3dfcc3f 100644
--- a/lib/url.h
+++ b/lib/url.h
@@ -66,7 +66,9 @@ void Curl_getoff_all_pipelines(struct SessionHandle *data,
 
 void Curl_close_connections(struct SessionHandle *data);
 
-#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
+#define CURL_DEFAULT_HTTP_PROXY_PORT 80 /* default http proxy port unless specified */
+#define CURL_DEFAULT_SOCKS_PROXY_PORT 1080 /* default socks proxy port unless specified */
+
 #define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi
                                                      service */
 
-- 
2.0.0.rc4


