Skip to content

Commit

Permalink
proxy: use the same data for CONNECT and Host header
Browse files Browse the repository at this point in the history
The CONNECT and Host header should both point to the proxied host that
we want to eventually reach, not to the proxy itself.
  • Loading branch information
nikstur authored and algesten committed Jan 30, 2025
1 parent e2e27ea commit 89d593c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<In: Transport> Connector<In> 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)?;
}
Expand Down

0 comments on commit 89d593c

Please sign in to comment.