diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2021-09-26 20:26:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 20:26:16 +0200 |
commit | 2b6f8d01877a1bceb0910396425f1ee04c8b0fa2 (patch) | |
tree | 686179f6a33adf19ea534abb3bdefe3cd6248c83 /ext/http/lib.rs | |
parent | 6c007aa5abde06fc7d9d57b6a3a8153727e5ccdc (diff) |
fix(ext/http): include port number in h2 urls (#12181)
Diffstat (limited to 'ext/http/lib.rs')
-rw-r--r-- | ext/http/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/http/lib.rs b/ext/http/lib.rs index aabf5d839..f1b0c911a 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -280,7 +280,13 @@ fn req_url( scheme: &'static str, addr: SocketAddr, ) -> Result<String, AnyError> { - let host: Cow<str> = if let Some(host) = req.uri().host() { + let host: Cow<str> = if let Some(auth) = req.uri().authority() { + match addr.port() { + 443 if scheme == "https" => Cow::Borrowed(auth.host()), + 80 if scheme == "http" => Cow::Borrowed(auth.host()), + _ => Cow::Borrowed(auth.as_str()), // Includes port number. + } + } else if let Some(host) = req.uri().host() { Cow::Borrowed(host) } else if let Some(host) = req.headers().get("HOST") { Cow::Borrowed(host.to_str()?) |