diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index a20758536f80..0cacdb447eb7 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -163,14 +163,14 @@ await ExpectAsync(Http2FrameType.DATA, [Fact] public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderReused() { - IEnumerable> requestHeaders = new[] + var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/hello"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair(HeaderNames.ContentType, "application/json") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/hello"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentType, "application/json") + }; await InitializeConnectionAsync(_readHeadersApplication); @@ -214,7 +214,7 @@ public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfN { const BindingFlags privateFlags = BindingFlags.NonPublic | BindingFlags.Instance; - IEnumerable> requestHeaders1 = new[] + var requestHeaders1 = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -224,7 +224,7 @@ public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfN }; // Note: No content-type - IEnumerable> requestHeaders2 = new[] + var requestHeaders2 = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -307,14 +307,14 @@ public ResponseTrailersWrapper(IHeaderDictionary headers) [Fact] public async Task ResponseTrailers_MultipleStreams_Reset() { - IEnumerable> requestHeaders = new[] + var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/hello"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair(HeaderNames.ContentType, "application/json") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/hello"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentType, "application/json") + }; var requestCount = 0; IHeaderDictionary trailersFirst = null; @@ -2632,11 +2632,11 @@ public Task HEADERS_Received_HeaderBlockContainsUnknownPseudoHeaderField_Connect { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(":unknown", "0"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(":unknown", "0"), + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, expectedErrorMessage: CoreStrings.HttpErrorUnknownPseudoHeaderField); } @@ -2646,11 +2646,11 @@ public Task HEADERS_Received_HeaderBlockContainsResponsePseudoHeaderField_Connec { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Status, "200"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Status, "200"), + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, expectedErrorMessage: CoreStrings.HttpErrorResponsePseudoHeaderField); } @@ -2723,18 +2723,18 @@ public Task HEADERS_Received_HeaderBlockOverLimit_ConnectionError() // > 32kb var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair("e", _4kHeaderValue), - new KeyValuePair("f", _4kHeaderValue), - new KeyValuePair("g", _4kHeaderValue), - new KeyValuePair("h", _4kHeaderValue), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair("e", _4kHeaderValue), + new KeyValuePair("f", _4kHeaderValue), + new KeyValuePair("g", _4kHeaderValue), + new KeyValuePair("h", _4kHeaderValue), + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, CoreStrings.BadRequest_HeadersExceedMaxTotalSize); } @@ -2746,10 +2746,10 @@ public Task HEADERS_Received_TooManyHeaders_ConnectionError() var headers = new List>(); headers.AddRange(new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }); + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }); for (var i = 0; i < 100; i++) { headers.Add(new KeyValuePair(i.ToString(CultureInfo.InvariantCulture), i.ToString(CultureInfo.InvariantCulture))); @@ -2763,11 +2763,11 @@ public Task HEADERS_Received_InvalidCharacters_ConnectionError() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Custom", "val\0ue"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Custom", "val\0ue"), + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, CoreStrings.BadRequest_MalformedRequestInvalidHeaders); } @@ -2777,11 +2777,11 @@ public Task HEADERS_Received_HeaderBlockContainsConnectionHeader_ConnectionError { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("connection", "keep-alive") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("connection", "keep-alive") + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, CoreStrings.HttpErrorConnectionSpecificHeaderField); } @@ -2791,11 +2791,11 @@ public Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsNotTrailers_Conn { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("te", "trailers, deflate") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("te", "trailers, deflate") + }; return HEADERS_Received_InvalidHeaderFields_ConnectionError(headers, CoreStrings.HttpErrorConnectionSpecificHeaderField); } @@ -2805,11 +2805,11 @@ public async Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsTrailers_N { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("te", "trailers") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("te", "trailers") + }; await InitializeConnectionAsync(_noopApplication); @@ -2828,10 +2828,10 @@ public async Task HEADERS_Received_RequestLineLength_StreamError() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, new string('A', 8192 / 2)), - new KeyValuePair(InternalHeaderNames.Path, "/" + new string('A', 8192 / 2)), - new KeyValuePair(InternalHeaderNames.Scheme, "http") - }; + new KeyValuePair(InternalHeaderNames.Method, new string('A', 8192 / 2)), + new KeyValuePair(InternalHeaderNames.Path, "/" + new string('A', 8192 / 2)), + new KeyValuePair(InternalHeaderNames.Scheme, "http") + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -2846,13 +2846,13 @@ public async Task HEADERS_CookiesMergedIntoOne() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.Cookie, "a=0"), - new KeyValuePair(HeaderNames.Cookie, "b=1"), - new KeyValuePair(HeaderNames.Cookie, "c=2"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Cookie, "a=0"), + new KeyValuePair(HeaderNames.Cookie, "b=1"), + new KeyValuePair(HeaderNames.Cookie, "c=2"), + }; await InitializeConnectionAsync(_readHeadersApplication); @@ -3263,10 +3263,10 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalDataFrames_ConnectionAb var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => tcs.Task); await StartStreamAsync(1, headers, endStream: false); @@ -3287,10 +3287,10 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalTrailerFrames_Connectio var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => tcs.Task); await StartStreamAsync(1, headers, endStream: false); @@ -3311,10 +3311,10 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditi var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => tcs.Task); await StartStreamAsync(1, headers, endStream: false); @@ -3333,10 +3333,10 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalWindowUpdateFrame_Conne var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => tcs.Task); await StartStreamAsync(1, headers, endStream: false); @@ -4926,10 +4926,10 @@ public async Task AppDoesNotReadRequestBody_ResetsAndDrainsRequest(int intFinalF var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: false); @@ -4977,10 +4977,10 @@ public async Task AbortedStream_ResetsAndDrainsRequest(int intFinalFrameType) var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_appAbort); await StartStreamAsync(1, headers, endStream: false); @@ -5021,10 +5021,10 @@ public async Task ResetStream_ResetsAndDrainsRequest(int intFinalFrameType) var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_appReset); await StartStreamAsync(1, headers, endStream: false); @@ -5091,10 +5091,10 @@ async Task CompletePipeOnTaskCompletion() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await StartStreamAsync(1, headers, endStream: false); @@ -5171,10 +5171,10 @@ async Task CompletePipeOnTaskCompletion() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; // This mimics gRPC, sending headers and data close together before receiving a reset. await StartStreamAsync(1, headers, endStream: false); @@ -5222,10 +5222,10 @@ public async Task FramesInBatchAreStillProcessedAfterStreamError_WithoutHeartbea var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { @@ -5262,10 +5262,10 @@ public async Task AbortedStream_ResetsAndDrainsRequest_RefusesFramesAfterEndOfSt var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_appAbort); await StartStreamAsync(1, headers, endStream: false); @@ -5336,10 +5336,10 @@ public async Task AbortedStream_ResetsAndDrainsRequest_RefusesFramesAfterClientR var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_appAbort); await StartStreamAsync(1, headers, endStream: false); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs index 27c28477389b..b5e37940abea 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs @@ -52,11 +52,11 @@ public async Task HEADERS_Received_EmptyMethod_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, ""), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, ""), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -71,11 +71,11 @@ public async Task HEADERS_Received_InvalidCustomMethod_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Hello,World"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Hello,World"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -96,11 +96,11 @@ public async Task HEADERS_Received_KnownOrCustomMethods_Accepted(string method) { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, method), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, method), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await InitializeConnectionAsync(_echoMethodNoBody); // First request @@ -147,11 +147,11 @@ public async Task HEADERS_Received_HEADMethod_Accepted() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "HEAD"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "HEAD"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -180,12 +180,12 @@ public async Task HEADERS_Received_MethodsWithContentLength_Accepted(string meth { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, method), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair(HeaderNames.ContentLength, "11"), - }; + new KeyValuePair(InternalHeaderNames.Method, method), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentLength, "11"), + }; await InitializeConnectionAsync(context => { Assert.True(HttpMethods.Equals(method, context.Request.Method)); @@ -232,11 +232,11 @@ public async Task HEADERS_Received_MethodsWithoutContentLength_Accepted(string m { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, method), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, method), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await InitializeConnectionAsync(context => { Assert.True(HttpMethods.Equals(method, context.Request.Method)); @@ -302,9 +302,12 @@ public async Task HEADERS_Received_OPTIONSStar_LeftOutOfPath() await InitializeConnectionAsync(_echoPath); // :path and :scheme are not allowed, :authority is optional - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "*")}; + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "*") + }; await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -330,9 +333,12 @@ public async Task HEADERS_Received_OPTIONSSlash_Accepted() await InitializeConnectionAsync(_echoPath); // :path and :scheme are not allowed, :authority is optional - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "/")}; + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "/") + }; await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -364,9 +370,12 @@ await InitializeConnectionAsync(context => }); // :path and :scheme are not allowed, :authority is optional - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "/a/path?a&que%35ry")}; + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "/a/path?a&que%35ry") + }; await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -406,9 +415,12 @@ await InitializeConnectionAsync(context => }); // :path and :scheme are not allowed, :authority is optional - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, input)}; + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, input) + }; await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -475,9 +487,12 @@ await InitializeConnectionAsync(context => return Task.CompletedTask; }); - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, scheme) + }; // Not the expected "http" await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, @@ -504,9 +519,12 @@ public async Task HEADERS_Received_SchemeMismatchAllowed_InvalidScheme_Reset(str await InitializeConnectionAsync(_noopApplication); - var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, scheme) + }; // Not the expected "http" await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, headers); await WaitForStreamErrorAsync(expectedStreamId: 1, Http2ErrorCode.PROTOCOL_ERROR, @@ -520,10 +538,10 @@ public async Task HEADERS_Received_MissingAuthority_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -548,11 +566,11 @@ public async Task HEADERS_Received_EmptyAuthority_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, ""), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, ""), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -577,11 +595,11 @@ public async Task HEADERS_Received_MissingAuthorityFallsBackToHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Host", "abc"), + }; await InitializeConnectionAsync(_echoHost); await StartStreamAsync(1, headers, endStream: true); @@ -607,12 +625,12 @@ public async Task HEADERS_Received_EmptyAuthorityIgnoredOverHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, ""), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, ""), + new KeyValuePair("Host", "abc"), + }; await InitializeConnectionAsync(_echoHost); await StartStreamAsync(1, headers, endStream: true); @@ -638,12 +656,12 @@ public async Task HEADERS_Received_AuthorityOverridesHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "def"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "def"), + new KeyValuePair("Host", "abc"), + }; await InitializeConnectionAsync(_echoHost); await StartStreamAsync(1, headers, endStream: true); @@ -669,12 +687,12 @@ public async Task HEADERS_Received_AuthorityOverridesInvalidHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "def"), - new KeyValuePair("Host", "a=bc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "def"), + new KeyValuePair("Host", "a=bc"), + }; await InitializeConnectionAsync(_echoHost); await StartStreamAsync(1, headers, endStream: true); @@ -700,11 +718,11 @@ public async Task HEADERS_Received_InvalidAuthority_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "local=host:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "local=host:80"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -720,12 +738,12 @@ public async Task HEADERS_Received_InvalidAuthorityWithValidHost_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "d=ef"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "d=ef"), + new KeyValuePair("Host", "abc"), + }; await InitializeConnectionAsync(_echoHost); await StartStreamAsync(1, headers, endStream: true); @@ -741,12 +759,12 @@ public async Task HEADERS_Received_TwoHosts_StreamReset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Host", "host1"), - new KeyValuePair("Host", "host2"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Host", "host1"), + new KeyValuePair("Host", "host2"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -765,11 +783,11 @@ public async Task HEADERS_Received_MaxRequestLineSize_Reset() // https://github.com/aspnet/KestrelHttpServer/issues/2872 var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET" + new string('a', 1024 * 3)), - new KeyValuePair(InternalHeaderNames.Path, "/Hello/How/Are/You/" + new string('a', 1024 * 3)), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost" + new string('a', 1024 * 3) + ":80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET" + new string('a', 1024 * 3)), + new KeyValuePair(InternalHeaderNames.Path, "/Hello/How/Are/You/" + new string('a', 1024 * 3)), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost" + new string('a', 1024 * 3) + ":80"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -784,11 +802,11 @@ public async Task ContentLength_Received_SingleDataFrame_Verified() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { var buffer = new byte[100]; @@ -830,15 +848,15 @@ await InitializeConnectionAsync(async context => var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await StartStreamAsync(1, headers, endStream: false); await SendDataAsync(1, new byte[12], endStream: true); @@ -862,11 +880,11 @@ public async Task ContentLength_Received_MultipleDataFrame_Verified() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { var buffer = new byte[100]; @@ -905,11 +923,11 @@ public async Task ContentLength_Received_MultipleDataFrame_ReadViaPipe_Verified( { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { var readResult = await context.Request.BodyReader.ReadAsync(); @@ -949,11 +967,11 @@ public async Task ContentLength_Received_MultipleDataFrame_ReadViaPipeAndStream_ var tcs = new TaskCompletionSource(); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { var readResult = await context.Request.BodyReader.ReadAsync(); @@ -1001,11 +1019,11 @@ public async Task ContentLength_Received_NoDataFrames_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestDelegateCalled = false; await InitializeConnectionAsync(c => @@ -1030,15 +1048,15 @@ public async Task ContentLength_ReceivedInContinuation_NoDataFrames_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(_noopApplication); await StartStreamAsync(1, headers, endStream: true); @@ -1055,11 +1073,11 @@ public async Task ContentLength_Received_SingleDataFrameOverSize_Reset() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { thrownEx = await Assert.ThrowsAsync(async () => @@ -1090,11 +1108,11 @@ public async Task ContentLength_Received_SingleDataFrameUnderSize_Reset() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { thrownEx = await Assert.ThrowsAsync(async () => @@ -1125,11 +1143,11 @@ public async Task ContentLength_Received_MultipleDataFramesOverSize_Reset() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { thrownEx = await Assert.ThrowsAsync(async () => @@ -1161,11 +1179,11 @@ public async Task ContentLength_Received_MultipleDataFramesUnderSize_Reset() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { thrownEx = await Assert.ThrowsAsync(async () => @@ -1211,15 +1229,15 @@ await InitializeConnectionAsync(async context => var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await StartStreamAsync(1, headers, endStream: false); await SendDataAsync(1, new byte[12], endStream: true); @@ -1243,10 +1261,10 @@ public async Task ContentLength_Response_FirstWriteMoreBytesWritten_Throws_Sends { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.ContentLength = 11; @@ -1281,10 +1299,10 @@ public async Task ContentLength_Response_MoreBytesWritten_ThrowsAndResetsStream( { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.ContentLength = 11; @@ -1320,10 +1338,10 @@ public async Task ContentLength_Response_NoBytesWritten_Sends500() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => { context.Response.ContentLength = 11; @@ -1354,10 +1372,10 @@ public async Task StartAsync_Response_NoBytesWritten_Sends200() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1388,10 +1406,10 @@ public async Task StartAsync_ContentLength_Response_NoBytesWritten_Sends200() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.ContentLength = 0; @@ -1426,10 +1444,10 @@ public async Task StartAsync_OnStartingThrowsAfterStartAsyncIsCalled() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1461,13 +1479,12 @@ await ExpectAsync(Http2FrameType.DATA, [Fact] public async Task StartAsync_StartsResponse() { - var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1501,10 +1518,10 @@ public async Task StartAsync_WithoutFinalFlushDoesNotFlushUntilResponseEnd() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1549,10 +1566,10 @@ public async Task StartAsync_FlushStillFlushesBody() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1585,13 +1602,12 @@ await ExpectAsync(Http2FrameType.DATA, [Fact] public async Task StartAsync_WithContentLengthAndEmptyWriteCallsFinalFlush() { - var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.ContentLength = 0; @@ -1625,10 +1641,10 @@ public async Task StartAsync_SingleWriteCallsFinalFlush() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1668,10 +1684,10 @@ public async Task StartAsync_ContentLength_ThrowsException_DataIsFlushed_Connect { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.ContentLength = 11; @@ -1703,10 +1719,10 @@ public async Task StartAsync_ThrowsException_DataIsFlushed() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -1736,10 +1752,10 @@ public async Task ContentLength_Response_TooFewBytesWritten_Resets() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => { context.Response.ContentLength = 11; @@ -1775,11 +1791,11 @@ public async Task MaxRequestBodySize_ContentLengthUnder_200() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { var buffer = new byte[100]; @@ -1816,11 +1832,11 @@ public async Task MaxRequestBodySize_ContentLengthOver_413() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; await InitializeConnectionAsync(async context => { #pragma warning disable CS0618 // Type or member is obsolete @@ -1862,10 +1878,10 @@ public async Task MaxRequestBodySize_NoContentLength_Under_200() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { var buffer = new byte[100]; @@ -1902,10 +1918,10 @@ public async Task MaxRequestBodySize_NoContentLength_Over_413() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { #pragma warning disable CS0618 // Type or member is obsolete @@ -1954,16 +1970,16 @@ public async Task MaxRequestBodySize_AppCanLowerLimit(bool includeContentLength) _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 20; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; if (includeContentLength) { headers.Concat(new[] { - new KeyValuePair(HeaderNames.ContentLength, "18"), - }); + new KeyValuePair(HeaderNames.ContentLength, "18"), + }); } await InitializeConnectionAsync(async context => { @@ -2014,16 +2030,16 @@ public async Task MaxRequestBodySize_AppCanRaiseLimit(bool includeContentLength) _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; if (includeContentLength) { headers.Concat(new[] { - new KeyValuePair(HeaderNames.ContentLength, "12"), - }); + new KeyValuePair(HeaderNames.ContentLength, "12"), + }); } await InitializeConnectionAsync(async context => { @@ -2547,10 +2563,10 @@ public async Task ResponseTrailers_WithLargeUnflushedData_DataExceedsFlowControl var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -2613,10 +2629,10 @@ public async Task ResponseTrailers_WithUnflushedData_DataSentWithTrailers() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.StartAsync(); @@ -2665,10 +2681,10 @@ public async Task ApplicationException_BeforeFirstWrite_Sends500() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(context => { throw new Exception("App Faulted"); @@ -2698,10 +2714,10 @@ public async Task ApplicationException_AfterFirstWrite_Resets() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.WriteAsync("hello,"); @@ -3124,10 +3140,10 @@ public async Task WriteAsync_PreCancelledCancellationToken_DoesNotAbort() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { // The cancellation is checked at the start of WriteAsync and no application state is changed. @@ -3159,10 +3175,10 @@ public async Task WriteAsync_CancellationTokenTriggeredDueToFlowControl_SendRST( var writeStarted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { await context.Response.Body.FlushAsync(); // https://github.com/aspnet/KestrelHttpServer/issues/3031 @@ -3204,11 +3220,11 @@ await ExpectAsync(Http2FrameType.SETTINGS, public async Task GetMemoryAdvance_Works() { var headers = new[] - { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(httpContext => { var response = httpContext.Response; @@ -3250,11 +3266,11 @@ await InitializeConnectionAsync(httpContext => public async Task GetMemoryAdvance_WithStartAsync_Works() { var headers = new[] - { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3296,11 +3312,11 @@ await InitializeConnectionAsync(async httpContext => public async Task WriteAsync_GetMemoryLargeWriteBeforeFirstFlush() { var headers = new[] - { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3349,10 +3365,10 @@ public async Task WriteAsync_WithGetMemoryWithInitialFlushWorks() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3402,10 +3418,10 @@ public async Task WriteAsync_GetMemoryMultipleAdvance() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3448,10 +3464,10 @@ public async Task WriteAsync_GetSpanMultipleAdvance() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3498,10 +3514,10 @@ public async Task WriteAsync_GetMemoryAndWrite() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3542,11 +3558,11 @@ await ExpectAsync(Http2FrameType.DATA, public async Task WriteAsync_GetMemoryWithSizeHintAlwaysReturnsSameSize() { var headers = new[] -{ - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3585,10 +3601,10 @@ public async Task WriteAsync_GetMemoryWithSizeHintAlwaysReturnsSameSizeStartAsyn { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3625,9 +3641,9 @@ public async Task BodyWriterWriteAsync_OnAbortedRequest_ReturnsResultWithIsCompl var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), }; await InitializeConnectionAsync(async httpContext => { @@ -3660,9 +3676,9 @@ public async Task BodyWriterWriteAsync_OnCanceledPendingFlush_ReturnsResultWithI { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), }; await InitializeConnectionAsync(async httpContext => { @@ -3702,9 +3718,9 @@ public async Task WriteAsync_BothPipeAndStreamWorks() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), }; await InitializeConnectionAsync(async httpContext => { @@ -3766,10 +3782,10 @@ public async Task ContentLengthWithGetSpanWorks() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3817,10 +3833,10 @@ public async Task ContentLengthWithGetMemoryWorks() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(httpContext => { var response = httpContext.Response; @@ -3863,10 +3879,10 @@ public async Task ResponseBodyCanWrite() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { httpContext.Response.ContentLength = 12; @@ -3903,10 +3919,10 @@ public async Task ResponseBodyAndResponsePipeWorks() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; @@ -3967,10 +3983,10 @@ public async Task ResponseBodyPipeCompleteWithoutExceptionDoesNotThrow() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.BodyWriter.Complete(); @@ -3999,10 +4015,10 @@ public async Task ResponseBodyPipeCompleteWithoutExceptionWritesDoesThrow() InvalidOperationException writeEx = null; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.BodyWriter.Complete(); @@ -4033,10 +4049,10 @@ public async Task ResponseBodyPipeCompleteWithExceptionThrows() var expectedException = new Exception(); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { context.Response.BodyWriter.Complete(expectedException); @@ -4070,10 +4086,10 @@ public async Task CompleteAsync_BeforeBodyStarted_SendsHeadersWithEndStream() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4123,10 +4139,10 @@ public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_SendsHeadersAndTr var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4189,10 +4205,10 @@ public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_TruncatedContentL var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4244,10 +4260,10 @@ public async Task CompleteAsync_AfterBodyStarted_SendsBodyWithEndStream() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4310,10 +4326,10 @@ public async Task CompleteAsync_WriteAfterComplete_Throws() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4366,10 +4382,10 @@ public async Task CompleteAsync_WriteAgainAfterComplete_Throws() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4432,10 +4448,10 @@ public async Task CompleteAsync_AdvanceAfterComplete_AdvanceThrows() var tcs = new TaskCompletionSource(); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { var memory = context.Response.BodyWriter.GetMemory(12); @@ -4480,10 +4496,10 @@ public async Task CompleteAsync_AfterPipeWrite_WithTrailers_SendsBodyAndTrailers var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4559,10 +4575,10 @@ public async Task CompleteAsync_AfterBodyStarted_WithTrailers_SendsBodyAndTraile var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4633,10 +4649,10 @@ public async Task CompleteAsync_AfterBodyStarted_WithTrailers_TruncatedContentLe var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4703,10 +4719,10 @@ public async Task PipeWriterComplete_AfterBodyStarted_WithTrailers_TruncatedCont var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { @@ -4854,10 +4870,10 @@ public async Task AbortAfterCompleteAsync_POSTWithResponseBodyAndTrailers_Reques var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -4938,10 +4954,10 @@ public async Task ResetAfterCompleteAsync_GETWithResponseBodyAndTrailers_ResetsA var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -5020,10 +5036,10 @@ public async Task ResetAfterCompleteAsync_POSTWithResponseBodyAndTrailers_Reques var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async context => { try @@ -5104,11 +5120,11 @@ await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, expectedErrorMessage: // :scheme = http // X-Test = £ private static readonly byte[] LatinHeaderData = new byte[] - { - 0, 7, 58, 109, 101, 116, 104, 111, 100, 3, 71, 69, 84, 0, 5, 58, 112, 97, 116, - 104, 1, 47, 0, 7, 58, 115, 99, 104, 101, 109, 101, 4, 104, 116, 116, 112, 0, - 6, 120, 45, 116, 101, 115, 116, 1, 163 - }; + { + 0, 7, 58, 109, 101, 116, 104, 111, 100, 3, 71, 69, 84, 0, 5, 58, 112, 97, 116, + 104, 1, 47, 0, 7, 58, 115, 99, 104, 101, 109, 101, 4, 104, 116, 116, 112, 0, + 6, 120, 45, 116, 101, 115, 116, 1, 163 + }; [Fact] public async Task HEADERS_Received_Latin1_AcceptedWhenLatin1OptionIsConfigured() @@ -5222,10 +5238,10 @@ public async Task GetMemory_AfterAbort_GetsFakeMemory(int sizeHint) { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; await InitializeConnectionAsync(async httpContext => { var response = httpContext.Response; diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs index 9f794bccac10..f37749a94653 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TestBase.cs @@ -36,74 +36,74 @@ public class Http2TestBase : TestApplicationErrorLoggerLoggedTest, IDisposable, protected static readonly IEnumerable> _browserRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair("user-agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"), - new KeyValuePair("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), - new KeyValuePair("accept-language", "en-US,en;q=0.5"), - new KeyValuePair("accept-encoding", "gzip, deflate, br"), - new KeyValuePair("upgrade-insecure-requests", "1"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair("user-agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"), + new KeyValuePair("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), + new KeyValuePair("accept-language", "en-US,en;q=0.5"), + new KeyValuePair("accept-encoding", "gzip, deflate, br"), + new KeyValuePair("upgrade-insecure-requests", "1"), + }; protected static readonly IEnumerable> _postRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; protected static readonly IEnumerable> _expectContinueRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.Expect, "100-continue"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Expect, "100-continue"), + }; protected static readonly IEnumerable> _requestTrailers = new[] { - new KeyValuePair("trailer-one", "1"), - new KeyValuePair("trailer-two", "2"), - }; + new KeyValuePair("trailer-one", "1"), + new KeyValuePair("trailer-two", "2"), + }; protected static readonly IEnumerable> _oneContinuationRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue) - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue) + }; protected static readonly IEnumerable> _twoContinuationsRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair("e", _4kHeaderValue), - new KeyValuePair("f", _4kHeaderValue), - new KeyValuePair("g", _4kHeaderValue), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair("e", _4kHeaderValue), + new KeyValuePair("f", _4kHeaderValue), + new KeyValuePair("g", _4kHeaderValue), + }; protected static IEnumerable> ReadRateRequestHeaders(int expectedBytes) => new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/" + expectedBytes), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/" + expectedBytes), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; protected static readonly byte[] _helloBytes = Encoding.ASCII.GetBytes("hello"); protected static readonly byte[] _worldBytes = Encoding.ASCII.GetBytes("world"); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs index 39f924cce4fd..5373cb08b982 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs @@ -28,11 +28,11 @@ public class Http3ConnectionTests : Http3TestBase { private static readonly KeyValuePair[] Headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; [Fact] public async Task CreateRequestStream_RequestCompleted_Disposed() @@ -128,13 +128,13 @@ public async Task HEADERS_CookiesMergedIntoOne() { var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.Cookie, "a=0"), - new KeyValuePair(HeaderNames.Cookie, "b=1"), - new KeyValuePair(HeaderNames.Cookie, "c=2"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Cookie, "a=0"), + new KeyValuePair(HeaderNames.Cookie, "b=1"), + new KeyValuePair(HeaderNames.Cookie, "c=2"), + }; var receivedHeaders = ""; @@ -354,11 +354,11 @@ public async Task StreamPool_MultipleStreamsInSequence_PooledStreamReused() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await Http3Api.InitializeConnectionAsync(_echoApplication); @@ -409,7 +409,7 @@ public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfN { const BindingFlags privateFlags = BindingFlags.NonPublic | BindingFlags.Instance; - KeyValuePair[] requestHeaders1 = new[] + var requestHeaders1 = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -419,7 +419,7 @@ public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfN }; // Note: No content-type - KeyValuePair[] requestHeaders2 = new[] + var requestHeaders2 = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -455,11 +455,11 @@ public async Task StreamPool_VariableMultipleStreamsInSequence_PooledStreamReuse { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await Http3Api.InitializeConnectionAsync(_echoApplication); @@ -489,11 +489,11 @@ public async Task VariableMultipleStreamsInSequence_Success(int count, bool send { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestDelegate = sendData ? _echoApplication : _noopApplication; @@ -512,12 +512,12 @@ public async Task ResponseTrailers_MultipleStreams_Reset() { var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/hello"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair(HeaderNames.ContentType, "application/json") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/hello"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentType, "application/json") + }; var requestCount = 0; IHeaderDictionary trailersFirst = null; diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs index fe3ee265fda0..da2092b13d6e 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs @@ -29,11 +29,11 @@ public async Task HelloWorldTest() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers); await requestStream.SendDataAsync(Encoding.ASCII.GetBytes("Hello world"), endStream: true); @@ -50,11 +50,11 @@ public async Task UnauthorizedHttpStatusResponse() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -73,11 +73,11 @@ public async Task EmptyMethod_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, ""), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, ""), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers); await requestStream.WaitForStreamErrorAsync( @@ -91,11 +91,11 @@ public async Task InvalidCustomMethod_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Hello,World"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Hello,World"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers); await requestStream.WaitForStreamErrorAsync( @@ -109,11 +109,11 @@ public async Task CustomMethod_Accepted() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoMethod, headers, endStream: true); @@ -131,12 +131,12 @@ public async Task RequestHeadersMaxRequestHeaderFieldSize_EndsStream() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair("test", new string('a', 20000)) - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair("test", new string('a', 20000)) + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers); @@ -166,8 +166,8 @@ public async Task ConnectMethod_Accepted() public async Task OptionsStar_LeftOutOfPath() { var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "*")}; + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "*")}; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoPath, headers, endStream: true); @@ -185,8 +185,8 @@ public async Task OptionsStar_LeftOutOfPath() public async Task OptionsSlash_Accepted() { var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "OPTIONS"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "/")}; + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "/")}; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoPath, headers, endStream: true); @@ -205,8 +205,8 @@ public async Task PathAndQuery_Separated() { // :path and :scheme are not allowed, :authority is optional var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, "/a/path?a&que%35ry")}; + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, "/a/path?a&que%35ry")}; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -240,8 +240,8 @@ public async Task Path_DecodedAndNormalized(string input, string expected) { // :path and :scheme are not allowed, :authority is optional var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Path, input)}; + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Path, input)}; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -265,7 +265,7 @@ public async Task ConnectMethod_WithSchemeOrPath_Reset(string headerName, string { // :path and :scheme are not allowed, :authority is optional var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "CONNECT"), - new KeyValuePair(headerName, value) }; + new KeyValuePair(headerName, value) }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -281,8 +281,8 @@ await requestStream.WaitForStreamErrorAsync( public async Task SchemeMismatch_Reset(string scheme) { var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -300,8 +300,8 @@ public async Task SchemeMismatchAllowed_Processed(string scheme) _serviceContext.ServerOptions.AllowAlternateSchemes = true; var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -325,8 +325,8 @@ public async Task SchemeMismatchAllowed_InvalidScheme_Reset(string scheme) _serviceContext.ServerOptions.AllowAlternateSchemes = true; var headers = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, scheme) }; // Not the expected "http" var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -341,10 +341,10 @@ public async Task MissingAuthority_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -361,11 +361,11 @@ public async Task EmptyAuthority_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, ""), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, ""), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); var responseHeaders = await requestStream.ExpectHeadersAsync(); @@ -381,11 +381,11 @@ public async Task MissingAuthorityFallsBackToHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Host", "abc"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoHost, headers, endStream: true); @@ -403,12 +403,12 @@ public async Task EmptyAuthorityIgnoredOverHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, ""), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, ""), + new KeyValuePair("Host", "abc"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoHost, headers, endStream: true); @@ -426,12 +426,12 @@ public async Task AuthorityOverridesHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "def"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "def"), + new KeyValuePair("Host", "abc"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoHost, headers, endStream: true); @@ -449,12 +449,12 @@ public async Task AuthorityOverridesInvalidHost_200Status() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "def"), - new KeyValuePair("Host", "a=bc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "def"), + new KeyValuePair("Host", "a=bc"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoHost, headers, endStream: true); @@ -472,11 +472,11 @@ public async Task InvalidAuthority_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "local=host:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "local=host:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -491,12 +491,12 @@ public async Task InvalidAuthorityWithValidHost_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "d=ef"), - new KeyValuePair("Host", "abc"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "d=ef"), + new KeyValuePair("Host", "abc"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -511,12 +511,12 @@ public async Task TwoHosts_StreamReset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Host", "host1"), - new KeyValuePair("Host", "host2"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Host", "host1"), + new KeyValuePair("Host", "host2"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -534,11 +534,11 @@ public async Task MaxRequestLineSize_Reset() // https://github.com/aspnet/KestrelHttpServer/issues/2872 var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET" + new string('a', 1024 * 3)), - new KeyValuePair(InternalHeaderNames.Path, "/Hello/How/Are/You/" + new string('a', 1024 * 3)), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost" + new string('a', 1024 * 3) + ":80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET" + new string('a', 1024 * 3)), + new KeyValuePair(InternalHeaderNames.Path, "/Hello/How/Are/You/" + new string('a', 1024 * 3)), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost" + new string('a', 1024 * 3) + ":80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); await requestStream.WaitForStreamErrorAsync( @@ -552,11 +552,11 @@ public async Task ContentLength_Received_SingleDataFrame_Verified() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -581,11 +581,11 @@ public async Task ContentLength_Received_MultipleDataFrame_Verified() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -617,11 +617,11 @@ public async Task ContentLength_Received_MultipleDataFrame_ReadViaPipe_Verified( { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { var readResult = await context.Request.BodyReader.ReadAsync(); @@ -652,11 +652,11 @@ public async Task RemoveConnectionSpecificHeaders() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -685,11 +685,11 @@ public async Task ContentLength_Received_NoDataFrames_Reset() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestDelegateCalled = false; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(c => @@ -715,10 +715,10 @@ public async Task EndRequestStream_ContinueReadingFromResponse() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var data = new byte[] { 1, 2, 3, 4, 5, 6 }; @@ -754,7 +754,7 @@ public async Task EndRequestStream_ContinueReadingFromResponse() public async Task FlushPipeAsync_OnStoppedHttp3Stream_ReturnsFlushResultWithIsCompletedTrue() { var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - KeyValuePair[] requestHeaders = new[] + var requestHeaders = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -788,7 +788,7 @@ public async Task FlushPipeAsync_OnStoppedHttp3Stream_ReturnsFlushResultWithIsCo [Fact] public async Task FlushPipeAsync_OnCanceledPendingFlush_ReturnsFlushResultWithIsCanceledTrue() { - KeyValuePair[] requestHeaders = new[] + var requestHeaders = new[] { new KeyValuePair(InternalHeaderNames.Method, "GET"), new KeyValuePair(InternalHeaderNames.Path, "/hello"), @@ -824,11 +824,11 @@ public async Task ResponseTrailers_WithoutData_Sent() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -854,11 +854,11 @@ public async Task ResponseHeaders_WithNonAscii_Throws() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -885,11 +885,11 @@ public async Task ResponseHeaders_WithNonAsciiAndCustomEncoder_Works() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; _serviceContext.ServerOptions.ResponseHeaderEncodingSelector = _ => Encoding.UTF8; _serviceContext.ServerOptions.RequestHeaderEncodingSelector = _ => Encoding.UTF8; // Used for decoding response. @@ -921,11 +921,11 @@ public async Task ResponseHeaders_WithInvalidValuesAndCustomEncoder_AbortsConnec { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var encoding = Encoding.GetEncoding(Encoding.Latin1.CodePage, EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback); @@ -948,11 +948,11 @@ public async Task ResponseTrailers_WithData_Sent() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -980,11 +980,11 @@ public async Task ResponseTrailers_WithExeption500_Cleared() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -1006,11 +1006,11 @@ public async Task ResponseTrailers_WithNonAscii_Throws() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -1034,11 +1034,11 @@ public async Task ResponseTrailers_WithNonAsciiAndCustomEncoder_Works() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; _serviceContext.ServerOptions.ResponseHeaderEncodingSelector = _ => Encoding.UTF8; _serviceContext.ServerOptions.RequestHeaderEncodingSelector = _ => Encoding.UTF8; // Used for decoding response. @@ -1072,11 +1072,11 @@ public async Task ResponseTrailers_WithInvalidValuesAndCustomEncoder_AbortsConne { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var encoding = Encoding.GetEncoding(Encoding.Latin1.CodePage, EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback); @@ -1103,11 +1103,11 @@ public async Task ResetStream_ReturnStreamError() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context => { @@ -1132,10 +1132,10 @@ public async Task CompleteAsync_BeforeBodyStarted_SendsHeadersWithEndStream() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -1179,10 +1179,10 @@ public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_SendsHeadersAndTr var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1231,10 +1231,10 @@ public async Task CompleteAsync_BeforeBodyStarted_WithTrailers_TruncatedContentL var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1279,10 +1279,10 @@ public async Task CompleteAsync_AfterBodyStarted_SendsBodyWithEndStream() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1332,10 +1332,10 @@ public async Task CompleteAsync_WriteAfterComplete_Throws() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1381,10 +1381,10 @@ public async Task CompleteAsync_WriteAgainAfterComplete_Throws() var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1431,12 +1431,12 @@ public async Task CompleteAsync_WriteAgainAfterComplete_Throws() public async Task CompleteAsync_AdvanceAfterComplete_AdvanceThrows() { var tcs = new TaskCompletionSource(); - var headers = new[] - { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + var headers = new[] + { + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { var memory = context.Response.BodyWriter.GetMemory(12); @@ -1474,10 +1474,10 @@ public async Task CompleteAsync_AfterPipeWrite_WithTrailers_SendsBodyAndTrailers var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1534,10 +1534,10 @@ public async Task CompleteAsync_AfterBodyStarted_WithTrailers_SendsBodyAndTraile var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1589,10 +1589,10 @@ public async Task CompleteAsync_AfterBodyStarted_WithTrailers_TruncatedContentLe var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1646,10 +1646,10 @@ public async Task PipeWriterComplete_AfterBodyStarted_WithTrailers_TruncatedCont var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -1704,10 +1704,10 @@ public async Task AbortAfterCompleteAsync_GETWithResponseBodyAndTrailers_ResetsA var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1763,10 +1763,10 @@ public async Task AbortAfterCompleteAsync_POSTWithResponseBodyAndTrailers_Reques var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1827,10 +1827,10 @@ public async Task ResetAfterCompleteAsync_GETWithResponseBodyAndTrailers_ResetsA var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1890,10 +1890,10 @@ public async Task ResetAfterCompleteAsync_POSTWithResponseBodyAndTrailers_Reques var clientTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { try @@ -1975,10 +1975,10 @@ public async Task RequestTrailers_CanReadTrailersFromRequest() var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var trailers = new[] { new KeyValuePair("TestName", "TestValue"), @@ -2004,10 +2004,10 @@ public async Task FrameAfterTrailers_UnexpectedFrameError() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var trailers = new[] { new KeyValuePair("TestName", "TestValue"), @@ -2041,10 +2041,10 @@ public async Task TrailersWithoutEndingStream_ErrorAccessingTrailers() var syncPoint = new SyncPoint(); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var trailers = new[] { new KeyValuePair("TestName", "TestValue"), @@ -2114,10 +2114,10 @@ public async Task UnexpectedServerFrame(string frameType) { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_echoApplication, headers); @@ -2148,11 +2148,11 @@ public Task HEADERS_Received_HeaderBlockContainsUnknownPseudoHeaderField_Connect { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(":unknown", "0"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(":unknown", "0"), + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, expectedErrorMessage: CoreStrings.HttpErrorUnknownPseudoHeaderField); } @@ -2162,11 +2162,11 @@ public Task HEADERS_Received_HeaderBlockContainsResponsePseudoHeaderField_Connec { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Status, "200"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Status, "200"), + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, expectedErrorMessage: CoreStrings.HttpErrorResponsePseudoHeaderField); } @@ -2178,11 +2178,11 @@ public static TheoryData>> DuplicatePse var data = new TheoryData>>(); var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; foreach (var headerField in requestHeaders) { @@ -2214,12 +2214,12 @@ public static TheoryData>> PseudoHeader var data = new TheoryData>>(); var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("content-length", "0") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Authority, "127.0.0.1"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("content-length", "0") + }; foreach (var headerField in requestHeaders.Where(h => h.Key.StartsWith(':'))) { @@ -2238,10 +2238,10 @@ public static TheoryData>> MissingPseud var data = new TheoryData>>(); var requestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; foreach (var headerField in requestHeaders) { @@ -2304,18 +2304,18 @@ public Task HEADERS_Received_HeaderBlockOverLimit_ConnectionError() // > 32kb var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("a", _4kHeaderValue), - new KeyValuePair("b", _4kHeaderValue), - new KeyValuePair("c", _4kHeaderValue), - new KeyValuePair("d", _4kHeaderValue), - new KeyValuePair("e", _4kHeaderValue), - new KeyValuePair("f", _4kHeaderValue), - new KeyValuePair("g", _4kHeaderValue), - new KeyValuePair("h", _4kHeaderValue), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("a", _4kHeaderValue), + new KeyValuePair("b", _4kHeaderValue), + new KeyValuePair("c", _4kHeaderValue), + new KeyValuePair("d", _4kHeaderValue), + new KeyValuePair("e", _4kHeaderValue), + new KeyValuePair("f", _4kHeaderValue), + new KeyValuePair("g", _4kHeaderValue), + new KeyValuePair("h", _4kHeaderValue), + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, CoreStrings.BadRequest_HeadersExceedMaxTotalSize, Http3ErrorCode.RequestRejected); } @@ -2327,10 +2327,10 @@ public Task HEADERS_Received_TooManyHeaders_ConnectionError() var headers = new List>(); headers.AddRange(new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }); + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }); for (var i = 0; i < 100; i++) { headers.Add(new KeyValuePair(i.ToString(CultureInfo.InvariantCulture), i.ToString(CultureInfo.InvariantCulture))); @@ -2344,11 +2344,11 @@ public Task HEADERS_Received_InvalidCharacters_ConnectionError() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("Custom", "val\0ue"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("Custom", "val\0ue"), + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, CoreStrings.BadRequest_MalformedRequestInvalidHeaders); } @@ -2358,11 +2358,11 @@ public Task HEADERS_Received_HeaderBlockContainsConnectionHeader_ConnectionError { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("connection", "keep-alive") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("connection", "keep-alive") + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, CoreStrings.HttpErrorConnectionSpecificHeaderField); } @@ -2372,11 +2372,11 @@ public Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsNotTrailers_Conn { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("te", "trailers, deflate") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("te", "trailers, deflate") + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, CoreStrings.HttpErrorConnectionSpecificHeaderField); } @@ -2386,11 +2386,11 @@ public async Task HEADERS_Received_HeaderBlockContainsTEHeader_ValueIsTrailers_N { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair("te", "trailers") - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair("te", "trailers") + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, headers, endStream: true); @@ -2405,11 +2405,11 @@ public async Task MaxRequestBodySize_ContentLengthUnder_200() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { var buffer = new byte[100]; @@ -2439,11 +2439,11 @@ public async Task MaxRequestBodySize_ContentLengthOver_413() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(HeaderNames.ContentLength, "12"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.ContentLength, "12"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { #pragma warning disable CS0618 // Type or member is obsolete @@ -2479,10 +2479,10 @@ public async Task MaxRequestBodySize_NoContentLength_Under_200() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { var buffer = new byte[100]; @@ -2512,10 +2512,10 @@ public async Task MaxRequestBodySize_NoContentLength_Over_413() _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { #pragma warning disable CS0618 // Type or member is obsolete @@ -2556,10 +2556,10 @@ public async Task MaxRequestBodySize_AppCanLowerLimit(bool includeContentLength) _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 20; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; if (includeContentLength) { headers.Concat(new[] @@ -2608,16 +2608,16 @@ public async Task MaxRequestBodySize_AppCanRaiseLimit(bool includeContentLength) _serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; if (includeContentLength) { headers.Concat(new[] { - new KeyValuePair(HeaderNames.ContentLength, "12"), - }); + new KeyValuePair(HeaderNames.ContentLength, "12"), + }); } var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { @@ -2647,10 +2647,10 @@ public Task HEADERS_Received_RequestLineLength_Error() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, new string('A', 8192 / 2)), - new KeyValuePair(InternalHeaderNames.Path, "/" + new string('A', 8192 / 2)), - new KeyValuePair(InternalHeaderNames.Scheme, "http") - }; + new KeyValuePair(InternalHeaderNames.Method, new string('A', 8192 / 2)), + new KeyValuePair(InternalHeaderNames.Path, "/" + new string('A', 8192 / 2)), + new KeyValuePair(InternalHeaderNames.Scheme, "http") + }; return HEADERS_Received_InvalidHeaderFields_StreamError(headers, CoreStrings.BadRequest_RequestLineTooLong, Http3ErrorCode.RequestRejected); } @@ -2788,11 +2788,11 @@ public async Task HEADERS_WriteLargeResponseHeaderSection_Success() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var headerText = string.Create(6 * 1024, new object(), (chars, state) => { @@ -2828,11 +2828,11 @@ public async Task HEADERS_WriteLargeResponseHeaderSectionTrailers_Success() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var headerText = string.Create(6 * 1024, new object(), (chars, state) => { @@ -2869,11 +2869,11 @@ public async Task HEADERS_NoResponseBody_RequestEndsOnHeaders() { var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(c => { @@ -2893,10 +2893,10 @@ public async Task GetMemory_AfterAbort_GetsFakeMemory(int sizeHint) var tcs = new TaskCompletionSource(); var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(async context => { context.Abort(); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TestBase.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TestBase.cs index 6d0bee2302ea..dc28eafb46d9 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TestBase.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TestBase.cs @@ -57,24 +57,24 @@ public abstract class Http3TestBase : TestApplicationErrorLoggerLoggedTest, IDis protected static readonly IEnumerable> _browserRequestHeaders = new[] { - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - new KeyValuePair("user-agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"), - new KeyValuePair("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), - new KeyValuePair("accept-language", "en-US,en;q=0.5"), - new KeyValuePair("accept-encoding", "gzip, deflate, br"), - new KeyValuePair("upgrade-insecure-requests", "1"), - }; + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + new KeyValuePair("user-agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"), + new KeyValuePair("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), + new KeyValuePair("accept-language", "en-US,en;q=0.5"), + new KeyValuePair("accept-encoding", "gzip, deflate, br"), + new KeyValuePair("upgrade-insecure-requests", "1"), + }; protected static IEnumerable> ReadRateRequestHeaders(int expectedBytes) => new[] { - new KeyValuePair(InternalHeaderNames.Method, "POST"), - new KeyValuePair(InternalHeaderNames.Path, "/" + expectedBytes), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "POST"), + new KeyValuePair(InternalHeaderNames.Path, "/" + expectedBytes), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; public Http3TestBase() { diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TimeoutTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TimeoutTests.cs index 68d6b38be4e9..88782e9e57c8 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TimeoutTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TimeoutTests.cs @@ -64,11 +64,11 @@ public async Task HEADERS_HeaderFrameReceivedWithinRequestHeadersTimeout_Success var limits = _serviceContext.ServerOptions.Limits; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, null).DefaultTimeout(); @@ -143,11 +143,11 @@ public async Task ControlStream_HeaderNotReceivedWithinRequestHeadersTimeout_Str var limits = _serviceContext.ServerOptions.Limits; var headers = new[] { - new KeyValuePair(InternalHeaderNames.Method, "Custom"), - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }; + new KeyValuePair(InternalHeaderNames.Method, "Custom"), + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }; await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout(); @@ -288,11 +288,11 @@ public async Task ResponseDrain_SlowerThanMinimumDataRate_AbortsConnection() var requestStream = await Http3Api.CreateRequestStream(new[] { - new KeyValuePair(InternalHeaderNames.Path, "/"), - new KeyValuePair(InternalHeaderNames.Scheme, "http"), - new KeyValuePair(InternalHeaderNames.Method, "GET"), - new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), - }, null, true, new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously)); + new KeyValuePair(InternalHeaderNames.Path, "/"), + new KeyValuePair(InternalHeaderNames.Scheme, "http"), + new KeyValuePair(InternalHeaderNames.Method, "GET"), + new KeyValuePair(InternalHeaderNames.Authority, "localhost:80"), + }, null, true, new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously)); await requestStream.OnDisposingTask.DefaultTimeout(); @@ -626,5 +626,4 @@ await Http3Api.InitializeConnectionAsync(context => _mockTimeoutHandler.VerifyNoOtherCalls(); } - }