diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs index 58297f2979..1da609f774 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs @@ -290,7 +290,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http writer.Commit(); } - public void WriteResponseHeaders(int statusCode, string reasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk) + public void WriteResponseHeaders(int statusCode, string reasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk, bool appComplete) { lock (_contextLock) { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs index 164bb14877..c9ac239797 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs @@ -967,7 +967,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http var responseHeaders = CreateResponseHeaders(appCompleted); - Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk); + Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk, appCompleted); } private void VerifyInitializeState(int firstWriteByteCount) @@ -1454,7 +1454,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { if (data.Length == 0) { - Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk); + Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk, appCompleted: false); return Output.FlushAsync(cancellationToken); } @@ -1468,7 +1468,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } else { - Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk); + Output.WriteResponseHeaders(StatusCode, ReasonPhrase, responseHeaders, _autoChunk, appCompleted: false); HandleNonBodyResponseWrite(); return Output.FlushAsync(cancellationToken); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs index 3b0ffa31cc..86507e423b 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http ValueTask WriteChunkAsync(ReadOnlySpan data, CancellationToken cancellationToken); ValueTask FlushAsync(CancellationToken cancellationToken); ValueTask Write100ContinueAsync(); - void WriteResponseHeaders(int statusCode, string reasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk); + void WriteResponseHeaders(int statusCode, string reasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk, bool appCompleted); // This takes ReadOnlySpan instead of ReadOnlyMemory because it always synchronously copies data before flushing. ValueTask WriteDataToPipeAsync(ReadOnlySpan data, CancellationToken cancellationToken); Task WriteDataAsync(ReadOnlySpan data, CancellationToken cancellationToken); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs index 8fff9860ba..630927bb3f 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs @@ -156,7 +156,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 | Padding (*) ... +---------------------------------------------------------------+ */ - public void WriteResponseHeaders(int streamId, int statusCode, IHeaderDictionary headers) + public void WriteResponseHeaders(int streamId, int statusCode, Http2HeadersFrameFlags headerFrameFlags, IHeaderDictionary headers) { lock (_writeLock) { @@ -167,7 +167,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 try { - _outgoingFrame.PrepareHeaders(Http2HeadersFrameFlags.NONE, streamId); + _outgoingFrame.PrepareHeaders(headerFrameFlags, streamId); var buffer = _headerEncodingBuffer.AsSpan(); var done = _hpackEncoder.BeginEncode(statusCode, EnumerateHeaders(headers), buffer, out var payloadLength); FinishWritingHeaders(streamId, payloadLength, done); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs index 4ac56092bc..fec48783ef 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs @@ -31,6 +31,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 private readonly ValueTask _dataWriteProcessingTask; private bool _startedWritingDataFrames; private bool _completed; + private bool _streamEnded; private bool _disposed; public Http2OutputProducer( @@ -131,7 +132,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 } } - public void WriteResponseHeaders(int statusCode, string ReasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk) + public void WriteResponseHeaders(int statusCode, string ReasonPhrase, HttpResponseHeaders responseHeaders, bool autoChunk, bool appCompleted) { lock (_dataWriterLock) { @@ -142,7 +143,26 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 return; } - _frameWriter.WriteResponseHeaders(_streamId, statusCode, responseHeaders); + // If the responseHeaders will be written as the final HEADERS frame then + // set END_STREAM on the HEADERS frame. This avoids the need to write an + // empty DATA frame with END_STREAM. + // + // The headers will be the final frame if: + // 1. There is no content + // 2. There is no trailing HEADERS frame. + Http2HeadersFrameFlags http2HeadersFrame; + + if (appCompleted && !_startedWritingDataFrames && (_stream.Trailers == null || _stream.Trailers.Count == 0)) + { + _streamEnded = true; + http2HeadersFrame = Http2HeadersFrameFlags.END_STREAM; + } + else + { + http2HeadersFrame = Http2HeadersFrameFlags.NONE; + } + + _frameWriter.WriteResponseHeaders(_streamId, statusCode, http2HeadersFrame, responseHeaders); } } @@ -258,7 +278,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { lock (_dataWriterLock) { - WriteResponseHeaders(statusCode, reasonPhrase, responseHeaders, autoChunk); + WriteResponseHeaders(statusCode, reasonPhrase, responseHeaders, autoChunk, appCompleted: false); return WriteDataToPipeAsync(data, cancellationToken); } @@ -296,6 +316,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 if (readResult.IsCompleted && _stream.Trailers?.Count > 0) { + // Output is ending and there are trailers to write + // Write any remaining content then write trailers if (readResult.Buffer.Length > 0) { flushResult = await _frameWriter.WriteDataAsync(_streamId, _flowControl, readResult.Buffer, endStream: false); @@ -303,6 +325,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 flushResult = await _frameWriter.WriteResponseTrailers(_streamId, _stream.Trailers); } + else if (readResult.IsCompleted && _streamEnded) + { + Debug.Assert(readResult.Buffer.Length == 0); + + // Headers have already been written and there is no other content to write + flushResult = await _frameWriter.FlushAsync(outputAborter: null, cancellationToken: default); + } else { flushResult = await _frameWriter.WriteDataAsync(_streamId, _flowControl, readResult.Buffer, endStream: readResult.IsCompleted); diff --git a/src/Servers/Kestrel/samples/Http2SampleApp/Startup.cs b/src/Servers/Kestrel/samples/Http2SampleApp/Startup.cs index c2d84b42fe..4d249e6343 100644 --- a/src/Servers/Kestrel/samples/Http2SampleApp/Startup.cs +++ b/src/Servers/Kestrel/samples/Http2SampleApp/Startup.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -7,7 +8,6 @@ namespace Http2SampleApp { public class Startup { - public void ConfigureServices(IServiceCollection services) { } diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index c6b15ca204..2081227840 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -656,11 +656,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await WaitForStreamErrorAsync(expectedStreamId: 1, Http2ErrorCode.NO_ERROR, null); @@ -904,11 +900,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await SendDataAsync(1, _helloWorldBytes, endStream: false); @@ -940,11 +932,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); await SendDataAsync(1, _helloWorldBytes, endStream: true); @@ -1069,11 +1057,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); // Relieve connection backpressure to receive the rest of the first streams body. @@ -1107,11 +1091,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1126,11 +1106,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -1150,11 +1126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -1171,11 +1143,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -1195,11 +1163,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -1225,11 +1189,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests // The second stream should end first, since the first one is waiting for the request body. await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); if (sendData) @@ -1241,11 +1201,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -1327,22 +1283,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS), - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); finishFirstRequest.TrySetResult(null); await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS), - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 3, ignoreNonGoAwayFrames: false); @@ -1368,11 +1316,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS), - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 3, ignoreNonGoAwayFrames: false); @@ -1415,11 +1359,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); // Try to re-use the stream ID (http://httpwg.org/specs/rfc7540.html#rfc.section.5.1.1) @@ -1462,11 +1402,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); // Stream 1 was implicitly closed by opening stream 3 before (http://httpwg.org/specs/rfc7540.html#rfc.section.5.1.1) @@ -1690,11 +1626,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1839,11 +1771,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -3349,11 +3277,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_twoContinuationsRequestHeaders); @@ -3379,11 +3303,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests // The second stream should end first, since the first one is waiting for the request body. await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 3); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 3); if (sendData) @@ -3406,11 +3326,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); VerifyDecodedRequestHeaders(_browserRequestHeaders); @@ -3503,11 +3419,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -3522,7 +3434,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 12361, - withFlags: (byte)Http2HeadersFrameFlags.NONE, + withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, withStreamId: 1); var continuationFrame1 = await ExpectAsync(Http2FrameType.CONTINUATION, withLength: 12306, @@ -3532,10 +3444,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests withLength: 8204, withFlags: (byte)Http2ContinuationFrameFlags.END_HEADERS, withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, - withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -3685,11 +3593,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); // Send a blocked request @@ -3875,11 +3779,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, null); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs index 83d1a264e0..09c9dafae6 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs @@ -79,11 +79,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 70, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -108,11 +104,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 71, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -139,11 +131,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 75, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -171,11 +159,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 76, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -209,11 +193,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 118, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -255,11 +235,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2HeadersFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -321,11 +297,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -354,11 +326,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -387,11 +355,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 65, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -422,11 +386,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 65, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -457,11 +417,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 65, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -492,11 +448,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 65, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -618,11 +570,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -663,11 +611,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -711,11 +655,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -758,11 +698,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -815,11 +751,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1051,11 +983,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1164,11 +1092,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); Assert.Contains(TestApplicationErrorLogger.Messages, m => m.Exception?.Message.Contains("Response Content-Length mismatch: too few bytes written (0 of 11).") ?? false); @@ -1628,11 +1552,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1671,11 +1591,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 59, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await WaitForStreamErrorAsync(expectedStreamId: 1, Http2ErrorCode.NO_ERROR, null); @@ -1718,11 +1634,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -1762,11 +1674,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 59, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, null); @@ -1825,12 +1733,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 59, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); + await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, null); // Logged without an exception. Assert.Contains(TestApplicationErrorLogger.Messages, m => m.Message.Contains("the application completed without reading the entire request body.")); @@ -1883,11 +1788,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -2135,11 +2036,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); Assert.Contains(TestApplicationErrorLogger.Messages, m => (m.Exception?.Message.Contains("App Faulted") ?? false) && m.LogLevel == LogLevel.Error); @@ -2562,11 +2459,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -3012,7 +2905,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests public async Task WriteAsync_GetMemoryWithSizeHintAlwaysReturnsSameSizeStartAsync() { var headers = new[] -{ + { new KeyValuePair(HeaderNames.Method, "GET"), new KeyValuePair(HeaderNames.Path, "/"), new KeyValuePair(HeaderNames.Scheme, "http"), @@ -3034,11 +2927,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - var dataFrame = await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); @@ -3335,13 +3224,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, - withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); _hpackDecoder.Decode(headersFrame.PayloadSequence, endHeaders: false, handler: this); @@ -3408,12 +3293,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs index 812c533fa4..8bb8a5181b 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs @@ -103,11 +103,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); await setTimeoutTcs.Task.DefaultTimeout(); @@ -861,11 +857,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await ExpectAsync(Http2FrameType.HEADERS, withLength: 55, - withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS, - withStreamId: 1); - await ExpectAsync(Http2FrameType.DATA, - withLength: 0, - withFlags: (byte)Http2DataFrameFlags.END_STREAM, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), withStreamId: 1); var updateFrame = await ExpectAsync(Http2FrameType.WINDOW_UPDATE,