Skip to content

Commit b757ba3

Browse files
committed
Change error to HTTP_1_1_REQUIRED
1 parent 6d68066 commit b757ba3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
1414

1515
internal partial class Http1Connection : HttpProtocol, IRequestProcessor, IHttpOutputAborter
1616
{
17-
internal static ReadOnlySpan<byte> Http2GoAwayProtocolErrorBytes => new byte[17] { 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 };
17+
internal static ReadOnlySpan<byte> Http2GoAwayHttp11RequiredBytes => new byte[17] { 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 };
1818

1919
private const byte ByteAsterisk = (byte)'*';
2020
private const byte ByteForwardSlash = (byte)'/';
@@ -746,7 +746,7 @@ private void DetectHttp2Preface(ReadOnlySequence<byte> requestData, BadHttpReque
746746
{
747747
Log.PossibleInvalidHttpVersionDetected(ConnectionId, Http.HttpVersion.Http11, Http.HttpVersion.Http2);
748748

749-
_context.Transport.Output.Write(Http2GoAwayProtocolErrorBytes);
749+
_context.Transport.Output.Write(Http2GoAwayHttp11RequiredBytes);
750750

751751
// Aborting the connection here stops Http1Connection from writing HTTP/1.1 response.
752752
CancelRequestAbortedToken();

src/Servers/Kestrel/test/InMemory.FunctionalTests/BadHttpRequestTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public async Task BadRequestForHttp2()
206206

207207
var data = await client.Stream.ReadAtLeastLengthAsync(17);
208208

209-
Assert.Equal(Http1Connection.Http2GoAwayProtocolErrorBytes.ToArray(), data);
209+
Assert.Equal(Http1Connection.Http2GoAwayHttp11RequiredBytes.ToArray(), data);
210210
}
211211
}
212212
}

0 commit comments

Comments
 (0)