HTTP/3 test fixes (#52326)
authorMarie Píchová <11718369+ManickaP@users.noreply.github.com>
Thu, 6 May 2021 08:08:22 +0000 (10:08 +0200)
committerGitHub <noreply@github.com>
Thu, 6 May 2021 08:08:22 +0000 (10:08 +0200)
* Fixed H/3 tests failing with cert validation.

* Fixed never-ending loop for version upgrade.

When QUIC is supported but H/3 authority hasn't been advertised via Alt-Svc yet, TrySendUsingHttp3Async would never end the while-loop.

* Updated readme, Quic works with the newest msquic version.

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs
src/libraries/System.Net.Quic/readme.md

index ba3c8ed..16272cb 100644 (file)
@@ -781,28 +781,30 @@ namespace System.Net.Http
                         authority = authority ?? _originAuthority;
                     }
 
-                    if (authority != null)
+                    if (authority == null)
                     {
-                        if (IsAltSvcBlocked(authority))
-                        {
-                            throw GetVersionException(request, 3);
-                        }
+                        break;
+                    }
 
-                        Http3Connection connection = await GetHttp3ConnectionAsync(request, authority, cancellationToken).ConfigureAwait(false);
-                        HttpResponseMessage response = await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false);
+                    if (IsAltSvcBlocked(authority))
+                    {
+                        throw GetVersionException(request, 3);
+                    }
 
-                        // If an Alt-Svc authority returns 421, it means it can't actually handle the request.
-                        // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug.
-                        // In this case, we blocklist the authority and retry the request at the origin.
-                        if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority)
-                        {
-                            response.Dispose();
-                            BlocklistAuthority(connection.Authority);
-                            continue;
-                        }
+                    Http3Connection connection = await GetHttp3ConnectionAsync(request, authority, cancellationToken).ConfigureAwait(false);
+                    HttpResponseMessage response = await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false);
 
-                        return response;
+                    // If an Alt-Svc authority returns 421, it means it can't actually handle the request.
+                    // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug.
+                    // In this case, we blocklist the authority and retry the request at the origin.
+                    if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority)
+                    {
+                        response.Dispose();
+                        BlocklistAuthority(connection.Authority);
+                        continue;
                     }
+
+                    return response;
                 }
             }
 
index 3ea69bb..dc9d2b5 100644 (file)
@@ -33,6 +33,7 @@ namespace System.Net.Http.Functional.Tests
             {
                 SocketsHttpHandler socketsHttpHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler);
                 socketsHttpHandler.QuicImplementationProvider = quicImplementationProvider;
+                socketsHttpHandler.SslOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => true;
             }
 
             return handler;
index 146609f..050bdb8 100644 (file)
@@ -1,7 +1,7 @@
 # MsQuic
 
 `System.Net.Quic` depends on [MsQuic](https://github.com/microsoft/msquic), Microsoft, cross-platform, native implementation of the [QUIC](https://datatracker.ietf.org/wg/quic/about/) protocol.
-Currently, `System.Net.Quic` depends on [**msquic@7b31e149a9d1ed7a6850e8253ba3d0af707150e5**](https://github.com/microsoft/msquic/commit/7b31e149a9d1ed7a6850e8253ba3d0af707150e5) revision.
+Currently, `System.Net.Quic` depends on [**msquic@2084736032ec917f1819802caa515e61a6d3dd9a**](https://github.com/microsoft/msquic/commit/2084736032ec917f1819802caa515e61a6d3dd9a) revision.
 
 ## Usage
 
@@ -23,10 +23,10 @@ Prerequisites:
 
 Run inside the msquic directory (for **Debug** build with logging on):
 ```bash
-# build msquic in debug with logging and stub tls
+# build msquic in debug with logging
 rm -rf build
 mkdir build
-cmake -B build -DCMAKE_BUILD_TYPE=Debug -DQUIC_ENABLE_LOGGING=on -DQUIC_TLS=stub
+cmake -B build -DCMAKE_BUILD_TYPE=Debug -DQUIC_ENABLE_LOGGING=on
 cd build
 cmake --build . --config Debug