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