From: Daniel Stenberg Date: Mon, 22 Mar 2021 23:24:59 +0000 (+0100) Subject: http: strip default port from URL sent to proxy X-Git-Tag: curl-7_76_0~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bbf62b5a4af05fc60f67de924c72c576779d560;p=thirdparty%2Fcurl.git http: strip default port from URL sent to proxy 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 --- diff --git a/lib/http.c b/lib/http.c index 7ec03e9bd1..cb065ed586 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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; diff --git a/tests/data/test659 b/tests/data/test659 index 476edcc4c7..ef7cf12efd 100644 --- a/tests/data/test659 +++ b/tests/data/test659 @@ -43,7 +43,7 @@ proxy -GET http://www.example.com:80/ HTTP/1.1 +GET http://www.example.com/ HTTP/1.1 Host: www.example.com Accept: */* Proxy-Connection: Keep-Alive