Skip to content

Commit 9b036f4

Browse files
committed
Comment
1 parent 6418e1d commit 9b036f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ protected override bool TryParseRequest(ReadResult result, out bool endConnectio
717717
#pragma warning disable CS0618 // Type or member is obsolete
718718
catch (BadHttpRequestException ex)
719719
{
720-
OnBaseRequest(result.Buffer, ex);
720+
OnBadRequest(result.Buffer, ex);
721721
throw;
722722
}
723723
#pragma warning restore CS0618 // Type or member is obsolete
@@ -776,11 +776,14 @@ protected override bool TryParseRequest(ReadResult result, out bool endConnectio
776776
}
777777

778778
#pragma warning disable CS0618 // Type or member is obsolete
779-
private void OnBaseRequest(ReadOnlySequence<byte> requestData, BadHttpRequestException ex)
779+
private void OnBadRequest(ReadOnlySequence<byte> requestData, BadHttpRequestException ex)
780780
#pragma warning restore CS0618 // Type or member is obsolete
781781
{
782782
var reason = ex.Reason;
783783

784+
// Some code shared between HTTP versions throws errors. For example, HttpRequestHeaders collection
785+
// throws when an invalid content length is set.
786+
// Only want to set a reasons for HTTP/1.1 connection, so set end reason by catching the exception here.
784787
switch (reason)
785788
{
786789
case RequestRejectionReason.UnrecognizedHTTPVersion:

0 commit comments

Comments
 (0)