IsSupported reports SocketsHttpHandler availability on different platforms (#40271)
authorAlexander Nikolaev <55398552+alnikola@users.noreply.github.com>
Mon, 3 Aug 2020 16:28:48 +0000 (18:28 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Aug 2020 16:28:48 +0000 (18:28 +0200)
Fixes #39489

src/libraries/System.Net.Http/ref/System.Net.Http.cs
src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs

index 8f72cd9..f259892 100644 (file)
@@ -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 { } }
index 8c462ee..2a1d63d 100644 (file)
@@ -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();
index 8eb5a92..db2cfed 100644 (file)
@@ -35,6 +35,8 @@ namespace System.Net.Http
             }
         }
 
+        public static bool IsSupported => true;
+
         public bool UseCookies
         {
             get => _settings._useCookies;