From a1c19db3ff60d42b690db5b3d2ba866c99d41ffd Mon Sep 17 00:00:00 2001 From: Alexander Nikolaev <55398552+alnikola@users.noreply.github.com> Date: Mon, 3 Aug 2020 18:28:48 +0200 Subject: [PATCH] IsSupported reports SocketsHttpHandler availability on different platforms (#40271) Fixes #39489 --- src/libraries/System.Net.Http/ref/System.Net.Http.cs | 1 + .../src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs | 2 ++ .../src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 2 ++ 3 files changed, 5 insertions(+) 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 8f72cd9..f259892 100644 --- a/src/libraries/System.Net.Http/ref/System.Net.Http.cs +++ b/src/libraries/System.Net.Http/ref/System.Net.Http.cs @@ -328,6 +328,7 @@ namespace System.Net.Http public sealed partial class SocketsHttpHandler : System.Net.Http.HttpMessageHandler { public SocketsHttpHandler() { } + public static bool IsSupported { get { throw null; } } public bool AllowAutoRedirect { get { throw null; } set { } } public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } public System.Net.Connections.ConnectionFactory? ConnectionFactory { get { throw null; } set { } } 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 8c462ee..2a1d63d 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 @@ -12,6 +12,8 @@ namespace System.Net.Http { public sealed class SocketsHttpHandler : HttpMessageHandler { + public static bool IsSupported => false; + public bool UseCookies { get => 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 8eb5a92..db2cfed 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 @@ -35,6 +35,8 @@ namespace System.Net.Http } } + public static bool IsSupported => true; + public bool UseCookies { get => _settings._useCookies; -- 2.7.4