Fix Windows 7/8 Kestrel tests (#23069)
This commit is contained in:
parent
6fe00bfe6f
commit
bb92c602d8
|
|
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStream(connection.Stream);
|
var stream = OpenSslStream(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStream(connection.Stream);
|
var stream = OpenSslStream(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
||||||
Assert.Equal(1, selectorCalled);
|
Assert.Equal(1, selectorCalled);
|
||||||
}
|
}
|
||||||
|
|
@ -207,14 +207,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStream(connection.Stream);
|
var stream = OpenSslStream(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
||||||
Assert.Equal(1, selectorCalled);
|
Assert.Equal(1, selectorCalled);
|
||||||
}
|
}
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStream(connection.Stream);
|
var stream = OpenSslStream(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2NoExt));
|
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2NoExt));
|
||||||
Assert.Equal(2, selectorCalled);
|
Assert.Equal(2, selectorCalled);
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +274,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStream(connection.Stream);
|
var stream = OpenSslStream(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
Assert.True(stream.RemoteCertificate.Equals(_x509Certificate2));
|
||||||
Assert.Equal(1, selectorCalled);
|
Assert.Equal(1, selectorCalled);
|
||||||
}
|
}
|
||||||
|
|
@ -340,7 +340,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
// HttpClient might not send the certificate because it is invalid or it doesn't match any
|
// HttpClient might not send the certificate because it is invalid or it doesn't match any
|
||||||
// of the certificate authorities sent by the server in the SSL handshake.
|
// of the certificate authorities sent by the server in the SSL handshake.
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, true);
|
await AssertConnectionResult(stream, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -417,7 +417,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, true);
|
await AssertConnectionResult(stream, true);
|
||||||
Assert.True(clientCertificateValidationCalled);
|
Assert.True(clientCertificateValidationCalled);
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +444,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, false);
|
await AssertConnectionResult(stream, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -469,7 +469,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, false);
|
await AssertConnectionResult(stream, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +494,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, true);
|
await AssertConnectionResult(stream, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -528,7 +528,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var connection = server.CreateConnection())
|
using (var connection = server.CreateConnection())
|
||||||
{
|
{
|
||||||
var stream = OpenSslStreamWithCert(connection.Stream);
|
var stream = OpenSslStreamWithCert(connection.Stream);
|
||||||
await stream.AuthenticateAsClientAsync("localhost", new X509CertificateCollection(), SslProtocols.Tls12 | SslProtocols.Tls11, false);
|
await stream.AuthenticateAsClientAsync("localhost");
|
||||||
await AssertConnectionResult(stream, true);
|
await AssertConnectionResult(stream, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -609,7 +609,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
var sslOptions = new SslClientAuthenticationOptions
|
var sslOptions = new SslClientAuthenticationOptions
|
||||||
{
|
{
|
||||||
TargetHost = "localhost",
|
TargetHost = "localhost",
|
||||||
EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11,
|
EnabledSslProtocols = SslProtocols.None,
|
||||||
ApplicationProtocols = new List<SslApplicationProtocol> { SslApplicationProtocol.Http11, SslApplicationProtocol.Http2 },
|
ApplicationProtocols = new List<SslApplicationProtocol> { SslApplicationProtocol.Http11, SslApplicationProtocol.Http2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
Assert.Null(serverOptions.DefaultCertificate);
|
Assert.Null(serverOptions.DefaultCertificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[ConditionalFact]
|
||||||
|
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] // Investigation: https://github.com/dotnet/aspnetcore/issues/22917
|
||||||
public async Task EmptyRequestLoggedAsDebug()
|
public async Task EmptyRequestLoggedAsDebug()
|
||||||
{
|
{
|
||||||
var loggerProvider = new HandshakeErrorLoggerProvider();
|
var loggerProvider = new HandshakeErrorLoggerProvider();
|
||||||
|
|
@ -142,7 +143,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
userMessage: string.Join(Environment.NewLine, loggerProvider.ErrorLogger.ErrorMessages));
|
userMessage: string.Join(Environment.NewLine, loggerProvider.ErrorLogger.ErrorMessages));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[ConditionalFact]
|
||||||
|
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] // Investigation: https://github.com/dotnet/aspnetcore/issues/22917
|
||||||
public async Task ClientHandshakeFailureLoggedAsDebug()
|
public async Task ClientHandshakeFailureLoggedAsDebug()
|
||||||
{
|
{
|
||||||
var loggerProvider = new HandshakeErrorLoggerProvider();
|
var loggerProvider = new HandshakeErrorLoggerProvider();
|
||||||
|
|
@ -415,7 +417,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var sslStream = new SslStream(connection.Stream, true, (sender, certificate, chain, errors) => true))
|
using (var sslStream = new SslStream(connection.Stream, true, (sender, certificate, chain, errors) => true))
|
||||||
{
|
{
|
||||||
await sslStream.AuthenticateAsClientAsync("127.0.0.1", clientCertificates: null,
|
await sslStream.AuthenticateAsClientAsync("127.0.0.1", clientCertificates: null,
|
||||||
enabledSslProtocols: SslProtocols.Tls11 | SslProtocols.Tls12,
|
enabledSslProtocols: SslProtocols.None,
|
||||||
checkCertificateRevocation: false);
|
checkCertificateRevocation: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +456,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
||||||
using (var sslStream = new SslStream(connection.Stream, true, (sender, certificate, chain, errors) => true))
|
using (var sslStream = new SslStream(connection.Stream, true, (sender, certificate, chain, errors) => true))
|
||||||
{
|
{
|
||||||
await sslStream.AuthenticateAsClientAsync("127.0.0.1", clientCertificates: null,
|
await sslStream.AuthenticateAsClientAsync("127.0.0.1", clientCertificates: null,
|
||||||
enabledSslProtocols: SslProtocols.Tls11 | SslProtocols.Tls12,
|
enabledSslProtocols: SslProtocols.None,
|
||||||
checkCertificateRevocation: false);
|
checkCertificateRevocation: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace Interop.FunctionalTests
|
||||||
var dataset = new TheoryData<H2SpecTestCase>();
|
var dataset = new TheoryData<H2SpecTestCase>();
|
||||||
var toSkip = new string[] { /*"http2/5.1/8"*/ };
|
var toSkip = new string[] { /*"http2/5.1/8"*/ };
|
||||||
|
|
||||||
var supportsAlpn = Utilities.CurrentPlatformSupportsAlpn();
|
var supportsAlpn = Utilities.CurrentPlatformSupportsHTTP2OverTls();
|
||||||
|
|
||||||
foreach (var testcase in H2SpecCommands.EnumerateTestCases())
|
foreach (var testcase in H2SpecCommands.EnumerateTestCases())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Interop.FunctionalTests
|
||||||
new[] { "http" }
|
new[] { "http" }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Utilities.CurrentPlatformSupportsAlpn())
|
if (Utilities.CurrentPlatformSupportsHTTP2OverTls())
|
||||||
{
|
{
|
||||||
list.Add(new[] { "https" });
|
list.Add(new[] { "https" });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ namespace Interop.FunctionalTests
|
||||||
{
|
{
|
||||||
internal static class Utilities
|
internal static class Utilities
|
||||||
{
|
{
|
||||||
internal static bool CurrentPlatformSupportsAlpn()
|
internal static bool CurrentPlatformSupportsHTTP2OverTls()
|
||||||
{
|
{
|
||||||
return // "Missing Windows ALPN support: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation#Support"
|
return // "Missing Windows ALPN support: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation#Support" or missing compatible ciphers (Win8.1)
|
||||||
new MinimumOSVersionAttribute(OperatingSystems.Windows, WindowsVersions.Win81).IsMet
|
new MinimumOSVersionAttribute(OperatingSystems.Windows, WindowsVersions.Win10).IsMet
|
||||||
// "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492"
|
// "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492"
|
||||||
&& new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet
|
&& new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet
|
||||||
// Debian 8 uses OpenSSL 1.0.1 which does not support ALPN
|
// Debian 8 uses OpenSSL 1.0.1 which does not support ALPN
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue