Skip to content

Commit

Permalink
Do not always require an authority
Browse files Browse the repository at this point in the history
This fixes connections where a local path is provided, for example when
using UNIX domain sockets.

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Oct 8, 2020
1 parent a193237 commit c993b8c
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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");
}
Expand Down

0 comments on commit c993b8c

Please sign in to comment.