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