Skip to content

Commit 812e70d

Browse files
committed
Do not always require an authority
This fixes connections where a local UNIX domain socket path is provided, where the authority contains the full path to the *.sock file. Signed-off-by: Sascha Grunert <[email protected]>
1 parent cbbdd30 commit 812e70d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/server.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -1395,14 +1395,20 @@ impl proto::Peer for Peer {
13951395
// A request translated from HTTP/1 must not include the :authority
13961396
// header
13971397
if let Some(authority) = pseudo.authority {
1398-
let maybe_authority = uri::Authority::from_maybe_shared(authority.clone().into_inner());
1399-
parts.authority = Some(maybe_authority.or_else(|why| {
1400-
malformed!(
1401-
"malformed headers: malformed authority ({:?}): {}",
1402-
authority,
1403-
why,
1404-
)
1405-
})?);
1398+
// When connecting to a UNIX Domain Socket (UDS), then we might get a path for the
1399+
// authority field. If it's a local path and exists, then we do not error in that case
1400+
// and assume an UDS.
1401+
if !authority.as_str().ends_with(".sock") {
1402+
let maybe_authority =
1403+
uri::Authority::from_maybe_shared(authority.clone().into_inner());
1404+
parts.authority = Some(maybe_authority.or_else(|why| {
1405+
malformed!(
1406+
"malformed headers: malformed authority ({:?}): {}",
1407+
authority,
1408+
why,
1409+
)
1410+
})?);
1411+
}
14061412
}
14071413

14081414
// A :scheme is required, except CONNECT.

0 commit comments

Comments
 (0)