Skip to content

Commit

Permalink
http_proxy: a blank CURLOPT_USERAGENT should not be used in CONNECT
Browse files Browse the repository at this point in the history
Extended test 80 to verify this.

Reported-by: Stefan Eissing
Fixes #12680
Closes #12681
  • Loading branch information
bagder committed Jan 11, 2024
1 parent dd0f680 commit 693cd16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/http_proxy.c
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test80
Expand Up @@ -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
Expand All @@ -67,15 +67,13 @@ proxy
CONNECT test.%TESTNUMBER:%HTTPPORT HTTP/1.0
Host: test.%TESTNUMBER:%HTTPPORT
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
User-Agent: curl/%VERSION
Proxy-Connection: Keep-Alive

</proxy>
<protocol>
GET /we/want/that/page/%TESTNUMBER HTTP/1.1
Host: test.%TESTNUMBER:%HTTPPORT
Authorization: Basic aWFtOm15c2VsZg==
User-Agent: curl/%VERSION
Accept: */*

</protocol>
Expand Down

0 comments on commit 693cd16

Please sign in to comment.