Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Sep 4, 2024
1 parent a1ceaca commit db53310
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ public static IHttpClientBuilder ConfigureHttpMessageHandlerBuilder(this IHttpCl
/// </para>
/// </remarks>
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")] // We can support SocketsHttpHandler on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
public static IHttpClientBuilder UseSocketsHttpHandler(this IHttpClientBuilder builder, Action<SocketsHttpHandler, IServiceProvider>? configureHandler = null)
{
ThrowHelper.ThrowIfNull(builder);
Expand Down Expand Up @@ -320,6 +321,7 @@ public static IHttpClientBuilder UseSocketsHttpHandler(this IHttpClientBuilder b
/// </para>
/// </remarks>
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")]
public static IHttpClientBuilder UseSocketsHttpHandler(this IHttpClientBuilder builder, Action<ISocketsHttpHandlerBuilder> configureBuilder)
{
ThrowHelper.ThrowIfNull(builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class SocketsHttpHandlerBuilderExtensions
/// <param name="configure">A delegate that is used to modify a <see cref="SocketsHttpHandler"/>.</param>
/// <returns>An <see cref="ISocketsHttpHandlerBuilder"/> that can be used to configure the handler.</returns>
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")] // We can support SocketsHttpHandler on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
public static ISocketsHttpHandlerBuilder Configure(this ISocketsHttpHandlerBuilder builder, Action<SocketsHttpHandler, IServiceProvider> configure)
{
builder.Services.Configure<HttpClientFactoryOptions>(builder.Name, options =>
Expand Down Expand Up @@ -59,13 +60,15 @@ public static ISocketsHttpHandlerBuilder Configure(this ISocketsHttpHandlerBuild
/// </para>
/// </remarks>
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")]
public static ISocketsHttpHandlerBuilder Configure(this ISocketsHttpHandlerBuilder builder, IConfiguration configuration)
{
SocketsHttpHandlerConfiguration parsedConfig = ParseSocketsHttpHandlerConfiguration(configuration);
return Configure(builder, (handler, _) => FillFromConfig(handler, parsedConfig));
}

[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")]
private static void FillFromConfig(SocketsHttpHandler handler, in SocketsHttpHandlerConfiguration config)
{
if (config.PooledConnectionIdleTimeout is not null)
Expand Down Expand Up @@ -188,6 +191,7 @@ private readonly record struct SocketsHttpHandlerConfiguration
}

[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")]
private static SocketsHttpHandlerConfiguration ParseSocketsHttpHandlerConfiguration(IConfiguration config)
{
return new SocketsHttpHandlerConfiguration()
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Net.Http/ref/System.Net.Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ internal SocketsHttpConnectionContext() { }
public System.Net.Http.HttpRequestMessage InitialRequestMessage { get { throw null; } }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")]
public sealed partial class SocketsHttpHandler : System.Net.Http.HttpMessageHandler
{
public SocketsHttpHandler() { }
Expand All @@ -453,6 +454,7 @@ public SocketsHttpHandler() { }
public System.TimeSpan Expect100ContinueTimeout { get { throw null; } set { } }
public int InitialHttp2StreamWindowSize { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute("wasi")]
public static bool IsSupported { get { throw null; } }
public System.TimeSpan KeepAlivePingDelay { get { throw null; } set { } }
public System.Net.Http.HttpKeepAlivePingPolicy KeepAlivePingPolicy { get { throw null; } set { } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
namespace System.Net.Http
{
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")] // We can support SocketsHttpHandler on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
public sealed class SocketsHttpHandler : HttpMessageHandler
{
[UnsupportedOSPlatformGuard("browser")]
[UnsupportedOSPlatformGuard("wasi")] // We can support WebSocket on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
[UnsupportedOSPlatformGuard("wasi")] // We can support SocketsHttpHandler on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
public static bool IsSupported => false;

public bool UseCookies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace System.Net.Http
{
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("wasi")] // We can support WebSocket on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
[UnsupportedOSPlatform("wasi")] // We can support SocketsHttpHandler on top of wasi-socket, once we have it working https://github.com/dotnet/runtime/issues/98957
public sealed class SocketsHttpHandler : HttpMessageHandler
{
private readonly HttpConnectionSettings _settings = new HttpConnectionSettings();
Expand Down

0 comments on commit db53310

Please sign in to comment.