http: fix non-tunneling proxy hostname use

Make sure hostname used in URL to proxy is IDN decoded form, but keep
the original hostname in case it was ipv6.

Fixes #22382
Reported-by: RMMoreton on github
Closes #22385
This commit is contained in:
Stefan Eissing 2026-07-24 14:20:58 +02:00 committed by Daniel Stenberg
parent c8860532dd
commit a479459ea3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2115,7 +2115,7 @@ static CURLcode http_target(struct Curl_easy *data,
/* The path sent to the proxy is in fact the entire URL, but if the remote
host is a IDN-name, we must make sure that the request we produce only
uses the encoded hostname! */
uses the decoded hostname! */
/* and no fragment part */
CURLUcode uc;
@ -2124,7 +2124,8 @@ static CURLcode http_target(struct Curl_easy *data,
if(!h)
return CURLE_OUT_OF_MEMORY;
if(data->state.origin->user_hostname != data->state.origin->hostname) {
if(!data->state.origin->ipv6 &&
(data->state.origin->user_hostname != data->state.origin->hostname)) {
uc = curl_url_set(h, CURLUPART_HOST, data->state.origin->hostname, 0);
if(uc) {
curl_url_cleanup(h);