disable version check on platforms that don't support ALPN
authorGeoff Kizer <geoffrek>
Wed, 10 Jul 2019 00:17:58 +0000 (17:17 -0700)
committerGeoff Kizer <geoffrek>
Sun, 14 Jul 2019 00:17:32 +0000 (17:17 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/c11af5504d806fd02874457d80db2e92b072385e

src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.cs

index 1ccef58..d1c5b2a 100644 (file)
@@ -127,10 +127,14 @@ namespace System.Net.Http.Functional.Tests
 
         protected HttpClient CreateHttpClientForRemoteServer(Configuration.Http.RemoteServer remoteServer, HttpClientHandler httpClientHandler)
         {
+            HttpMessageHandler wrappedHandler = httpClientHandler;
+
             // ActiveIssue #39293: WinHttpHandler will downgrade to 1.1 if you set Transfer-Encoding: chunked.
             // So, skip this verification if we're not using SocketsHttpHandler.
-            HttpMessageHandler wrappedHandler =
-                IsSocketsHttpHandler(httpClientHandler) ? new VersionCheckerHttpHandler(httpClientHandler, remoteServer.HttpVersion) : (HttpMessageHandler)httpClientHandler;
+            if (PlatformDetection.SupportsAlpn && IsSocketsHttpHandler(httpClientHandler))
+            {
+                wrappedHandler = new VersionCheckerHttpHandler(httpClientHandler, remoteServer.HttpVersion);
+            }
 
             var client = new HttpClient(wrappedHandler);
             SetDefaultRequestVersion(client, remoteServer.HttpVersion);