@@ -25,11 +25,6 @@ internal sealed partial class HttpConnectionPool
2525 /// <summary>The time, in milliseconds, that an authority should remain in <see cref="_altSvcBlocklist"/>.</summary>
2626 private const int AltSvcBlocklistTimeoutInMilliseconds = 10 * 60 * 1000 ;
2727
28- [ SupportedOSPlatformGuard ( "linux" ) ]
29- [ SupportedOSPlatformGuard ( "macOS" ) ]
30- [ SupportedOSPlatformGuard ( "windows" ) ]
31- internal static bool IsHttp3Supported ( ) => ( OperatingSystem . IsLinux ( ) && ! OperatingSystem . IsAndroid ( ) ) || OperatingSystem . IsWindows ( ) || OperatingSystem . IsMacOS ( ) ;
32-
3328 /// <summary>List of available HTTP/3 connections stored in the pool.</summary>
3429 private List < Http3Connection > ? _availableHttp3Connections ;
3530 /// <summary>The number of HTTP/3 connections associated with the pool, including in use, available, and pending.</summary>
@@ -67,7 +62,7 @@ internal sealed partial class HttpConnectionPool
6762 [ SupportedOSPlatform ( "macos" ) ]
6863 private async ValueTask < HttpResponseMessage ? > TrySendUsingHttp3Async ( HttpRequestMessage request , CancellationToken cancellationToken )
6964 {
70- Debug . Assert ( IsHttp3Supported ( ) ) ;
65+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
7166
7267 Debug . Assert ( _kind == HttpConnectionKind . Https ) ;
7368 Debug . Assert ( _http3Enabled ) ;
@@ -135,7 +130,7 @@ internal sealed partial class HttpConnectionPool
135130 [ SupportedOSPlatform ( "macos" ) ]
136131 private bool TryGetPooledHttp3Connection ( HttpRequestMessage request , [ NotNullWhen ( true ) ] out Http3Connection ? connection , [ NotNullWhen ( false ) ] out HttpConnectionWaiter < Http3Connection ? > ? waiter , out bool streamAvailable )
137132 {
138- Debug . Assert ( IsHttp3Supported ( ) ) ;
133+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
139134
140135 // Look for a usable connection.
141136 while ( true )
@@ -210,7 +205,7 @@ private bool TryGetPooledHttp3Connection(HttpRequestMessage request, [NotNullWhe
210205 [ SupportedOSPlatform ( "macos" ) ]
211206 private void CheckForHttp3ConnectionInjection ( )
212207 {
213- Debug . Assert ( IsHttp3Supported ( ) ) ;
208+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
214209
215210 Debug . Assert ( HasSyncObjLock ) ;
216211
@@ -249,7 +244,7 @@ private void CheckForHttp3ConnectionInjection()
249244 [ SupportedOSPlatform ( "macos" ) ]
250245 private async Task InjectNewHttp3ConnectionAsync ( RequestQueue < Http3Connection ? > . QueueItem queueItem )
251246 {
252- Debug . Assert ( IsHttp3Supported ( ) ) ;
247+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
253248
254249 if ( NetEventSource . Log . IsEnabled ( ) ) Trace ( "Creating new HTTP/3 connection for pool." ) ;
255250
@@ -332,7 +327,7 @@ private async Task InjectNewHttp3ConnectionAsync(RequestQueue<Http3Connection?>.
332327 [ SupportedOSPlatform ( "macos" ) ]
333328 private void HandleHttp3ConnectionFailure ( HttpConnectionWaiter < Http3Connection ? > requestWaiter , Exception ? e )
334329 {
335- Debug . Assert ( IsHttp3Supported ( ) ) ;
330+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
336331
337332 if ( NetEventSource . Log . IsEnabled ( ) ) Trace ( $ "HTTP3 connection failed: { e } ") ;
338333
@@ -363,7 +358,7 @@ private void HandleHttp3ConnectionFailure(HttpConnectionWaiter<Http3Connection?>
363358 [ SupportedOSPlatform ( "macos" ) ]
364359 private void ReturnHttp3Connection ( Http3Connection connection , bool isNewConnection , HttpConnectionWaiter < Http3Connection ? > ? initialRequestWaiter = null )
365360 {
366- Debug . Assert ( IsHttp3Supported ( ) ) ;
361+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
367362
368363 if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( $ "{ nameof ( isNewConnection ) } ={ isNewConnection } ") ;
369364
@@ -485,7 +480,7 @@ private void ReturnHttp3Connection(Http3Connection connection, bool isNewConnect
485480 [ SupportedOSPlatform ( "macos" ) ]
486481 private void DisableHttp3Connection ( Http3Connection connection )
487482 {
488- Debug . Assert ( IsHttp3Supported ( ) ) ;
483+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
489484
490485 if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( "" ) ;
491486
@@ -528,7 +523,7 @@ async Task DisableHttp3ConnectionAsync(Http3Connection connection)
528523 [ SupportedOSPlatform ( "macos" ) ]
529524 public void InvalidateHttp3Connection ( Http3Connection connection , bool dispose = true )
530525 {
531- Debug . Assert ( IsHttp3Supported ( ) ) ;
526+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
532527
533528 if ( NetEventSource . Log . IsEnabled ( ) ) connection . Trace ( "" ) ;
534529
@@ -564,7 +559,7 @@ public void InvalidateHttp3Connection(Http3Connection connection, bool dispose =
564559 [ SupportedOSPlatform ( "macos" ) ]
565560 private static int ScavengeHttp3ConnectionList ( List < Http3Connection > list , ref List < HttpConnectionBase > ? toDispose , long nowTicks , TimeSpan pooledConnectionLifetime , TimeSpan pooledConnectionIdleTimeout )
566561 {
567- Debug . Assert ( IsHttp3Supported ( ) ) ;
562+ Debug . Assert ( GlobalHttpSettings . SocketsHttpHandler . AllowHttp3 ) ;
568563
569564 int freeIndex = 0 ;
570565 while ( freeIndex < list . Count && list [ freeIndex ] . IsUsable ( nowTicks , pooledConnectionLifetime , pooledConnectionIdleTimeout ) )
0 commit comments