Skip to content

Commit df75ca3

Browse files
authored
fix(uri): allow STAR paths with scheme/auth (#843)
1 parent ec3f8ce commit df75ca3

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/uri/builder.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,18 @@ mod tests {
208208
let uri = Builder::from(original_uri.clone()).build().unwrap();
209209
assert_eq!(original_uri, uri);
210210
}
211+
212+
#[test]
213+
fn build_star_for_http2() {
214+
let uri = Builder::new()
215+
.scheme("https")
216+
.authority("example.com")
217+
.path_and_query("*")
218+
.build()
219+
.unwrap();
220+
221+
assert_eq!(uri.scheme(), Some(&Scheme::HTTPS));
222+
assert_eq!(uri.host(), Some("example.com"));
223+
assert_eq!(uri.path(), "*");
224+
}
211225
}

src/uri/path.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,14 @@ const fn scan_path_and_query(bytes: &[u8]) -> Result<Scanned, ErrorKind> {
416416
return Err(ErrorKind::Empty);
417417
}
418418

419+
if bytes.len() == 1 && bytes[0] == b'*' {
420+
return Ok(Scanned {
421+
query,
422+
fragment,
423+
is_maybe_not_utf8: false,
424+
});
425+
}
426+
419427
if !matches!(bytes[0], b'/' | b'?' | b'#') {
420428
return Err(ErrorKind::PathDoesNotStartWithSlash);
421429
}

0 commit comments

Comments
 (0)