From 89d593c31c2d37fdf7cf29c637fa76a19485a0f8 Mon Sep 17 00:00:00 2001 From: nikstur Date: Wed, 29 Jan 2025 20:51:20 +0100 Subject: [PATCH] proxy: use the same data for CONNECT and Host header The CONNECT and Host header should both point to the proxied host that we want to eventually reach, not to the proxy itself. --- CHANGELOG.md | 1 + src/proxy.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bae1de8..42021f25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased + * Use the same data in CONNECT and Host header for proxied requests (#967) * Set default scheme in proxy uri (#966) * Redact URI and Location header on debug level (#964) * Downgrade all logging to debug and below (#964) diff --git a/src/proxy.rs b/src/proxy.rs index 29fac44f..c80ff9af 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -244,7 +244,7 @@ impl Connector for ConnectProxyConnector { .unwrap_or(proxied.scheme().unwrap().default_port().unwrap()); write!(w, "CONNECT {}:{} HTTP/1.1\r\n", proxied_host, proxied_port)?; - write!(w, "Host: {}:{}\r\n", proxy.host(), proxy.port())?; + write!(w, "Host: {}:{}\r\n", proxied_host, proxied_port)?; if let Some(v) = details.config.user_agent().as_str(DEFAULT_USER_AGENT) { write!(w, "User-Agent: {}\r\n", v)?; }