]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_proxy: a blank CURLOPT_USERAGENT should not be used in CONNECT
authorDaniel Stenberg <daniel@haxx.se>
Wed, 10 Jan 2024 22:20:09 +0000 (23:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 11 Jan 2024 07:49:21 +0000 (08:49 +0100)
Extended test 80 to verify this.

Reported-by: Stefan Eissing
Fixes #12680
Closes #12681

lib/http_proxy.c
tests/data/test80

index 8e1832581d5ebcf059d6a360039895725b86d6e8..113c43a4135252e209867e2cb70700d4105747eb 100644 (file)
@@ -131,8 +131,8 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
       goto out;
   }
 
-  if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent"))
-     && data->set.str[STRING_USERAGENT]) {
+  if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent")) &&
+     data->set.str[STRING_USERAGENT] && *data->set.str[STRING_USERAGENT]) {
     result = Curl_dynhds_cadd(&req->headers, "User-Agent",
                               data->set.str[STRING_USERAGENT]);
     if(result)
index 21d9fd2ea5f6c13a98503860b5f2a642a127648b..c6aa05b173d6c7a828a26fa8b300d59bfc74dfa6 100644 (file)
@@ -53,7 +53,7 @@ http-proxy
 HTTP 1.0 CONNECT with proxytunnel and proxy+host Basic authentication
 </name>
 <command>
-http://test.%TESTNUMBER:%HTTPPORT/we/want/that/page/%TESTNUMBER -p --proxy1.0 %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself
+http://test.%TESTNUMBER:%HTTPPORT/we/want/that/page/%TESTNUMBER -p --proxy1.0 %HOSTIP:%PROXYPORT --user iam:myself --proxy-user youare:yourself -A ""
 </command>
 <features>
 proxy
@@ -67,7 +67,6 @@ proxy
 CONNECT test.%TESTNUMBER:%HTTPPORT HTTP/1.0\r
 Host: test.%TESTNUMBER:%HTTPPORT\r
 Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm\r
-User-Agent: curl/%VERSION\r
 Proxy-Connection: Keep-Alive\r
 \r
 </proxy>
@@ -75,7 +74,6 @@ Proxy-Connection: Keep-Alive
 GET /we/want/that/page/%TESTNUMBER HTTP/1.1\r
 Host: test.%TESTNUMBER:%HTTPPORT\r
 Authorization: Basic aWFtOm15c2VsZg==\r
-User-Agent: curl/%VERSION\r
 Accept: */*\r
 \r
 </protocol>