File tree 2 files changed +8
-6
lines changed
src/Kestrel.Core/Internal/Http
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,15 @@ private async Task PumpAsync()
91
91
// Read() will have already have greedily consumed the entire request body if able.
92
92
if ( result . IsCompleted )
93
93
{
94
+ // OnInputOrOutputCompleted() is an idempotent method that closes the connection. Sometimes
95
+ // input completion is observed here before the Input.OnWriterCompleted() callback is fired,
96
+ // so we call OnInputOrOutputCompleted() now to prevent a race in our tests where a 400
97
+ // response is written after observing the unexpected end of request content instead of just
98
+ // closing the connection without a response as expected.
99
+ _context . OnInputOrOutputCompleted ( ) ;
100
+
94
101
// Treat any FIN from an upgraded request as expected.
95
- // It's up to higher-level consumer (i.e. WebSocket middleware) to determine
102
+ // It's up to higher-level consumer (i.e. WebSocket middleware) to determine
96
103
// if the end is actually expected based on higher-level framing.
97
104
if ( RequestUpgrade )
98
105
{
Original file line number Diff line number Diff line change @@ -1302,11 +1302,6 @@ private BadHttpRequestException GetInvalidRequestTargetException(Span<byte> targ
1302
1302
? target . GetAsciiStringEscaped ( Constants . MaxExceptionDetailSize )
1303
1303
: string . Empty ) ;
1304
1304
1305
- public void SetBadRequestState ( RequestRejectionReason reason )
1306
- {
1307
- SetBadRequestState ( BadHttpRequestException . GetException ( reason ) ) ;
1308
- }
1309
-
1310
1305
public void SetBadRequestState ( BadHttpRequestException ex )
1311
1306
{
1312
1307
Log . ConnectionBadRequest ( ConnectionId , ex ) ;
You can’t perform that action at this time.
0 commit comments