From 612db427725b3bdac3d6851288c93051bfe69621 Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Mon, 2 Apr 2018 10:40:12 -0700 Subject: [PATCH] Re-enable SSL tests cross plat Home/#2477 --- .../Autobahn/AutobahnTester.cs | 8 +------- .../AutobahnTests.cs | 5 ++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs index 4c08a43c32..770ad04659 100644 --- a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs +++ b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs @@ -165,13 +165,7 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn // Mac HttpClient on NetCoreApp2.0 doesn't alow you to set some combinations. // https://github.com/dotnet/corefx/blob/586cffcdfdf23ad6c193a4bf37fce88a1bf69508/src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.OSX.cs#L104-L106 handler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; - if (ssl) - { - // Don't take this out of the "if(ssl)". If we set it on some platforms, it crashes - // So we avoid running SSL tests on those platforms (for now). - // See https://github.com/dotnet/corefx/issues/9728 - handler.ServerCertificateCustomValidationCallback = (_, __, ___, ____) => true; - } + handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; var client = result.CreateHttpClient(handler); // Make sure the server works diff --git a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/AutobahnTests.cs b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/AutobahnTests.cs index 897bf3f1e6..08c798a52c 100644 --- a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/AutobahnTests.cs +++ b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/AutobahnTests.cs @@ -62,12 +62,11 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest using (var tester = new AutobahnTester(loggerFactory, spec)) { await tester.DeployTestAndAddToSpec(ServerType.Kestrel, ssl: false, environment: "ManagedSockets", cancellationToken: cts.Token); + await tester.DeployTestAndAddToSpec(ServerType.Kestrel, ssl: true, environment: "ManagedSockets", cancellationToken: cts.Token); - // Windows-only WebListener tests, and Kestrel SSL tests (due to: https://github.com/aspnet/WebSockets/issues/102) + // Windows-only WebListener tests if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - await tester.DeployTestAndAddToSpec(ServerType.Kestrel, ssl: true, environment: "ManagedSockets", cancellationToken: cts.Token); - if (IsWindows8OrHigher()) { // WebListener occasionally gives a non-strict response on 3.2. IIS Express seems to have the same behavior. Wonder if it's related to HttpSys?