From c993b8c6388e82866d78d0e1d81a5d46063f8a2c Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 16 Sep 2020 15:22:25 +0200 Subject: [PATCH] Do not always require an authority This fixes connections where a local path is provided, for example when using UNIX domain sockets. Signed-off-by: Sascha Grunert --- src/server.rs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/server.rs b/src/server.rs index 3c093f7ee..ba3b6bbbc 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1390,19 +1390,6 @@ impl proto::Peer for Peer { // Convert the URI let mut parts = uri::Parts::default(); - // A request translated from HTTP/1 must not include the :authority - // header - if let Some(authority) = pseudo.authority { - let maybe_authority = uri::Authority::from_maybe_shared(authority.clone().into_inner()); - parts.authority = Some(maybe_authority.or_else(|why| { - malformed!( - "malformed headers: malformed authority ({:?}): {}", - authority, - why, - ) - })?); - } - // A :scheme is required, except CONNECT. if let Some(scheme) = pseudo.scheme { if is_connect { @@ -1416,13 +1403,6 @@ impl proto::Peer for Peer { why, ) })?; - - // It's not possible to build an `Uri` from a scheme and path. So, - // after validating is was a valid scheme, we just have to drop it - // if there isn't an :authority. - if parts.authority.is_some() { - parts.scheme = Some(scheme); - } } else if !is_connect { malformed!("malformed headers: missing scheme"); }