From 7ed5a67c0bbb48bdce3cfd962e333c8f7db047a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marie=20P=C3=ADchov=C3=A1?= <11718369+ManickaP@users.noreply.github.com> Date: Fri, 25 Jun 2021 06:37:07 +0200 Subject: [PATCH] S.N.Quic made private (#54610) Note this will need reaction on ASP.NET side. --- src/libraries/System.Net.Http/ref/System.Net.Http.cs | 1 - src/libraries/System.Net.Http/src/System.Net.Http.csproj | 2 +- .../Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs | 6 ------ .../Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 15 --------------- .../HttpClientHandlerTestBase.SocketsHttpHandler.cs | 11 +++++++++-- .../System.Net.Http.Functional.Tests.csproj | 1 + src/libraries/System.Net.Quic/Directory.Build.props | 1 + src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj | 1 + .../System.Net.Quic.Functional.Tests.csproj | 1 + 9 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/libraries/System.Net.Http/ref/System.Net.Http.cs b/src/libraries/System.Net.Http/ref/System.Net.Http.cs index 02486ab..ea669da 100644 --- a/src/libraries/System.Net.Http/ref/System.Net.Http.cs +++ b/src/libraries/System.Net.Http/ref/System.Net.Http.cs @@ -388,7 +388,6 @@ namespace System.Net.Http public bool EnableMultipleHttp2Connections { get { throw null; } set { } } public Func>? ConnectCallback { get { throw null; } set { } } public Func>? PlaintextStreamFilter { get { throw null; } set { } } - public System.Net.Quic.Implementations.QuicImplementationProvider? QuicImplementationProvider { get { throw null; } set { } } } public sealed class SocketsHttpConnectionContext { diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index a6034a2..1423025 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -615,6 +615,7 @@ Link="Common\System\Net\Http\HttpHandlerDefaults.cs" /> + @@ -628,7 +629,6 @@ - diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index f85f0a3..4a29ff1 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -188,11 +188,5 @@ namespace System.Net.Http get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - - public QuicImplementationProvider? QuicImplementationProvider - { - get => throw new PlatformNotSupportedException(); - set => throw new PlatformNotSupportedException(); - } } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 6f392af..76080c6 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -394,21 +394,6 @@ namespace System.Net.Http } } - /// - /// Gets or sets the QUIC implementation to be used for HTTP3 requests. - /// - public QuicImplementationProvider? QuicImplementationProvider - { - // !!! NOTE !!! - // This is temporary and will not ship. - get => _settings._quicImplementationProvider; - set - { - CheckDisposedOrStarted(); - _settings._quicImplementationProvider = value; - } - } - public IDictionary Properties => _settings._properties ?? (_settings._properties = new Dictionary()); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index 81a4438..581a8bb 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -49,7 +49,7 @@ namespace System.Net.Http.Functional.Tests if (quicImplementationProvider != null) { SocketsHttpHandler socketsHttpHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); - socketsHttpHandler.QuicImplementationProvider = quicImplementationProvider; + SetQuicImplementationProvider(socketsHttpHandler, quicImplementationProvider); socketsHttpHandler.SslOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => true; } @@ -66,13 +66,20 @@ namespace System.Net.Http.Functional.Tests protected static HttpClientHandler CreateHttpClientHandler(string useVersionString) => CreateHttpClientHandler(Version.Parse(useVersionString)); - protected static SocketsHttpHandler GetUnderlyingSocketsHttpHandler(HttpClientHandler handler) { FieldInfo field = typeof(HttpClientHandler).GetField("_underlyingHandler", BindingFlags.Instance | BindingFlags.NonPublic); return (SocketsHttpHandler)field?.GetValue(handler); } + protected static void SetQuicImplementationProvider(SocketsHttpHandler handler, QuicImplementationProvider quicImplementationProvider) + { + FieldInfo settingsField = typeof(SocketsHttpHandler).GetField("_settings", BindingFlags.Instance | BindingFlags.NonPublic); + object settings = settingsField.GetValue(handler); + FieldInfo field = settings.GetType().GetField("_quicImplementationProvider", BindingFlags.Instance | BindingFlags.NonPublic); + field.SetValue(settings, quicImplementationProvider); + } + protected static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, Version version, bool exactVersion = false) => new HttpRequestMessage(method, uri) { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index 82246f6..7a33b8c 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -257,6 +257,7 @@ + diff --git a/src/libraries/System.Net.Quic/Directory.Build.props b/src/libraries/System.Net.Quic/Directory.Build.props index faeadef..94b050a 100644 --- a/src/libraries/System.Net.Quic/Directory.Build.props +++ b/src/libraries/System.Net.Quic/Directory.Build.props @@ -3,6 +3,7 @@ Microsoft true + true windows;linux;macos diff --git a/src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj b/src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj index d5dc6b1..507e003 100644 --- a/src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj +++ b/src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent) enable + false diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj index 4803a74..2a17894 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj @@ -29,5 +29,6 @@ + -- 2.7.4