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

[QUIC] Remove AppContext switch from S.N.Quic #56027

Merged
merged 1 commit into from
Jul 21, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,6 @@ private MsQuicApi(NativeApi* vtable)

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

return;
}

if (OperatingSystem.IsWindows() && !IsWindowsVersionSupported())
{
if (NetEventSource.Log.IsEnabled())
Expand Down Expand Up @@ -171,34 +161,6 @@ 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 IsHttp3Enabled()
{
bool value;

// First check for the AppContext switch, giving it priority over the environment variable.
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_HTTP3SUPPORT");

if (bool.TryParse(envVar, out value))
{
return value;
}
else if (uint.TryParse(envVar, out uint intVal))
{
return intVal != 0;
}

return false;
}

private static bool IsWindowsVersionSupported() => OperatingSystem.IsWindowsVersionAtLeast(MinWindowsVersion.Major,
MinWindowsVersion.Minor, MinWindowsVersion.Build, MinWindowsVersion.Revision);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />
</ItemGroup>
<ItemGroup>
<Compile Include="*.cs" />
</ItemGroup>
Expand Down