File tree 1 file changed +17
-0
lines changed 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ impl PathAndQuery {
51
51
0x7C |
52
52
0x7E => { } ,
53
53
54
+ // These are code points that are supposed to be
55
+ // percent-encoded in the path but there are clients
56
+ // out there sending them as is and httparse accepts
57
+ // to parse those requests, so they are allowed here
58
+ // for parity.
59
+ //
60
+ // For reference, those are code points that are used
61
+ // to send requests with JSON directly embedded in
62
+ // the URI path. Yes, those things happen for real.
63
+ b'"' |
64
+ b'{' | b'}' => { } ,
65
+
54
66
_ => return Err ( ErrorKind :: InvalidUriChar . into ( ) ) ,
55
67
}
56
68
}
@@ -527,6 +539,11 @@ mod tests {
527
539
assert_eq ! ( "qr=%3" , pq( "/a/b?qr=%3" ) . query( ) . unwrap( ) ) ;
528
540
}
529
541
542
+ #[ test]
543
+ fn json_is_fine ( ) {
544
+ assert_eq ! ( r#"/{"bread":"baguette"}"# , pq( r#"/{"bread":"baguette"}"# ) . path( ) ) ;
545
+ }
546
+
530
547
fn pq ( s : & str ) -> PathAndQuery {
531
548
s. parse ( ) . expect ( & format ! ( "parsing {}" , s) )
532
549
}
You can’t perform that action at this time.
0 commit comments