Skip to content

Commit

Permalink
Check for sentinel value when setting HTTP/3 error code
Browse files Browse the repository at this point in the history
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 dotnet#57933
  • Loading branch information
amcasey committed Sep 18, 2024
1 parent ffd5a38 commit d87133f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> appl
}

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

// Wait for active requests to complete.
while (_activeRequestCount > 0)
Expand Down

0 comments on commit d87133f

Please sign in to comment.