This repository was archived by the owner on Dec 18, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed
src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http
test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
tools/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -3404,7 +3404,6 @@ protected override bool RemoveFast(string key)
3404
3404
{
3405
3405
if ( ( ( _bits & 2048L ) != 0 ) )
3406
3406
{
3407
- _contentLength = null ;
3408
3407
_bits &= ~ 2048L ;
3409
3408
_headers . _ContentLength = StringValues . Empty ;
3410
3409
return true ;
@@ -3701,7 +3700,7 @@ protected override void ClearFast()
3701
3700
{
3702
3701
_bits = 0 ;
3703
3702
_headers = default ( HeaderReferences ) ;
3704
- _contentLength = null ;
3703
+
3705
3704
MaybeUnknown ? . Clear ( ) ;
3706
3705
}
3707
3706
Original file line number Diff line number Diff line change @@ -499,16 +499,22 @@ await connection.ReceiveEnd(
499
499
errorMessage . Exception . Message ) ;
500
500
}
501
501
502
- [ Fact ]
503
- public async Task WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown ( )
502
+ [ Theory ]
503
+ [ InlineData ( false ) ]
504
+ [ InlineData ( true ) ]
505
+ public async Task WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown ( bool flushResponse )
504
506
{
505
507
var testLogger = new TestApplicationErrorLogger ( ) ;
506
508
var serviceContext = new TestServiceContext { Log = new TestKestrelTrace ( testLogger ) } ;
507
509
508
- using ( var server = new TestServer ( httpContext =>
510
+ using ( var server = new TestServer ( async httpContext =>
509
511
{
510
512
httpContext . Response . ContentLength = 0 ;
511
- return TaskCache . CompletedTask ;
513
+
514
+ if ( flushResponse )
515
+ {
516
+ await httpContext . Response . Body . FlushAsync ( ) ;
517
+ }
512
518
} , serviceContext ) )
513
519
{
514
520
using ( var connection = server . CreateConnection ( ) )
Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ protected override bool RemoveFast(string key)
361
361
if ( "" { header . Name } "" . Equals ( key , StringComparison . OrdinalIgnoreCase ) )
362
362
{ {
363
363
if ( { header . TestBit ( ) } )
364
- { { { If ( header . Identifier == "ContentLength" , ( ) => $@ "
364
+ { { { If ( loop . ClassName == "FrameResponseHeaders" && header . Identifier == "ContentLength" , ( ) => $@ "
365
365
_contentLength = null;" ) }
366
366
{ header. ClearBit ( ) } ;
367
367
_headers . _ { header . Identifier } = StringValues . Empty ; { ( header . EnhancedSetter == false ? "" : $@ "
@@ -382,7 +382,7 @@ protected override void ClearFast()
382
382
{ {
383
383
_bits = 0 ;
384
384
_headers = default ( HeaderReferences ) ;
385
- _contentLength = null ;
385
+ { ( loop . ClassName == "FrameResponseHeaders" ? " _contentLength = null;" : "" ) }
386
386
MaybeUnknown ? . Clear ( ) ;
387
387
} }
388
388
You can’t perform that action at this time.
0 commit comments