Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Renamed AppContext switch to Http3Support
  • Loading branch information
ManickaP committed Jul 13, 2021
commit c9f0a8c26560ad397068884478a956547b913198
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ internal static class SocketsHttpHandler
"DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP2SUPPORT",
true);

// Default to disable HTTP/3 and QUIC, but enable that to be overridden
// Default to disable HTTP/3 (and by an extent QUIC), but enable that to be overridden
// by an AppContext switch, or by an environment variable being set to true/1.
public static bool AllowHttp3AndQuic { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch(
"System.Net.SocketsHttpHandler.Http3AndQuicSupport",
"DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3ANDQUICSUPPORT",
public static bool AllowHttp3 { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch(
"System.Net.SocketsHttpHandler.Http3Support",
"DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3SUPPORT",
false);

// Switch to disable the HTTP/2 dynamic window scaling algorithm. Enabled by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal sealed class HttpConnectionSettings
public HttpConnectionSettings()
{
bool allowHttp2 = GlobalHttpSettings.SocketsHttpHandler.AllowHttp2;
bool allowHttp3 = GlobalHttpSettings.SocketsHttpHandler.AllowHttp3AndQuic;
bool allowHttp3 = GlobalHttpSettings.SocketsHttpHandler.AllowHttp3;
_maxHttpVersion =
allowHttp3 && allowHttp2 ? HttpVersion.Version30 :
allowHttp2 ? HttpVersion.Version20 :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3AndQuicSupport" Value="true" />
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3AndQuicSupport" Value="true" />
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ private MsQuicApi(NativeApi* vtable)

static MsQuicApi()
{
if (!IsHttp3AndQuicEnabled())
if (!IsHttp3Enabled())
{
if (NetEventSource.Log.IsEnabled())
{
NetEventSource.Info(null, $"HTTP/3 and QUIC is not enabled, see 'System.Net.SocketsHttpHandler.Http3AndQuicSupport' AppContext switch.");
NetEventSource.Info(null, $"HTTP/3 and QUIC is not enabled, see 'System.Net.SocketsHttpHandler.Http3Support' AppContext switch.");
}

return;
Expand Down Expand Up @@ -174,18 +174,18 @@ static MsQuicApi()
// Note that this is copy-pasted from S.N.Http just to hide S.N.Quic behind the same AppContext switch
// since this library is considered "private" for 6.0.
// We should get rid of this once S.N.Quic API surface is officially exposed.
private static bool IsHttp3AndQuicEnabled()
private static bool IsHttp3Enabled()
{
bool value;

// First check for the AppContext switch, giving it priority over the environment variable.
if (AppContext.TryGetSwitch("System.Net.SocketsHttpHandler.Http3AndQuicSupport", out value))
if (AppContext.TryGetSwitch("System.Net.SocketsHttpHandler.Http3Support", out value))
{
return value;
}

// AppContext switch wasn't used. Check the environment variable.
string? envVar = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3ANDQUICSUPPORT");
string? envVar = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3SUPPORT");

if (bool.TryParse(envVar, out value))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3AndQuicSupport" Value="true" />
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>
<ItemGroup>
<Compile Include="*.cs" />
Expand Down