]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
url: proxy: Use 443 as default port for https proxies
authorThomas Glanzmann <thomas@glanzmann.de>
Thu, 24 Nov 2016 18:40:30 +0000 (19:40 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 25 Nov 2016 09:01:58 +0000 (10:01 +0100)
docs/libcurl/opts/CURLOPT_PROXYPORT.3
lib/url.c
lib/url.h

index 2380e09ec7ee534a28fcab0cf40e1b91da2ee725..0e222896edb23b4aceab48728d4f962f5bfa1297 100644 (file)
@@ -29,7 +29,8 @@ CURLOPT_PROXYPORT \- port number the proxy listens on
 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port);
 .SH DESCRIPTION
 Pass a long with this option to set the proxy port to connect to unless it is
-specified in the proxy string \fICURLOPT_PROXY(3)\fP or uses the default one.
+specified in the proxy string \fICURLOPT_PROXY(3)\fP or uses 443 for https
+proxies and 1080 for all others as default.
 
 While this accepts a 'long', the port number is 16 bit so it can't be larger
 than 65535.
index 5dee7a7707fe8e83990e7893787300987d961a82..8b404ba6b51bf5b37bf2ed8b33d15b3159921c85 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -528,7 +528,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
   /* Set the default size of the SSL session ID cache */
   set->general_ssl.max_ssl_sessions = 5;
 
-  set->proxyport = CURL_DEFAULT_PROXY_PORT; /* from url.h */
+  set->proxyport = 0;
   set->proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */
   set->httpauth = CURLAUTH_BASIC;  /* defaults to basic */
   set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */
@@ -4997,6 +4997,12 @@ static CURLcode parse_proxy(struct Curl_easy *data,
       /* None given in the proxy string, then get the default one if it is
          given */
       port = data->set.proxyport;
+    else {
+      if(proxytype == CURLPROXY_HTTPS)
+        port = CURL_DEFAULT_HTTPS_PROXY_PORT;
+      else
+        port = CURL_DEFAULT_PROXY_PORT;
+    }
   }
 
   if(*proxyptr) {
index c1254f5dc379e732c918629eeaaa859f8c8241be..f13c8e664033e94f9d4bc264d45fda3ae35fa9ba 100644 (file)
--- a/lib/url.h
+++ b/lib/url.h
@@ -67,6 +67,8 @@ void Curl_getoff_all_pipelines(struct Curl_easy *data,
 void Curl_close_connections(struct Curl_easy *data);
 
 #define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
+#define CURL_DEFAULT_HTTPS_PROXY_PORT 443 /* default https proxy port unless
+                                             specified */
 
 CURLcode Curl_connected_proxy(struct connectdata *conn, int sockindex);