http_proxy: a blank CURLOPT_USERAGENT should not be used in CONNECT

Extended test 80 to verify this.

Reported-by: Stefan Eissing
Fixes #12680
Closes #12681
This commit is contained in:
Daniel Stenberg 2024-01-10 23:20:09 +01:00
parent dd0f680fc0
commit 693cd16793
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 3 additions and 5 deletions

View File

@ -131,8 +131,8 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
goto out; goto out;
} }
if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent")) if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent")) &&
&& data->set.str[STRING_USERAGENT]) { data->set.str[STRING_USERAGENT] && *data->set.str[STRING_USERAGENT]) {
result = Curl_dynhds_cadd(&req->headers, "User-Agent", result = Curl_dynhds_cadd(&req->headers, "User-Agent",
data->set.str[STRING_USERAGENT]); data->set.str[STRING_USERAGENT]);
if(result) if(result)

View File

@ -53,7 +53,7 @@ http-proxy
HTTP 1.0 CONNECT with proxytunnel and proxy+host Basic authentication HTTP 1.0 CONNECT with proxytunnel and proxy+host Basic authentication
</name> </name>
<command> <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> </command>
<features> <features>
proxy proxy
@ -67,7 +67,6 @@ proxy
CONNECT test.%TESTNUMBER:%HTTPPORT HTTP/1.0 CONNECT test.%TESTNUMBER:%HTTPPORT HTTP/1.0
Host: test.%TESTNUMBER:%HTTPPORT Host: test.%TESTNUMBER:%HTTPPORT
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
User-Agent: curl/%VERSION
Proxy-Connection: Keep-Alive Proxy-Connection: Keep-Alive
</proxy> </proxy>
@ -75,7 +74,6 @@ Proxy-Connection: Keep-Alive
GET /we/want/that/page/%TESTNUMBER HTTP/1.1 GET /we/want/that/page/%TESTNUMBER HTTP/1.1
Host: test.%TESTNUMBER:%HTTPPORT Host: test.%TESTNUMBER:%HTTPPORT
Authorization: Basic aWFtOm15c2VsZg== Authorization: Basic aWFtOm15c2VsZg==
User-Agent: curl/%VERSION
Accept: */* Accept: */*
</protocol> </protocol>