@@ -28,8 +28,6 @@ internal sealed class Http1ChunkedEncodingMessageBody : Http1MessageBody
2828 private readonly Pipe _requestBodyPipe ;
2929 private ReadResult _readResult ;
3030
31- private static readonly bool InsecureChunkedParsing = AppContext . TryGetSwitch ( "Microsoft.AspNetCore.Server.Kestrel.EnableInsecureChunkedRequestParsing" , out var value ) && value ;
32-
3331 public Http1ChunkedEncodingMessageBody ( Http1Connection context , bool keepAlive )
3432 : base ( context , keepAlive )
3533 {
@@ -363,15 +361,7 @@ private void ParseExtension(ReadOnlySequence<byte> buffer, out SequencePosition
363361
364362 do
365363 {
366- SequencePosition ? extensionCursorPosition ;
367- if ( InsecureChunkedParsing )
368- {
369- extensionCursorPosition = buffer . PositionOf ( ByteCR ) ;
370- }
371- else
372- {
373- extensionCursorPosition = buffer . PositionOfAny ( ByteCR , ByteLF ) ;
374- }
364+ SequencePosition ? extensionCursorPosition = buffer . PositionOfAny ( ByteCR , ByteLF ) ;
375365
376366 if ( extensionCursorPosition == null )
377367 {
@@ -398,9 +388,7 @@ private void ParseExtension(ReadOnlySequence<byte> buffer, out SequencePosition
398388 suffixBuffer = suffixBuffer . Slice ( 0 , 2 ) ;
399389 var suffixSpan = suffixBuffer . ToSpan ( ) ;
400390
401- if ( InsecureChunkedParsing
402- ? ( suffixSpan [ 1 ] == ByteLF )
403- : ( suffixSpan [ 0 ] == ByteCR && suffixSpan [ 1 ] == ByteLF ) )
391+ if ( suffixSpan [ 0 ] == ByteCR && suffixSpan [ 1 ] == ByteLF )
404392 {
405393 // We consumed the \r\n at the end of the extension, so switch modes.
406394 _mode = _inputLength > 0 ? Mode . Data : Mode . Trailer ;
@@ -409,14 +397,6 @@ private void ParseExtension(ReadOnlySequence<byte> buffer, out SequencePosition
409397 examined = suffixBuffer . End ;
410398 AddAndCheckObservedBytes ( charsToByteCRExclusive + 2 ) ;
411399 }
412- else if ( InsecureChunkedParsing )
413- {
414- examined = buffer . Start ;
415- // Don't consume suffixSpan[1] in case it is also a \r.
416- buffer = buffer . Slice ( charsToByteCRExclusive + 1 ) ;
417- consumed = extensionCursor ;
418- AddAndCheckObservedBytes ( charsToByteCRExclusive + 1 ) ;
419- }
420400 else
421401 {
422402 consumed = suffixBuffer . End ;
0 commit comments