Skip to content

Commit 0fa6005

Browse files
committed
Fix parsing backslashes in request-targets
1 parent 84e10de commit 0fa6005

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static URI_MAP: [bool; 256] = byte_map![
7171
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
7272
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7373
// @ A B C D E F G H I J K L M N O
74-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
74+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7575
// P Q R S T U V W X Y Z [ \ ] ^ _
7676
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7777
// ` a b c d e f g h i j k l m n o
@@ -983,6 +983,17 @@ mod tests {
983983
}
984984
}
985985

986+
req! {
987+
test_request_path_backslash,
988+
b"\n\nGET /\\?wayne\\=5 HTTP/1.1\n\n",
989+
|req| {
990+
assert_eq!(req.method.unwrap(), "GET");
991+
assert_eq!(req.path.unwrap(), "/\\?wayne\\=5");
992+
assert_eq!(req.version.unwrap(), 1);
993+
assert_eq!(req.headers.len(), 0);
994+
}
995+
}
996+
986997
req! {
987998
test_request_with_invalid_token_delimiter,
988999
b"GET\n/ HTTP/1.1\r\nHost: foo.bar\r\n\r\n",

0 commit comments

Comments
 (0)