x-forwarded-* as rfc and nginx

This commit is contained in:
Jun Kurihara 2022-07-10 01:42:54 +09:00
commit 0c6ffa5e77
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
4 changed files with 56 additions and 39 deletions

View file

@ -76,30 +76,3 @@ impl<B> ParseHost for Request<B> {
)
}
}
// pub(super) fn parse_host_port<B: core::fmt::Debug>(
// req: &Request<B>,
// ) -> Result<(String, Option<u16>)> {
// let headers_host = req.headers().get("host");
// let uri_host = req.uri().host();
// let uri_port = req.uri().port_u16();
// ensure!(
// !(headers_host.is_none() && uri_host.is_none()),
// "No host in request header"
// );
// // prioritize server_name in uri
// if let Some(v) = uri_host {
// Ok((v.to_string(), uri_port))
// } else {
// let uri_from_host = headers_host.unwrap().to_str()?.parse::<Uri>()?;
// Ok((
// uri_from_host
// .host()
// .ok_or_else(|| anyhow!("Failed to parse host"))?
// .to_string(),
// uri_from_host.port_u16(),
// ))
// }
// }