[browser][http] Fix HttpClientHandler "Supports*" properties regressions (#39889)
authorKenneth Pouncey <kjpou@pt.lu>
Tue, 28 Jul 2020 09:21:41 +0000 (11:21 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2020 09:21:41 +0000 (11:21 +0200)
* [browser][http] Fix HttpClientHandler "Supports*" properties regressions

* Also needs implementing on SocketsHttpHandler.

On the SocketsHttpHandler we will default to `true` here.

```
        internal bool SupportsAutomaticDecompression => true;
        internal bool SupportsProxy => true;
        internal bool SupportsRedirectConfiguration => true;
```

* Should be internal accessor

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

index eb57732..4a6c5b2 100644 (file)
@@ -120,6 +120,10 @@ namespace System.Net.Http
             set => throw new PlatformNotSupportedException();
         }
 
+        public bool SupportsAutomaticDecompression => false;
+        public bool SupportsProxy => false;
+        public bool SupportsRedirectConfiguration => false;
+
         private Dictionary<string, object?>? _properties;
         public IDictionary<string, object?> Properties => _properties ??= new Dictionary<string, object?>();
 
index 996e42c..5540ba7 100644 (file)
@@ -48,9 +48,9 @@ namespace System.Net.Http
             base.Dispose(disposing);
         }
 
-        public virtual bool SupportsAutomaticDecompression => true;
-        public virtual bool SupportsProxy => true;
-        public virtual bool SupportsRedirectConfiguration => true;
+        public virtual bool SupportsAutomaticDecompression => _underlyingHandler.SupportsAutomaticDecompression;
+        public virtual bool SupportsProxy => _underlyingHandler.SupportsProxy;
+        public virtual bool SupportsRedirectConfiguration => _underlyingHandler.SupportsRedirectConfiguration;
 
         public bool UseCookies
         {
index 294b0c1..9b122a6 100644 (file)
@@ -273,6 +273,10 @@ namespace System.Net.Http
             }
         }
 
+        internal bool SupportsAutomaticDecompression => true;
+        internal bool SupportsProxy => true;
+        internal bool SupportsRedirectConfiguration => true;
+
         public IDictionary<string, object?> Properties =>
             _settings._properties ?? (_settings._properties = new Dictionary<string, object?>());