Skip to content

Commit

Permalink
if-def less version
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Mar 9, 2021
1 parent ba66ddb commit 90b4e11
Show file tree
Hide file tree
Showing 8 changed files with 540 additions and 436 deletions.
7 changes: 6 additions & 1 deletion src/libraries/System.Net.Http/src/System.Net.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<DefineConstants>$(DefineConstants);TARGET_BROWSER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsWindows)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsFreeBSD)' == 'true' or '$(TargetsOSX)' == 'true'">
<DefineConstants>$(DefineConstants);HTTP3_SUPPORTED</DefineConstants>
<SupportsQuic>true</SupportsQuic>
</PropertyGroup>
<!-- ILLinker settings -->
Expand Down Expand Up @@ -219,6 +218,12 @@
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3ConnectionException.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3ProtocolException.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPool.Quic.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.Quic.cs" />
</ItemGroup>
<ItemGroup Condition="'$(SupportsQuic)' != 'true' and '$(TargetsBrowser)' != 'true'">
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPool.NoQuic.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.NoQuic.cs" />
</ItemGroup>
<!-- Header support -->
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,6 @@ private static async ValueTask<SslStream> EstablishSslConnectionAsyncCore(bool a
return sslStream;
}

#if HTTP3_SUPPORTED
public static async ValueTask<QuicConnection> ConnectQuicAsync(QuicImplementationProvider quicImplementationProvider, DnsEndPoint endPoint, SslClientAuthenticationOptions? clientAuthenticationOptions, CancellationToken cancellationToken)
{
QuicConnection con = new QuicConnection(quicImplementationProvider, endPoint, clientAuthenticationOptions);
try
{
await con.ConnectAsync(cancellationToken).ConfigureAwait(false);
return con;
}
catch (Exception ex)
{
con.Dispose();
throw CreateWrappedException(ex, endPoint.Host, endPoint.Port, cancellationToken);
}
}
#endif

internal static Exception CreateWrappedException(Exception error, string host, int port, CancellationToken cancellationToken)
{
return CancellationHelper.ShouldWrapInOperationCanceledException(error, cancellationToken) ?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Threading;
using System.Threading.Tasks;

namespace System.Net.Http
{
internal sealed partial class HttpConnectionPool
{
private static bool IsHttp3Enabled => false;

private ValueTask<(HttpConnectionBase? connection, bool isNewConnection, HttpResponseMessage? failureResponse)>?
GetHttp3ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) => null;

private bool IsAltSvcBlocked(HttpAuthority authority) => false;

private bool ProcessAltSvc(HttpResponseMessage response, HttpConnectionBase? connection) => false;

public void OnNetworkChanged()
{
}
}
}
Loading

0 comments on commit 90b4e11

Please sign in to comment.