From e11ecbb8f805d83b02e1fe7b85bddec805aa6f66 Mon Sep 17 00:00:00 2001 From: Kenneth Pouncey Date: Fri, 24 Jul 2020 11:33:47 +0200 Subject: [PATCH 1/3] [browser][http] Fix HttpClientHandler "Supports*" properties regressions --- .../Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs | 4 ++++ .../src/System/Net/Http/HttpClientHandler.cs | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs index eb577324faa16..4a6c5b26fbcad 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs @@ -120,6 +120,10 @@ public SslClientAuthenticationOptions SslOptions set => throw new PlatformNotSupportedException(); } + public bool SupportsAutomaticDecompression => false; + public bool SupportsProxy => false; + public bool SupportsRedirectConfiguration => false; + private Dictionary? _properties; public IDictionary Properties => _properties ??= new Dictionary(); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs index 996e42ca02c36..5540ba7f642cd 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs @@ -48,9 +48,9 @@ protected override void Dispose(bool disposing) 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 { From 1b1ad5e60df932523eb8cbbbc5cdea67cc09ac0d Mon Sep 17 00:00:00 2001 From: Kenneth Pouncey Date: Fri, 24 Jul 2020 13:52:35 +0200 Subject: [PATCH 2/3] 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; ``` --- .../System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) 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 294b0c1734b76..2df5509eeb4bd 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 @@ -273,6 +273,10 @@ public TimeSpan Expect100ContinueTimeout } } + public bool SupportsAutomaticDecompression => true; + public bool SupportsProxy => true; + public bool SupportsRedirectConfiguration => true; + public IDictionary Properties => _settings._properties ?? (_settings._properties = new Dictionary()); From 2fc96616cd11d67695207998e7ba051f6f9a6834 Mon Sep 17 00:00:00 2001 From: Kenneth Pouncey Date: Mon, 27 Jul 2020 06:49:17 +0200 Subject: [PATCH 3/3] Should be internal accessor --- .../Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 2df5509eeb4bd..9b122a615916c 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 @@ -273,9 +273,9 @@ public TimeSpan Expect100ContinueTimeout } } - public bool SupportsAutomaticDecompression => true; - public bool SupportsProxy => true; - public bool SupportsRedirectConfiguration => true; + internal bool SupportsAutomaticDecompression => true; + internal bool SupportsProxy => true; + internal bool SupportsRedirectConfiguration => true; public IDictionary Properties => _settings._properties ?? (_settings._properties = new Dictionary());