From 39dd32774d5986c8ef03ce28c0013b75535370e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 08:06:03 +0000 Subject: [PATCH] Sync shared code from runtime --- src/Shared/runtime/Http3/QPack/QPackEncoder.cs | 7 ++----- .../Quic/Implementations/MsQuic/Internal/MsQuicApi.cs | 8 +++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs index ecf0f1e183ab..348106aa15b2 100644 --- a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs +++ b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs @@ -340,6 +340,7 @@ private static bool EncodeHeaderBlockPrefix(Span destination, out int byte return true; } + // TODO these are fairly hard coded for the first two bytes to be zero. public bool BeginEncode(IEnumerable> headers, Span buffer, out int length) { _enumerator = headers.GetEnumerator(); @@ -350,11 +351,7 @@ public bool BeginEncode(IEnumerable> headers, Span< buffer[0] = 0; buffer[1] = 0; - bool doneEncode = Encode(buffer.Slice(2), out length); - - // Add two for the first two bytes. - length += 2; - return doneEncode; + return Encode(buffer.Slice(2), out length); } public bool BeginEncode(int statusCode, IEnumerable> headers, Span buffer, out int length) diff --git a/src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs b/src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs index fb6330c024b1..30e5cba6cbed 100644 --- a/src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs +++ b/src/Shared/runtime/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -143,6 +143,12 @@ static MsQuicApi() OperatingSystem ver = Environment.OSVersion; + if (ver.Platform == PlatformID.Win32NT && ver.Version < new Version(10, 0, 19041, 0)) + { + IsQuicSupported = false; + return; + } + // TODO: try to initialize TLS 1.3 in SslStream. try