disable cert validation for HTTP2 endpoint on Linux
authorGeoff Kizer <geoffrek>
Thu, 11 Jul 2019 00:37:00 +0000 (17:37 -0700)
committerGeoff Kizer <geoffrek>
Sun, 14 Jul 2019 00:17:33 +0000 (17:17 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/d34a2579ad53d72fd2482b4faada174416497041

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

index cc1b33b..4caf5b1 100644 (file)
@@ -223,6 +223,12 @@ namespace System.Net.Http.Functional.Tests
                 return;
             }
 
+            if (!PlatformDetection.IsWindows && remoteServer.HttpVersion == new Version(2, 0))
+            {
+                // ActiveIssue #39372: Certificate validation is asserting against the remote HTTP2 server on Linux
+                return;
+            }
+
             HttpClientHandler handler = CreateHttpClientHandler();
             using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler))
             {
index df2cfcd..75bb5fd 100644 (file)
@@ -9,6 +9,7 @@ using System.Net.Test.Common;
 using System.Reflection;
 using System.Threading;
 using System.Threading.Tasks;
+using Microsoft.DotNet.PlatformAbstractions;
 using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
@@ -121,6 +122,12 @@ namespace System.Net.Http.Functional.Tests
 
         protected HttpClient CreateHttpClientForRemoteServer(Configuration.Http.RemoteServer remoteServer, HttpClientHandler httpClientHandler)
         {
+            if (!PlatformDetection.IsWindows && remoteServer.HttpVersion == new Version(2, 0))
+            {
+                // ActiveIssue #39372: Certificate validation is asserting against the remote HTTP2 server on Linux
+                httpClientHandler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
+            }
+
             HttpMessageHandler wrappedHandler = httpClientHandler;
 
             // ActiveIssue #39293: WinHttpHandler will downgrade to 1.1 if you set Transfer-Encoding: chunked.