31 instantiations of BadHttpRequestException
Microsoft.AspNetCore.Server.Kestrel.Core (31)
KestrelBadHttpRequestException.cs (31)
32ex = new BadHttpRequestException(CoreStrings.BadRequest_InvalidRequestHeadersNoCRLF, StatusCodes.Status400BadRequest, reason); 35ex = new BadHttpRequestException(CoreStrings.BadRequest_InvalidRequestLine, StatusCodes.Status400BadRequest, reason); 38ex = new BadHttpRequestException(CoreStrings.BadRequest_MalformedRequestInvalidHeaders, StatusCodes.Status400BadRequest, reason); 41ex = new BadHttpRequestException(CoreStrings.BadRequest_MultipleContentLengths, StatusCodes.Status400BadRequest, reason); 44ex = new BadHttpRequestException(CoreStrings.BadRequest_UnexpectedEndOfRequestContent, StatusCodes.Status400BadRequest, reason); 47ex = new BadHttpRequestException(CoreStrings.BadRequest_BadChunkSuffix, StatusCodes.Status400BadRequest, reason); 50ex = new BadHttpRequestException(CoreStrings.BadRequest_BadChunkSizeData, StatusCodes.Status400BadRequest, reason); 53ex = new BadHttpRequestException(CoreStrings.BadRequest_ChunkedRequestIncomplete, StatusCodes.Status400BadRequest, reason); 56ex = new BadHttpRequestException(CoreStrings.BadRequest_InvalidCharactersInHeaderName, StatusCodes.Status400BadRequest, reason); 59ex = new BadHttpRequestException(CoreStrings.BadRequest_RequestLineTooLong, StatusCodes.Status414UriTooLong, reason); 62ex = new BadHttpRequestException(CoreStrings.BadRequest_HeadersExceedMaxTotalSize, StatusCodes.Status431RequestHeaderFieldsTooLarge, reason); 65ex = new BadHttpRequestException(CoreStrings.BadRequest_TooManyHeaders, StatusCodes.Status431RequestHeaderFieldsTooLarge, reason); 68ex = new BadHttpRequestException(CoreStrings.BadRequest_RequestHeadersTimeout, StatusCodes.Status408RequestTimeout, reason); 71ex = new BadHttpRequestException(CoreStrings.BadRequest_RequestBodyTimeout, StatusCodes.Status408RequestTimeout, reason); 74ex = new BadHttpRequestException(CoreStrings.BadRequest_MethodNotAllowed, StatusCodes.Status405MethodNotAllowed, reason, HttpMethod.Options); 77ex = new BadHttpRequestException(CoreStrings.BadRequest_MethodNotAllowed, StatusCodes.Status405MethodNotAllowed, reason, HttpMethod.Connect); 80ex = new BadHttpRequestException(CoreStrings.BadRequest_MissingHostHeader, StatusCodes.Status400BadRequest, reason); 83ex = new BadHttpRequestException(CoreStrings.BadRequest_MultipleHostHeaders, StatusCodes.Status400BadRequest, reason); 86ex = new BadHttpRequestException(CoreStrings.BadRequest_InvalidHostHeader, StatusCodes.Status400BadRequest, reason); 89ex = new BadHttpRequestException(CoreStrings.BadRequest, StatusCodes.Status400BadRequest, reason); 116ex = new BadHttpRequestException(CoreStrings.HttpParserTlsOverHttpError, StatusCodes.Status400BadRequest, reason); 119ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_InvalidRequestLine_Detail(detail), StatusCodes.Status400BadRequest, reason); 122ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_InvalidRequestTarget_Detail(detail), StatusCodes.Status400BadRequest, reason); 125ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_InvalidRequestHeader_Detail(detail), StatusCodes.Status400BadRequest, reason); 128ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_InvalidContentLength_Detail(detail), StatusCodes.Status400BadRequest, reason); 131ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_UnrecognizedHTTPVersion(detail), StatusCodes.Status505HttpVersionNotsupported, reason); 134ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_FinalTransferCodingNotChunked(detail), StatusCodes.Status400BadRequest, reason); 137ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_LengthRequiredHttp10(detail), StatusCodes.Status400BadRequest, reason); 140ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_InvalidHostHeader_Detail(detail), StatusCodes.Status400BadRequest, reason); 143ex = new BadHttpRequestException(CoreStrings.FormatBadRequest_RequestBodyTooLarge(detail), StatusCodes.Status413PayloadTooLarge, reason); 146ex = new BadHttpRequestException(CoreStrings.BadRequest, StatusCodes.Status400BadRequest, reason);
129 references to BadHttpRequestException
InMemory.FunctionalTests (50)
ChunkedRequestTests.cs (4)
15using BadHttpRequestException = Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException; 858var exTcs = new TaskCompletionSource<BadHttpRequestException>(TaskCreationOptions.RunContinuationsAsynchronously); 871catch (BadHttpRequestException badRequestEx) 897var badReqEx = await exTcs.Task.TimeoutAfter(TestConstants.DefaultTimeout);
Http2\Http2StreamTests.cs (6)
1895BadHttpRequestException exception = null; 1908exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 1981BadHttpRequestException exception = null; 1993exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 2033BadHttpRequestException exception = null; 2054exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () =>
Http3\Http3StreamTests.cs (6)
2529BadHttpRequestException exception = null; 2542exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 2602BadHttpRequestException exception = null; 2614exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 2646BadHttpRequestException exception = null; 2667exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () =>
MaxRequestBodySizeTests.cs (21)
14using BadHttpRequestException = Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException; 28BadHttpRequestException requestRejectedEx = null; 36requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>( 76BadHttpRequestException requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 123BadHttpRequestException requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 166BadHttpRequestException requestRejectedEx = null; 179requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>( 369BadHttpRequestException requestRejectedEx1 = null; 370BadHttpRequestException requestRejectedEx2 = null; 377requestRejectedEx1 = await Assert.ThrowsAsync<BadHttpRequestException>( 379requestRejectedEx2 = await Assert.ThrowsAsync<BadHttpRequestException>( 418BadHttpRequestException requestRejectedEx = null; 425requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 510BadHttpRequestException requestRejectedEx = null; 534requestRejectedEx = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 582BadHttpRequestException requestRejectedEx1 = null; 583BadHttpRequestException requestRejectedEx2 = null; 590requestRejectedEx1 = await Assert.ThrowsAsync<BadHttpRequestException>( 592requestRejectedEx2 = await Assert.ThrowsAsync<BadHttpRequestException>(
ResponseTests.cs (13)
28using BadHttpRequestException = Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException; 479BadHttpRequestException readException = null; 485readException = await Assert.ThrowsAsync<BadHttpRequestException>( 510Assert.Contains(TestSink.Writes, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException 511&& ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); 2028Assert.Contains(LogMessages, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException 2029&& ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); 2082if (message.EventId.Id == 17 && message.LogLevel <= LogLevel.Debug && message.Exception is BadHttpRequestException 2083&& ((BadHttpRequestException)message.Exception).StatusCode == StatusCodes.Status400BadRequest) 2145Assert.Contains(LogMessages, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException 2146&& ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest); 4764Assert.Contains(testSink.Writes, w => w.EventId.Id == 17 && w.LogLevel <= LogLevel.Debug && w.Exception is BadHttpRequestException 4765&& ((BadHttpRequestException)w.Exception).StatusCode == StatusCodes.Status400BadRequest);
Microsoft.AspNetCore.Server.Kestrel.Core (10)
Internal\Http\Http1Connection.cs (4)
728catch (BadHttpRequestException ex) 788var kestrelEx = ex as BadHttpRequestException; 828private void OnBadRequest(ReadOnlySequence<byte> requestData, BadHttpRequestException ex)
Internal\Http\HttpProtocol.cs (1)
1338if (ex is Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException kestrelEx && !StringValues.IsNullOrEmpty(kestrelEx.AllowedHeader))
Internal\Http2\Http2Connection.cs (1)
1643catch (BadHttpRequestException bre) when (bre.Reason == RequestRejectionReason.TooManyHeaders)
KestrelBadHttpRequestException.cs (4)
26internal static BadHttpRequestException GetException(RequestRejectionReason reason) 28BadHttpRequestException ex; 110internal static BadHttpRequestException GetException(RequestRejectionReason reason, string detail) 112BadHttpRequestException ex;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (69)
Http1\Http1ConnectionTests.cs (2)
560var exception = Assert.Throws<BadHttpRequestException>(() =>
HttpParserTests.cs (28)
86var exception = Assert.Throws<BadHttpRequestException>(() => 120var exception = Assert.Throws<BadHttpRequestException>(() => 139var exception = Assert.Throws<BadHttpRequestException>(() => 167var exception = Assert.Throws<BadHttpRequestException>(() => 185var exception = Assert.Throws<BadHttpRequestException>(() => 332Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 384Assert.Throws<BadHttpRequestException>(() => VerifyRawHeaders(rawHeaders, expectedHeaderNames, expectedHeaderValues, disableHttp1LineFeedTerminators: true)); 487var exception = Assert.Throws<BadHttpRequestException>(() => 507var exception = Assert.Throws<BadHttpRequestException>(() => 528var exception = Assert.Throws<BadHttpRequestException>(() => 539exception = Assert.Throws<BadHttpRequestException>(() => 550exception = Assert.Throws<BadHttpRequestException>(() => 586var badHttpRequestException = Assert.Throws<BadHttpRequestException>(() => 605var exception = Assert.Throws<BadHttpRequestException>(() => 625var exception = Assert.Throws<BadHttpRequestException>(() => 787var exception = Assert.Throws<BadHttpRequestException>(() =>
HttpRequestHeadersTests.cs (2)
401var exception = Assert.Throws<BadHttpRequestException>(
MessageBodyTests.cs (37)
228await Assert.ThrowsAsync<BadHttpRequestException>(() => task); 256await Assert.ThrowsAsync<BadHttpRequestException>(() => task); 297await Assert.ThrowsAsync<BadHttpRequestException>(() => task); 401var ex = await Assert.ThrowsAsync<BadHttpRequestException>(async () => 548var ex = Assert.Throws<BadHttpRequestException>(() => 582var ex = Assert.Throws<BadHttpRequestException>(() => 747var exception = await Assert.ThrowsAsync<BadHttpRequestException>(async () => await body.ReadAsync()); 780m.Exception is BadHttpRequestException ex && 811var exception = await Assert.ThrowsAsync<BadHttpRequestException>(() => stream.CopyToAsync(ms)); 1221var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1222var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1223var ex2 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask()); 1224var ex3 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask()); 1254var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1255var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1256var ex2 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask()); 1257var ex3 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask()); 1281var ex0 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1282var ex1 = Assert.Throws<BadHttpRequestException>(() => reader.TryRead(out var readResult)); 1283var ex2 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask()); 1284var ex3 = await Assert.ThrowsAsync<BadHttpRequestException>(() => reader.ReadAsync().AsTask());