Skip to content
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

IsSupported reports SocketsHttpHandler availability on different platforms #40271

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libraries/System.Net.Http/ref/System.Net.Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ protected override void Dispose(bool disposing) { }
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 { } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ private void CheckDisposedOrStarted()
}
}

public static bool IsSupported => true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needed xml doc comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add it, but could you please clarify what are the rules about them?
I see a lot of existing public properties without comments e.g. Expected100ContinueTimeout and AFAIK the xml doc content doesn't get automatically copied to dotnet/dotnet-api-docs repo. Previously, I had to manually create PR in the doc repo for new members (see HttpRequestException.StatusCode)

Copy link
Member

@stephentoub stephentoub Aug 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Note the comment the bot added to the PR: #40271 (comment). The XML comments on new APIs are then ported to the docs.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strange API. What value are we going to return for example on iOS where the API does not work fully and we'll discourage usage of it (probably using some analyzers) because it's inefficient?


public bool UseCookies
{
get => _settings._useCookies;
Expand Down