Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/uri/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ const fn scan_path_and_query(bytes: &[u8]) -> Result<Scanned, ErrorKind> {
0x7E => {}

// potentially utf8, might not, should check
0x7F..=0xFF => {
0x80..=0xFF => {
is_maybe_not_utf8 = true;
}

Expand Down Expand Up @@ -484,7 +484,7 @@ const fn scan_path_and_query(bytes: &[u8]) -> Result<Scanned, ErrorKind> {
0x3D |
0x3F..=0x7E => {}

0x7F..=0xFF => {
0x80..=0xFF => {
is_maybe_not_utf8 = true;
}

Expand Down Expand Up @@ -639,6 +639,16 @@ mod tests {
PathAndQuery::try_from("sneaky").expect_err("reject missing slash");
}

#[test]
fn rejects_del_in_path() {
PathAndQuery::try_from(&[b'/', 0x7F][..]).expect_err("reject DEL");
}

#[test]
fn rejects_del_in_query() {
PathAndQuery::try_from(&[b'/', b'a', b'?', 0x7F][..]).expect_err("reject DEL");
}

#[test]
fn json_is_fine() {
assert_eq!(
Expand Down