158 references to HttpVersion
InMemory.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TestHttp1Connection.cs (1)
17public HttpVersion HttpVersionEnum
Microsoft.AspNetCore.Server.Kestrel.Core (53)
Internal\Http\Http1Connection.cs (3)
606if (_httpVersion == Http.HttpVersion.Http10) 867Log.PossibleInvalidHttpVersionDetected(ConnectionId, Http.HttpVersion.Http11, Http.HttpVersion.Http2);
Internal\Http\Http1MessageBody.cs (3)
125HttpVersion httpVersion, 130var keepAlive = httpVersion != HttpVersion.Http10; 208if (httpVersion == HttpVersion.Http10 && (context.Method == HttpMethod.Post || context.Method == HttpMethod.Put))
Internal\Http\HttpParser.cs (2)
176var httpVersion = remaining.GetKnownVersion(); 178if (httpVersion == HttpVersion.Unknown)
Internal\Http\HttpProtocol.cs (21)
66protected HttpVersion _httpVersion; 161if (_httpVersion == Http.HttpVersion.Http3) 165if (_httpVersion == Http.HttpVersion.Http2) 169if (_httpVersion == Http.HttpVersion.Http11) 173if (_httpVersion == Http.HttpVersion.Http10) 188_httpVersion = Http.HttpVersion.Http3; 192_httpVersion = Http.HttpVersion.Http2; 196_httpVersion = Http.HttpVersion.Http11; 200_httpVersion = Http.HttpVersion.Http10; 214_httpVersion = Http.HttpVersion.Http3; 218_httpVersion = Http.HttpVersion.Http2; 222_httpVersion = Http.HttpVersion.Http11; 226_httpVersion = Http.HttpVersion.Http10; 230_httpVersion = Http.HttpVersion.Unknown; 368_httpVersion = Http.HttpVersion.Unknown; 942if (_httpVersion != Http.HttpVersion.Http10 && 1070if (_autoChunk || _httpVersion >= Http.HttpVersion.Http2) 1136if (_httpVersion > Http.HttpVersion.Http11 && responseHeaders.HasInvalidH2H3Headers) 1219else if (_httpVersion == Http.HttpVersion.Http11) 1232if (!hasConnection && _httpVersion < Http.HttpVersion.Http2) 1238else if (_httpVersion == Http.HttpVersion.Http10)
Internal\Http\IHttpRequestLineHandler.cs (2)
45public HttpVersion Version 47get => (HttpVersion)(sbyte)(byte)_versionAndMethod;
Internal\Http2\Http2Connection.cs (6)
579if (ParseHttp1x(readableBuffer, out var detectedVersion)) 581if (detectedVersion == HttpVersion.Http10 || detectedVersion == HttpVersion.Http11) 583Log.PossibleInvalidHttpVersionDetected(ConnectionId, HttpVersion.Http2, detectedVersion); 633private bool ParseHttp1x(ReadOnlySequence<byte> buffer, out HttpVersion httpVersion) 635httpVersion = HttpVersion.Unknown;
Internal\Http2\Http2Stream.cs (1)
247_httpVersion = Http.HttpVersion.Http2;
Internal\Http3\Http3Stream.cs (1)
989_httpVersion = Http.HttpVersion.Http3;
Internal\Infrastructure\HttpUtilities.cs (12)
381public static bool GetKnownVersion(this ReadOnlySpan<byte> span, out HttpVersion knownVersion, out byte length) 386if (knownVersion != HttpVersion.Unknown) 393knownVersion = HttpVersion.Unknown; 409internal static HttpVersion GetKnownVersion(this ReadOnlySpan<byte> span) 415return HttpVersion.Http11; 419return HttpVersion.Http10; 422return HttpVersion.Unknown; 452public static string VersionToString(HttpVersion httpVersion) 456case HttpVersion.Http10: 458case HttpVersion.Http11: 460case HttpVersion.Http2: 462case HttpVersion.Http3:
Internal\Infrastructure\KestrelTrace.BadRequests.cs (2)
31public void PossibleInvalidHttpVersionDetected(string connectionId, HttpVersion expectedHttpVersion, HttpVersion detectedHttpVersion)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (100)
Http1\Http1ConnectionTests.cs (2)
378var messageBody = Http1MessageBody.For(Kestrel.Core.Internal.Http.HttpVersion.Http11, (HttpRequestHeaders)_http1Connection.RequestHeaders, _http1Connection); 1030Http1MessageBody.For(Kestrel.Core.Internal.Http.HttpVersion.Http11, (HttpRequestHeaders)_http1Connection.RequestHeaders, _http1Connection);
HttpParserTests.cs (2)
894public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded) 907var version = versionAndMethod.Version;
HttpUtilitiesTest.cs (12)
55[InlineData("HTTP/1.0\r", true, "HTTP/1.0", (int)HttpVersion.Http10)] 56[InlineData("HTTP/1.1\r", true, "HTTP/1.1", (int)HttpVersion.Http11)] 57[InlineData("HTTP/1.1\rmoretext", true, "HTTP/1.1", (int)HttpVersion.Http11)] 58[InlineData("HTTP/3.0\r", false, null, (int)HttpVersion.Unknown)] 59[InlineData("http/1.0\r", false, null, (int)HttpVersion.Unknown)] 60[InlineData("http/1.1\r", false, null, (int)HttpVersion.Unknown)] 61[InlineData("short ", false, null, (int)HttpVersion.Unknown)] 64var version = (HttpVersion)intVersion; 69var result = block.GetKnownVersion(out HttpVersion knownVersion, out var length); 71if (knownVersion != HttpVersion.Unknown) 90HttpUtilities.GetKnownVersion(span, out var version, out var _);
MessageBodyTests.cs (83)
26[InlineData((int)HttpVersion.Http10)] 27[InlineData((int)HttpVersion.Http11)] 30var httpVersion = (HttpVersion)intHttpVersion; 56[InlineData((int)HttpVersion.Http10)] 57[InlineData((int)HttpVersion.Http11)] 60var httpVersion = (HttpVersion)intHttpVersion; 84[InlineData((int)HttpVersion.Http10)] 85[InlineData((int)HttpVersion.Http11)] 88var httpVersion = (HttpVersion)intHttpVersion; 111[InlineData((int)HttpVersion.Http10)] 112[InlineData((int)HttpVersion.Http11)] 115var httpVersion = (HttpVersion)intHttpVersion; 132[InlineData((int)HttpVersion.Http10)] 133[InlineData((int)HttpVersion.Http11)] 136var httpVersion = (HttpVersion)intHttpVersion; 153[InlineData((int)HttpVersion.Http10)] 154[InlineData((int)HttpVersion.Http11)] 157var httpVersion = (HttpVersion)intHttpVersion; 186var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 215var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 240var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 268var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 309var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 336var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 370var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 392var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 412[InlineData((int)HttpVersion.Http10)] 413[InlineData((int)HttpVersion.Http11)] 416var httpVersion = (HttpVersion)intHttpVersion; 441[InlineData((int)HttpVersion.Http10)] 442[InlineData((int)HttpVersion.Http11)] 445var httpVersion = (HttpVersion)intHttpVersion; 468[InlineData((int)HttpVersion.Http10)] 469[InlineData((int)HttpVersion.Http11)] 472var httpVersion = (HttpVersion)intHttpVersion; 492[InlineData((int)HttpVersion.Http10)] 493[InlineData((int)HttpVersion.Http11)] 496var httpVersion = (HttpVersion)intHttpVersion; 518var body = Http1MessageBody.For(HttpVersion.Http10, new HttpRequestHeaders { HeaderContentLength = "8197" }, input.Http1Connection); 550Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked, not-chunked" }, input.Http1Connection)); 566var result = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders(), input.Http1Connection); 584Http1MessageBody.For(HttpVersion.Http10, new HttpRequestHeaders(), input.Http1Connection)); 596var body = Http1MessageBody.For(HttpVersion.Http10, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 619var body = Http1MessageBody.For(HttpVersion.Http10, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 636var body = Http1MessageBody.For(HttpVersion.Http10, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 658var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = headerConnection }, input.Http1Connection); 685var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = headerConnection, ContentLength = 0 }, input.Http1Connection); 707var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "2" }, input.Http1Connection); 735var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 762var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 797var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 828var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "2" }, input.Http1Connection); 865var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "2" }, input.Http1Connection); 890var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "12" }, input.Http1Connection); 926var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 951var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = "upgrade" }, input.Http1Connection); 983var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1004var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 1025var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = "upgrade" }, input.Http1Connection); 1046var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders(), input.Http1Connection); 1069var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1088var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 1115var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = "upgrade" }, input.Http1Connection); 1141var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders(), input.Http1Connection); 1164var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1188var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1214var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1241var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderContentLength = "5" }, input.Http1Connection); 1274var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 1301var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 1325var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderTransferEncoding = "chunked" }, input.Http1Connection); 1351var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = "upgrade" }, input.Http1Connection); 1377var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders(), input.Http1Connection);
src\Servers\Kestrel\shared\test\TestHttp1Connection.cs (1)
17public HttpVersion HttpVersionEnum
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (3)
KnownStringsBenchmark.cs (1)
131HttpVersion version;
Mocks\NullParser.cs (1)
39new HttpVersionAndMethod(HttpMethod.Get, 3) { Version = HttpVersion.Http11 },
src\Servers\Kestrel\shared\test\TestHttp1Connection.cs (1)
17public HttpVersion HttpVersionEnum
Sockets.FunctionalTests (1)
SocketTransportTests.cs (1)
18using KestrelHttpVersion = Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion;