File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -851,18 +851,16 @@ pub fn parse_method<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
851851 Some ( GET ) => {
852852 // SAFETY: matched the ASCII string and boundary checked
853853 let method = unsafe {
854- bytes. advance ( 4 ) ;
855- let buf = bytes. slice_skip ( 1 ) ;
856- str:: from_utf8_unchecked ( buf)
854+ bytes. advance_and_commit ( 4 ) ;
855+ str:: from_utf8_unchecked ( GET [ ..GET . len ( ) -1 ] )
857856 } ;
858857 Ok ( Status :: Complete ( method) )
859858 }
860859 Some ( POST ) if bytes. peek_ahead ( 4 ) == Some ( b' ' ) => {
861860 // SAFETY: matched the ASCII string and boundary checked
862861 let method = unsafe {
863- bytes. advance ( 5 ) ;
864- let buf = bytes. slice_skip ( 1 ) ;
865- str:: from_utf8_unchecked ( buf)
862+ bytes. advance_and_commit ( 5 ) ;
863+ str:: from_utf8_unchecked ( POST [ ..] )
866864 } ;
867865 Ok ( Status :: Complete ( method) )
868866 }
You can’t perform that action at this time.
0 commit comments