]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http: strip default port from URL sent to proxy
authorDaniel Stenberg <daniel@haxx.se>
Mon, 22 Mar 2021 23:24:59 +0000 (00:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 23 Mar 2021 12:33:49 +0000 (13:33 +0100)
To make sure the Host: header and the URL provide the same authority
portion when sent to the proxy, strip the default port number from the
URL if one was provided.

Reported-by: Michael Brown
Fixes #6769
Closes #6778

lib/http.c
tests/data/test659

index 7ec03e9bd1d4d93994d7bf68ecebb915741714ce..cb065ed58653f2a91cb992c8cb5441defb0b3771 100644 (file)
@@ -2189,7 +2189,7 @@ CURLcode Curl_http_target(struct Curl_easy *data,
     /* Extract the URL to use in the request. Store in STRING_TEMP_URL for
        clean-up reasons if the function returns before the free() further
        down. */
-    uc = curl_url_get(h, CURLUPART_URL, &url, 0);
+    uc = curl_url_get(h, CURLUPART_URL, &url, CURLU_NO_DEFAULT_PORT);
     if(uc) {
       curl_url_cleanup(h);
       return CURLE_OUT_OF_MEMORY;
index 476edcc4c79490cadc636ba6cb59cfa2b8dccb57..ef7cf12efd2829b6bb89fcc1b739d57658cb9dbe 100644 (file)
@@ -43,7 +43,7 @@ proxy
 
 <verify>
 <protocol>
-GET http://www.example.com:80/ HTTP/1.1\r
+GET http://www.example.com/ HTTP/1.1\r
 Host: www.example.com\r
 Accept: */*\r
 Proxy-Connection: Keep-Alive\r