Skip to content

Commit 90b4e11

Browse files
committed
if-def less version
1 parent ba66ddb commit 90b4e11

8 files changed

Lines changed: 540 additions & 436 deletions

File tree

src/libraries/System.Net.Http/src/System.Net.Http.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<DefineConstants>$(DefineConstants);TARGET_BROWSER</DefineConstants>
1414
</PropertyGroup>
1515
<PropertyGroup Condition="'$(TargetsWindows)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsFreeBSD)' == 'true' or '$(TargetsOSX)' == 'true'">
16-
<DefineConstants>$(DefineConstants);HTTP3_SUPPORTED</DefineConstants>
1716
<SupportsQuic>true</SupportsQuic>
1817
</PropertyGroup>
1918
<!-- ILLinker settings -->
@@ -219,6 +218,12 @@
219218
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3ConnectionException.cs" />
220219
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3ProtocolException.cs" />
221220
<Compile Include="System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs" />
221+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPool.Quic.cs" />
222+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.Quic.cs" />
223+
</ItemGroup>
224+
<ItemGroup Condition="'$(SupportsQuic)' != 'true' and '$(TargetsBrowser)' != 'true'">
225+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPool.NoQuic.cs" />
226+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.NoQuic.cs" />
222227
</ItemGroup>
223228
<!-- Header support -->
224229
<ItemGroup>

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,6 @@ private static async ValueTask<SslStream> EstablishSslConnectionAsyncCore(bool a
100100
return sslStream;
101101
}
102102

103-
#if HTTP3_SUPPORTED
104-
public static async ValueTask<QuicConnection> ConnectQuicAsync(QuicImplementationProvider quicImplementationProvider, DnsEndPoint endPoint, SslClientAuthenticationOptions? clientAuthenticationOptions, CancellationToken cancellationToken)
105-
{
106-
QuicConnection con = new QuicConnection(quicImplementationProvider, endPoint, clientAuthenticationOptions);
107-
try
108-
{
109-
await con.ConnectAsync(cancellationToken).ConfigureAwait(false);
110-
return con;
111-
}
112-
catch (Exception ex)
113-
{
114-
con.Dispose();
115-
throw CreateWrappedException(ex, endPoint.Host, endPoint.Port, cancellationToken);
116-
}
117-
}
118-
#endif
119-
120103
internal static Exception CreateWrappedException(Exception error, string host, int port, CancellationToken cancellationToken)
121104
{
122105
return CancellationHelper.ShouldWrapInOperationCanceledException(error, cancellationToken) ?
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
7+
namespace System.Net.Http
8+
{
9+
internal sealed partial class HttpConnectionPool
10+
{
11+
private static bool IsHttp3Enabled => false;
12+
13+
private ValueTask<(HttpConnectionBase? connection, bool isNewConnection, HttpResponseMessage? failureResponse)>?
14+
GetHttp3ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) => null;
15+
16+
private bool IsAltSvcBlocked(HttpAuthority authority) => false;
17+
18+
private bool ProcessAltSvc(HttpResponseMessage response, HttpConnectionBase? connection) => false;
19+
20+
public void OnNetworkChanged()
21+
{
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)