-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[browser][http] Fix HttpClientHandler "Supports*" properties regressions #39889
[browser][http] Fix HttpClientHandler "Supports*" properties regressions #39889
Conversation
Tagging subscribers to this area: @dotnet/ncl |
On the SocketsHttpHandler we will default to `true` here. ``` internal bool SupportsAutomaticDecompression => true; internal bool SupportsProxy => true; internal bool SupportsRedirectConfiguration => true; ```
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
Outdated
Show resolved
Hide resolved
…issue-39760-properties-regression
@marek-safar | @lewing | @stephentoub could someone take a look |
Looks good to me, can anyone from @dotnet/ncl review the change ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks fine.
For the future, our code for automatic decompression and redirect handling is handler-agnostic and might easily be integrated into BrowserHttpHandler
. See how SocketsHttpHandler
sets them up here by layering handlers:
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
Lines 290 to 334 in 809a06f
private HttpMessageHandlerStage SetupHandlerChain() | |
{ | |
// Clone the settings to get a relatively consistent view that won't change after this point. | |
// (This isn't entirely complete, as some of the collections it contains aren't currently deeply cloned.) | |
HttpConnectionSettings settings = _settings.CloneAndNormalize(); | |
HttpConnectionPoolManager poolManager = new HttpConnectionPoolManager(settings); | |
HttpMessageHandlerStage handler; | |
if (settings._credentials == null) | |
{ | |
handler = new HttpConnectionHandler(poolManager); | |
} | |
else | |
{ | |
handler = new HttpAuthenticatedConnectionHandler(poolManager); | |
} | |
if (settings._allowAutoRedirect) | |
{ | |
// Just as with WinHttpHandler, for security reasons, we do not support authentication on redirects | |
// if the credential is anything other than a CredentialCache. | |
// We allow credentials in a CredentialCache since they are specifically tied to URIs. | |
HttpMessageHandlerStage redirectHandler = | |
(settings._credentials == null || settings._credentials is CredentialCache) ? | |
handler : | |
new HttpConnectionHandler(poolManager); // will not authenticate | |
handler = new RedirectHandler(settings._maxAutomaticRedirections, handler, redirectHandler); | |
} | |
if (settings._automaticDecompression != DecompressionMethods.None) | |
{ | |
handler = new DecompressionHandler(settings._automaticDecompression, handler); | |
} | |
// Ensure a single handler is used for all requests. | |
if (Interlocked.CompareExchange(ref _handler, handler, null) != null) | |
{ | |
handler.Dispose(); | |
} | |
return _handler; | |
} |
@scalablecory Those two things are taken care of via the browser's fetch implementation such that we do not have control of the functionality. Really outside of the domain we can touch or control. |
…ons (dotnet#39889) * [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
Also needs implementing on SocketsHttpHandler which will default to
true
.Fix #39760