File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -953,17 +953,18 @@ fn parse_token<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
953953#[ allow( missing_docs) ]
954954// WARNING: Exported for internal benchmarks, not fit for public consumption
955955pub fn parse_uri < ' a > ( bytes : & mut Bytes < ' a > ) -> Result < & ' a str > {
956- // URI must have at least one char
957956 let uri_len = simd:: match_uri_vectored ( bytes. as_ref ( ) ) ;
958- if uri_len == 0 {
959- return Err ( Error :: Token ) ;
960- }
961957 // SAFETY: these bytes have just been matched here above.
962958 unsafe { bytes. advance ( uri_len) } ;
959+
963960 let uri_slice = bytes. slice ( ) ;
964961
965962 let space_delim = next ! ( bytes) ;
966963 if space_delim == b' ' {
964+ // URI must have at least one char
965+ if uri_len == 0 {
966+ return Err ( Error :: Token ) ;
967+ }
967968 // SAFETY: all bytes within `uri_slice` must have been `is_token` and therefore also utf-8.
968969 let uri = unsafe { str:: from_utf8_unchecked ( uri_slice) } ;
969970 Ok ( Status :: Complete ( uri) )
You can’t perform that action at this time.
0 commit comments