Skip to content

Commit d87133f

Browse files
committed
Check for sentinel value when setting HTTP/3 error code
If no error code has been set, `IProtocolErrorFeature.Error` will be `-1`. If we pass that through verbatim, it will be caught by validation in the setter (ironically, of the same property on the same feature object), resulting in an exception and a Critical (but apparently benign) log message. Fixes #57933
1 parent ffd5a38 commit d87133f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> appl
546546
}
547547

548548
// Complete
549-
Abort(CreateConnectionAbortError(error, clientAbort), (Http3ErrorCode)_errorCodeFeature.Error, reason);
549+
var errorCode = _errorCodeFeature.Error == -1 ? Http3ErrorCode.NoError : (Http3ErrorCode)_errorCodeFeature.Error;
550+
Abort(CreateConnectionAbortError(error, clientAbort), errorCode, reason);
550551

551552
// Wait for active requests to complete.
552553
while (_activeRequestCount > 0)

0 commit comments

Comments
 (0)