From c4b2913c4793f9e35da56f8757094bcee6410ea2 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 no authority is provide, for example when using UNIX domain sockets. Signed-off-by: Sascha Grunert --- src/server.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/server.rs b/src/server.rs index 3c093f7ee..cc495d75f 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1393,14 +1393,10 @@ impl proto::Peer for Peer { // 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, - ) - })?); + parts.authority = uri::Authority::from_maybe_shared( + authority.clone().into_inner(), + ) + .ok(); } // A :scheme is required, except CONNECT.