From 7ab83e8a31bc6c20b61833d3838a3987b7f9baab Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 8 Jun 2026 08:18:47 -0400 Subject: [PATCH] fix(uri): allow STAR paths with scheme/auth --- src/uri/builder.rs | 14 ++++++++++++++ src/uri/path.rs | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/src/uri/builder.rs b/src/uri/builder.rs index d5f7f49b..06c7ed6c 100644 --- a/src/uri/builder.rs +++ b/src/uri/builder.rs @@ -208,4 +208,18 @@ mod tests { let uri = Builder::from(original_uri.clone()).build().unwrap(); assert_eq!(original_uri, uri); } + + #[test] + fn build_star_for_http2() { + let uri = Builder::new() + .scheme("https") + .authority("example.com") + .path_and_query("*") + .build() + .unwrap(); + + assert_eq!(uri.scheme(), Some(&Scheme::HTTPS)); + assert_eq!(uri.host(), Some("example.com")); + assert_eq!(uri.path(), "*"); + } } diff --git a/src/uri/path.rs b/src/uri/path.rs index dfbb2e95..1c7e18c6 100644 --- a/src/uri/path.rs +++ b/src/uri/path.rs @@ -416,6 +416,14 @@ const fn scan_path_and_query(bytes: &[u8]) -> Result { return Err(ErrorKind::Empty); } + if bytes.len() == 1 && bytes[0] == b'*' { + return Ok(Scanned { + query, + fragment, + is_maybe_not_utf8: false, + }); + } + if !matches!(bytes[0], b'/' | b'?' | b'#') { return Err(ErrorKind::PathDoesNotStartWithSlash); }