Skip to content

Commit ba61661

Browse files
committed
fix(server): relax authority validation for Unix domain socket compatibility
Go gRPC clients connecting over Unix domain sockets send the URL-encoded socket path as the :authority pseudo-header (e.g. %2Fvar%2Frun%2Fisol8%2Fcri.sock). This is rejected by http::uri::Authority as invalid, causing RST_STREAM PROTOCOL_ERROR. Instead of rejecting the request, log a warning and skip setting the authority. This matches the intent of hyperium#487 which has been open since 2020.
1 parent 2aeb81f commit ba61661

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/server.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,13 +1660,18 @@ impl proto::Peer for Peer {
16601660
// header
16611661
if let Some(authority) = pseudo.authority {
16621662
let maybe_authority = uri::Authority::from_maybe_shared(authority.clone().into_inner());
1663-
parts.authority = Some(maybe_authority.or_else(|why| {
1664-
malformed!(
1665-
"malformed headers: malformed authority ({:?}): {}",
1666-
authority,
1667-
why,
1668-
)
1669-
})?);
1663+
match maybe_authority {
1664+
Ok(authority) => parts.authority = Some(authority),
1665+
Err(why) => {
1666+
// Relaxed validation: accept requests with non-standard authority
1667+
// values (e.g. Unix domain socket paths sent by Go gRPC clients).
1668+
tracing::warn!(
1669+
"ignoring malformed authority ({:?}): {}",
1670+
authority,
1671+
why,
1672+
);
1673+
}
1674+
}
16701675
}
16711676

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

0 commit comments

Comments
 (0)