From 45bedb16f622f511a4c81632394d63f8e77243d4 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 27 Jun 2022 11:51:11 +0200 Subject: [PATCH 01/39] Implement IncludeNetworkSecurityConfig --- .../AndroidAppBuilder/AndroidAppBuilder.cs | 3 ++ src/tasks/AndroidAppBuilder/ApkBuilder.cs | 29 ++++++++++++++++++- .../Templates/AndroidManifest.xml | 3 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs b/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs index b2ae7276fe90b9..66eef2cd542c82 100644 --- a/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs +++ b/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs @@ -80,6 +80,8 @@ public class AndroidAppBuilderTask : Task /// public string? NativeMainSource { get; set; } + public bool IncludeNetworkSecurityConfig { get; set; } + public string? KeyStorePath { get; set; } public bool ForceInterpreter { get; set; } @@ -105,6 +107,7 @@ public override bool Execute() apkBuilder.BuildToolsVersion = BuildToolsVersion; apkBuilder.StripDebugSymbols = StripDebugSymbols; apkBuilder.NativeMainSource = NativeMainSource; + apkBuilder.IncludeNetworkSecurityConfig = IncludeNetworkSecurityConfig; apkBuilder.KeyStorePath = KeyStorePath; apkBuilder.ForceInterpreter = ForceInterpreter; apkBuilder.ForceAOT = ForceAOT; diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index 8ebff5d2683d7b..8d0a028e92b108 100644 --- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs @@ -24,6 +24,7 @@ public class ApkBuilder public string OutputDir { get; set; } = ""!; public bool StripDebugSymbols { get; set; } public string? NativeMainSource { get; set; } + public bool IncludeNetworkSecurityConfig { get; set; } public string? KeyStorePath { get; set; } public bool ForceInterpreter { get; set; } public bool ForceAOT { get; set; } @@ -57,6 +58,12 @@ public ApkBuilder(TaskLoggingHelper logger) throw new ArgumentException($"MainLibraryFileName='{mainLibraryFileName}' was not found in AppDir='{AppDir}'"); } + var networkSecurityConfigFilePath = Path.Combine(AppDir, "res", "xml", "network_security_config.xml"); + if (IncludeNetworkSecurityConfig && !File.Exists(networkSecurityConfigFilePath)) + { + throw new ArgumentException($"IncludeNetworkSecurityConfig is set but the file '{networkSecurityConfigFilePath}' was not found"); + } + if (string.IsNullOrEmpty(abi)) { throw new ArgumentException("abi should not be empty (e.g. x86, x86_64, armeabi-v7a or arm64-v8a"); @@ -172,6 +179,7 @@ public ApkBuilder(TaskLoggingHelper logger) Directory.CreateDirectory(Path.Combine(OutputDir, "obj")); Directory.CreateDirectory(Path.Combine(OutputDir, "assets-tozip")); Directory.CreateDirectory(Path.Combine(OutputDir, "assets")); + Directory.CreateDirectory(Path.Combine(OutputDir, "res")); var extensionsToIgnore = new List { ".so", ".a", ".gz" }; if (StripDebugSymbols) @@ -183,6 +191,7 @@ public ApkBuilder(TaskLoggingHelper logger) // Copy sourceDir to OutputDir/assets-tozip (ignore native files) // these files then will be zipped and copied to apk/assets/assets.zip var assetsToZipDirectory = Path.Combine(OutputDir, "assets-tozip"); + Utils.DirectoryCopy(AppDir, assetsToZipDirectory, file => { string fileName = Path.GetFileName(file); @@ -199,9 +208,20 @@ public ApkBuilder(TaskLoggingHelper logger) // aapt complains on such files return false; } + if (file.Contains("/res/")) + { + // exclude everything in the `res` folder + return false; + } return true; }); + // copy the res directory as is + if (Directory.Exists(Path.Combine(AppDir, "res"))) + { + Utils.DirectoryCopy(Path.Combine(AppDir, "res"), Path.Combine(OutputDir, "res")); + } + // add AOT .so libraries foreach (var aotlib in aotLibraryFiles) { @@ -373,6 +393,11 @@ public ApkBuilder(TaskLoggingHelper logger) if (!string.IsNullOrEmpty(NativeMainSource)) File.Copy(NativeMainSource, javaActivityPath, true); + string networkSecurityConfigAttribute = + IncludeNetworkSecurityConfig + ? "a:networkSecurityConfig=\"@xml/network_security_config\"" + : string.Empty; + string envVariables = ""; foreach (ITaskItem item in EnvironmentVariables) { @@ -390,6 +415,7 @@ public ApkBuilder(TaskLoggingHelper logger) File.WriteAllText(Path.Combine(OutputDir, "AndroidManifest.xml"), Utils.GetEmbeddedResource("AndroidManifest.xml") .Replace("%PackageName%", packageId) + .Replace("%NetworkSecurityConfig%", networkSecurityConfigAttribute) .Replace("%MinSdkLevel%", MinApiLevel)); string javaCompilerArgs = $"-d obj -classpath src -bootclasspath {androidJar} -source 1.8 -target 1.8 "; @@ -414,7 +440,8 @@ public ApkBuilder(TaskLoggingHelper logger) string debugModeArg = StripDebugSymbols ? string.Empty : "--debug-mode"; string apkFile = Path.Combine(OutputDir, "bin", $"{ProjectName}.unaligned.apk"); - Utils.RunProcess(logger, aapt, $"package -f -m -F {apkFile} -A assets -M AndroidManifest.xml -I {androidJar} {debugModeArg}", workingDir: OutputDir); + string resources = IncludeNetworkSecurityConfig ? "-S res" : string.Empty; + Utils.RunProcess(logger, aapt, $"package -f -m -F {apkFile} -A assets {resources} -M AndroidManifest.xml -I {androidJar} {debugModeArg}", workingDir: OutputDir); var dynamicLibs = new List(); dynamicLibs.Add(Path.Combine(OutputDir, "monodroid", "libmonodroid.so")); diff --git a/src/tasks/AndroidAppBuilder/Templates/AndroidManifest.xml b/src/tasks/AndroidAppBuilder/Templates/AndroidManifest.xml index 9d28b5efbdf3c8..befd2e446a650e 100644 --- a/src/tasks/AndroidAppBuilder/Templates/AndroidManifest.xml +++ b/src/tasks/AndroidAppBuilder/Templates/AndroidManifest.xml @@ -7,7 +7,8 @@ - From 575bed7a966e6675126b234d1fdcb0f5db0a4420 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 27 Jun 2022 11:52:39 +0200 Subject: [PATCH 02/39] Use IncludeNetworkSecurityConfig --- eng/testing/tests.mobile.targets | 1 + src/tests/build.proj | 1 + 2 files changed, 2 insertions(+) diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index edeed52b946f1d..78e421042fd7be 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -153,6 +153,7 @@ MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0" Assemblies="@(BundleAssemblies)" MainLibraryFileName="$(MainLibraryFileName)" + IncludeNetworkSecurityConfig="$(IncludeNetworkSecurityConfig)" EnvironmentVariables="@(_AndroidEnv)" ForceAOT="$(RunAOTCompilation)" ForceInterpreter="$(MonoForceInterpreter)" diff --git a/src/tests/build.proj b/src/tests/build.proj index 063e3059c4385e..e83ee2129ed1ac 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -247,6 +247,7 @@ RuntimeIdentifier="$(RuntimeIdentifier)" ProjectName="$(Category)" MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)/native/include/mono-2.0" + IncludeNetworkSecurityConfig="$(IncludeNetworkSecurityConfig)" RuntimeComponents="$(RuntimeComponents)" DiagnosticPorts="$(DiagnosticPorts)" StripDebugSymbols="$(StripDebugSymbols)" From 5e6b3faf6fbe96c649d84a1dc36711f4a4a2289d Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 28 Jun 2022 09:48:37 +0200 Subject: [PATCH 03/39] Fix tests --- eng/testing/AndroidRunnerTemplate.sh | 2 +- .../System/Net/Configuration.Certificates.cs | 2 ++ .../CertificateValidationClientServer.cs | 2 +- .../ClientAsyncAuthenticateTest.cs | 17 ++++++----- .../ClientDefaultEncryptionTest.cs | 4 +-- .../ServerAllowNoEncryptionTest.cs | 4 +-- .../ServerAsyncAuthenticateTest.cs | 16 +++++----- .../ServerRequireEncryptionTest.cs | 4 +-- .../SslAuthenticationOptionsTest.cs | 2 +- .../FunctionalTests/SslStreamAlpnTests.cs | 6 ++-- .../SslStreamConformanceTests.cs | 8 ++--- .../SslStreamMutualAuthenticationTest.cs | 2 +- .../SslStreamNegotiatedCipherSuiteTest.cs | 6 ++-- .../SslStreamNetworkStreamTest.cs | 25 ++++++++++++---- .../tests/FunctionalTests/SslStreamSniTest.cs | 12 ++++++-- .../SslStreamStreamToStreamTest.cs | 16 +++++----- .../SslStreamSystemDefaultsTest.cs | 2 +- .../System.Net.Security.Tests.csproj | 10 +++++++ .../tests/FunctionalTests/res/raw/ndx_ca.pem | 19 ++++++++++++ .../testselfsignedservereku_contoso_com.pem | 30 +++++++++++++++++++ .../res/xml/network_security_config.xml | 9 ++++++ 21 files changed, 145 insertions(+), 53 deletions(-) create mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem create mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem create mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml diff --git a/eng/testing/AndroidRunnerTemplate.sh b/eng/testing/AndroidRunnerTemplate.sh index d981d240c816f9..cefb5b46f75466 100644 --- a/eng/testing/AndroidRunnerTemplate.sh +++ b/eng/testing/AndroidRunnerTemplate.sh @@ -40,7 +40,7 @@ $HARNESS_RUNNER android test \ --package-name="net.dot.$ASSEMBLY_NAME" \ --app="$EXECUTION_DIR/bin/$TEST_NAME.apk" \ --output-directory="$XHARNESS_OUT" \ - --timeout=1800 \ + --timeout=5600 \ $ADDITIONAL_ARGS _exitCode=$? diff --git a/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs b/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs index d3b0cf224dae30..839732f2a0a7c0 100644 --- a/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs +++ b/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs @@ -37,6 +37,8 @@ static Certificates() { try { + // TODO these server certificates should be added into the network_security_config.xml on Android + // + can we even read those files on Android? are they copied correctly into the APK? --- they are copied into the assets/assets.zip archive, so I guess they should be readable just fine byte[] serverCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testservereku.contoso.com.pfx")); byte[] clientCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testclienteku.contoso.com.pfx")); byte[] noEKUCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testnoeku.contoso.com.pfx")); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs index 3032267ac72636..b9d11ae601abad 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs @@ -108,7 +108,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( [Theory] [InlineData(false)] [InlineData(true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task CertificateValidationClientServer_EndToEnd_Ok(bool useClientSelectionCallback) { IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, 0); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs index 8bd61c714c3a56..9afd01b73792b1 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs @@ -22,14 +22,14 @@ public ClientAsyncAuthenticateTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_ServerRequireEncryption_ConnectWithEncryption() { await ClientAsyncSslHelper(EncryptionPolicy.RequireEncryption); } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_ConnectionInfoInCallback_DoesNotThrow() { await ClientAsyncSslHelper(EncryptionPolicy.RequireEncryption, SslProtocols.Tls12, SslProtocolSupport.DefaultSslProtocols, AllowAnyServerCertificateAndVerifyConnectionInfo); @@ -51,7 +51,7 @@ await Assert.ThrowsAsync( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_EachSupportedProtocol_Success(SslProtocols protocol) { await ClientAsyncSslHelper(protocol, protocol); @@ -70,7 +70,8 @@ public async Task ClientAsyncAuthenticate_MismatchProtocols_Fails( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // TODO we need to update the network security config to make this work on Android + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_AllServerAllClient_Success() { await ClientAsyncSslHelper( @@ -80,7 +81,7 @@ await ClientAsyncSslHelper( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_AllServerVsIndividualClientSupportedProtocols_Success( SslProtocols clientProtocol) { @@ -89,7 +90,7 @@ public async Task ClientAsyncAuthenticate_AllServerVsIndividualClientSupportedPr [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_IndividualServerVsAllClientSupportedProtocols_Success( SslProtocols serverProtocol) { @@ -151,7 +152,7 @@ private async Task ClientAsyncSslHelper( Task clientTask = client.AuthenticateAsClientAsync(new SslClientAuthenticationOptions { EnabledSslProtocols = clientSslProtocols, - RemoteCertificateValidationCallback = AllowAnyServerCertificate, + RemoteCertificateValidationCallback = AllowAnyServerCertificate, // TODO this is not enough on Android - the OS will interfere with the validation process TargetHost = serverName }); serverTask = server.AuthenticateAsServerAsync( new SslServerAuthenticationOptions { @@ -173,7 +174,7 @@ private async Task ClientAsyncSslHelper( client.Close(); try { - await serverTask; + await serverTask.WaitAsync(TestConfiguration.PassingTestTimeout); } catch (Exception ex) { diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs index 9c0cb1446f33c4..bbe0a633c03756 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs @@ -21,7 +21,7 @@ public ClientDefaultEncryptionTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientDefaultEncryption_ServerRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -44,7 +44,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientDefaultEncryption_ServerAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs index d8111a762ad3f6..1e1e57167fe3f3 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs @@ -20,7 +20,7 @@ public ServerAllowNoEncryptionTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAllowNoEncryption_ClientRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -45,7 +45,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAllowNoEncryption_ClientAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 2bd9da2c24c061..5d8785916960e8 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -38,14 +38,14 @@ public void Dispose() [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProtocols protocol) { await ServerAsyncSslHelper(protocol, protocol); } [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] [MemberData(nameof(ProtocolMismatchData))] public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( SslProtocols clientProtocol, @@ -67,7 +67,7 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_AllClientVsIndividualServerSupportedProtocols_Success( SslProtocols serverProtocol) { @@ -75,7 +75,7 @@ public async Task ServerAsyncAuthenticate_AllClientVsIndividualServerSupportedPr } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_SimpleSniOptions_Success() { var state = new object(); @@ -104,7 +104,7 @@ public async Task ServerAsyncAuthenticate_SimpleSniOptions_Success() [Theory] [MemberData(nameof(SupportedProtocolData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_SniSetVersion_Success(SslProtocols version) { var serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = _serverCertificate, EnabledSslProtocols = version }; @@ -146,7 +146,7 @@ private async Task OptionsTask(SslServerAuthenti } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_AsyncOptions_Success() { var state = new object(); @@ -203,7 +203,7 @@ public async Task ServerAsyncAuthenticate_FailingOptionCallback_Throws(bool useA } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_VerificationDelegate_Success() { bool validationCallbackCalled = false; @@ -236,7 +236,7 @@ public async Task ServerAsyncAuthenticate_VerificationDelegate_Success() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_ConstructorVerificationDelegate_Success() { bool validationCallbackCalled = false; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs index faed579afb5d30..f2b02a4201c906 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs @@ -21,7 +21,7 @@ public ServerRequireEncryptionTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerRequireEncryption_ClientRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -44,7 +44,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerRequireEncryption_ClientAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs index cbac2f930395dc..6f5b51fb11aeaf 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs @@ -19,7 +19,7 @@ public abstract class SslClientAuthenticationOptionsTestBase protected abstract bool TestAuthenticateAsync { get; } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientOptions_ServerOptions_NotMutatedDuringAuthentication() { using (X509Certificate2 clientCert = Configuration.Certificates.GetClientCertificate()) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs index b242a5c5d6b9d4..5b962e6f14d08f 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs @@ -104,7 +104,7 @@ public async Task SslStream_StreamToStream_DuplicateOptions_Throws() [Theory] [MemberData(nameof(Alpn_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Alpn_Success(List clientProtocols, List serverProtocols, SslApplicationProtocol expected) { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); @@ -183,7 +183,7 @@ public async Task SslStream_Http2_Alpn_Success(Uri server) { try { - await client.ConnectAsync(server.Host, server.Port); + await client.ConnectAsync(server.Host, server.Port).WaitAsync(TestConfiguration.PassingTestTimeout); using (SslStream clientStream = new SslStream(client.GetStream(), leaveInnerStreamOpen: false)) { SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions @@ -192,7 +192,7 @@ public async Task SslStream_Http2_Alpn_Success(Uri server) TargetHost = server.Host }; - await clientStream.AuthenticateAsClientAsync(TestAuthenticateAsync, clientOptions); + await clientStream.AuthenticateAsClientAsync(TestAuthenticateAsync, clientOptions).WaitAsync(TestConfiguration.PassingTestTimeout); Assert.Equal("h2", clientStream.NegotiatedApplicationProtocol.ToString()); } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs index 0fe9b00b794d78..c1a026d0eac8fe 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs @@ -49,7 +49,7 @@ await new[] } } - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamMemoryConformanceTests : SslStreamConformanceTests { protected override Task CreateConnectedStreamsAsync() => @@ -65,7 +65,7 @@ protected override Task CreateConnectedStreamsAsync() => } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls11))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls11NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { #pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete @@ -74,14 +74,14 @@ public sealed class SslStreamTls11NetworkConformanceTests : SslStreamDefaultNetw } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls12))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls12NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { protected override SslProtocols GetSslProtocols() => SslProtocols.Tls12; } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls13))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls13NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { protected override SslProtocols GetSslProtocols() => SslProtocols.Tls13; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs index 3ad072f7087522..c00a352931d054 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs @@ -28,7 +28,7 @@ public SslStreamMutualAuthenticationTest() [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_RequireClientCert_IsMutuallyAuthenticated_ReturnsTrue(bool clientCertificateRequired, bool useClientSelectionCallback) { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs index a110bc801158ab..c7b4b173e9cc12 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs @@ -69,7 +69,7 @@ public void Tls13IsSupported_GetValue_ReturnsTrue() } [ConditionalFact(nameof(Tls13Supported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public void NegotiatedCipherSuite_SslProtocolIsTls13_ShouldBeTls13() { var p = new ConnectionParams() @@ -91,7 +91,7 @@ public void NegotiatedCipherSuite_SslProtocolIsTls13_ShouldBeTls13() [InlineData(SslProtocols.Tls11)] #pragma warning restore SYSLIB0039 [InlineData(SslProtocols.Tls12)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public void NegotiatedCipherSuite_SslProtocolIsLowerThanTls13_ShouldMatchTheProtocol(SslProtocols protocol) { var p = new ConnectionParams() @@ -631,7 +631,7 @@ private static async Task WaitForSecureConnection(SslStream client, S try { // since we broke connection the server should finish - await serverTask; + await serverTask.WaitAsync(TestConfiguration.PassingTestTimeout); } catch (AuthenticationException) { } catch (Win32Exception) { } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs index b7809488712f82..163a66d0c6144c 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs @@ -537,7 +537,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( client.AuthenticateAsClientAsync(clientOptions, cts.Token), server.AuthenticateAsServerAsync(serverOptions, cts.Token)); // need this to complete TLS 1.3 handshake - await TestHelper.PingPong(client, server); + await TestHelper.PingPong(client, server, cts.Token); Assert.Null(server.RemoteCertificate); // Client needs to be reading for renegotiation to happen. @@ -688,6 +688,9 @@ public async Task SslStream_NestedAuth_Throws() [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_TargetHostName_Succeeds(bool useEmptyName, bool useCallback) { + using CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + string targetName = useEmptyName ? string.Empty : Guid.NewGuid().ToString("N"); int count = 0; @@ -733,7 +736,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( client.AuthenticateAsClientAsync(clientOptions), server.AuthenticateAsServerAsync(serverOptions)); - await TestHelper.PingPong(client, server); + await TestHelper.PingPong(client, server, cts.Token); Assert.Equal(targetName, client.TargetHostName); Assert.Equal(targetName, server.TargetHostName); @@ -810,6 +813,9 @@ public async Task SslStream_UntrustedCaWithCustomCallback_OK(bool usePartialChai [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCallback) { + using CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + string errorMessage; var clientOptions = new SslClientAuthenticationOptions() { TargetHost = "localhost" }; if (customCallback) @@ -843,11 +849,18 @@ public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCall using (SslStream client = new SslStream(clientStream)) using (SslStream server = new SslStream(serverStream)) { - Task t1 = client.AuthenticateAsClientAsync(clientOptions, CancellationToken.None); - Task t2 = server.AuthenticateAsServerAsync(serverOptions, CancellationToken.None); + Task t1 = client.AuthenticateAsClientAsync(clientOptions, cts.Token); + Task t2 = server.AuthenticateAsServerAsync(serverOptions, cts.Token); var e = await Assert.ThrowsAsync(() => t1); - Assert.Contains(errorMessage, e.Message); + if (!PlatformDetection.IsAndroid) + { + Assert.Contains(errorMessage, e.Message); + } + else + { + // TODO + } // Server side should finish since we run custom callback after handshake is done. await t2; } @@ -938,7 +951,7 @@ public async Task SslStream_ClientCertificate_SendsChain() [InlineData(16384 * 100, 4096, 1024, true)] [InlineData(16384 * 100, 1024 * 20, 1024, true)] [InlineData(16384, 3, 3, true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_RandomSizeWrites_OK(int bufferSize, int readBufferSize, int writeBufferSize, bool useAsync) { byte[] dataToCopy = RandomNumberGenerator.GetBytes(bufferSize); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs index e544b63a800427..e4b73b9397469f 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs @@ -55,6 +55,9 @@ await WithVirtualConnection(async (server, client) => [MemberData(nameof(HostNameData))] public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws(string hostName) { + using CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); int timesCallbackCalled = 0; @@ -88,7 +91,7 @@ public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws return serverCert; }; - await Assert.ThrowsAsync(() => server.AuthenticateAsServerAsync(options, CancellationToken.None)); + await Assert.ThrowsAsync(() => server.AuthenticateAsServerAsync(options, cts.Token)); Assert.Equal(0, timesCallbackCalled); } @@ -99,6 +102,9 @@ public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection(string hostName) { + using CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); int timesCallbackCalled = 0; @@ -128,7 +134,7 @@ public async Task SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection(s SslServerAuthenticationOptions options = DefaultServerOptions(); options.ServerCertificate = serverCert; - await TaskTimeoutExtensions.WhenAllOrAnyFailed(new[] { clientJob, server.AuthenticateAsServerAsync(options, CancellationToken.None) }); + await TaskTimeoutExtensions.WhenAllOrAnyFailed(new[] { clientJob, server.AuthenticateAsServerAsync(options, cts.Token) }); Assert.Equal(1, timesCallbackCalled); } @@ -156,6 +162,8 @@ await WithVirtualConnection(async (server, client) => }; var cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + await Assert.ThrowsAsync(WithAggregateExceptionUnwrapping(async () => await server.AuthenticateAsServerAsync(options, cts.Token) )); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs index 8d0dae26892b55..eb700e8e17db55 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs @@ -70,7 +70,7 @@ public static IEnumerable SslStream_StreamToStream_Authentication_Succ [ConditionalTheory] [MemberData(nameof(SslStream_StreamToStream_Authentication_Success_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Authentication_Success(X509Certificate serverCert = null, X509Certificate clientCert = null) { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -87,7 +87,7 @@ public async Task SslStream_StreamToStream_Authentication_Success(X509Certificat } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Authentication_IncorrectServerName_Fail() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -131,7 +131,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout(client.AuthenticateAsClien [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Read_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -160,7 +160,7 @@ public async Task Read_CorrectlyUnlocksAfterFailure() [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Write_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -185,7 +185,7 @@ public async Task Write_CorrectlyUnlocksAfterFailure() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Read_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -211,7 +211,7 @@ public async Task Read_InvokedSynchronously() [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Write_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -236,7 +236,7 @@ public async Task Write_InvokedSynchronously() [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Dispose_Throws() { if (this is SslStreamStreamToStreamTest_SyncBase) @@ -289,7 +289,7 @@ public async Task SslStream_StreamToStream_Dispose_Throws() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_EOFDuringFrameRead_ThrowsIOException() { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs index d7c90164c45ef7..843340cecb6444 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs @@ -76,7 +76,7 @@ public static IEnumerable OneOrBothUseDefaulData() [ConditionalTheory] [MemberData(nameof(OneOrBothUseDefaulData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAndServer_OneOrBothUseDefault_Ok(SslProtocols? clientProtocols, SslProtocols? serverProtocols) { using (X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate()) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index da1847ee98958b..f70e75f615c474 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -134,4 +134,14 @@ + + + + true + + + + PreserveNewest + + diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem new file mode 100644 index 00000000000000..f3b1b7732f5127 --- /dev/null +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb +MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx +MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm +v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb +tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN +NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY +uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco +5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB +o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM +Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL +BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 +l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG +eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 +RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK +XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD +7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem new file mode 100644 index 00000000000000..ace567381a2972 --- /dev/null +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu +MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe +Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz +ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk +i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 +X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp +ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl +FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp +LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa +/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy +QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj +sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX +UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU +h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC +AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G +A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA +YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e +fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg +KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz +/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt +n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 +X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs +O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 +Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy +RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V +ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt +Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml new file mode 100644 index 00000000000000..0de2bb2c11169d --- /dev/null +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml @@ -0,0 +1,9 @@ + + + + + + + + + From 89296f610f7674cef416087849e9212024397b7b Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 28 Jun 2022 11:44:17 +0200 Subject: [PATCH 04/39] Remove active issue attributes --- .../FunctionalTests/CertificateValidationClientServer.cs | 1 - .../tests/FunctionalTests/ClientAsyncAuthenticateTest.cs | 6 ------ .../tests/FunctionalTests/ClientDefaultEncryptionTest.cs | 2 -- .../tests/FunctionalTests/ServerAllowNoEncryptionTest.cs | 2 -- .../tests/FunctionalTests/ServerAsyncAuthenticateTest.cs | 8 -------- .../tests/FunctionalTests/ServerRequireEncryptionTest.cs | 2 -- .../tests/FunctionalTests/SslStreamAlpnTests.cs | 1 - .../tests/FunctionalTests/SslStreamConformanceTests.cs | 4 ---- .../FunctionalTests/SslStreamMutualAuthenticationTest.cs | 1 - .../FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs | 2 -- .../tests/FunctionalTests/SslStreamStreamToStreamTest.cs | 8 -------- .../tests/FunctionalTests/SslStreamSystemDefaultsTest.cs | 1 - 12 files changed, 38 deletions(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs index b9d11ae601abad..b637c54caf790a 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs @@ -108,7 +108,6 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( [Theory] [InlineData(false)] [InlineData(true)] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task CertificateValidationClientServer_EndToEnd_Ok(bool useClientSelectionCallback) { IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, 0); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs index 9afd01b73792b1..fc259f39279d5f 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs @@ -22,14 +22,12 @@ public ClientAsyncAuthenticateTest(ITestOutputHelper output) } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_ServerRequireEncryption_ConnectWithEncryption() { await ClientAsyncSslHelper(EncryptionPolicy.RequireEncryption); } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_ConnectionInfoInCallback_DoesNotThrow() { await ClientAsyncSslHelper(EncryptionPolicy.RequireEncryption, SslProtocols.Tls12, SslProtocolSupport.DefaultSslProtocols, AllowAnyServerCertificateAndVerifyConnectionInfo); @@ -51,7 +49,6 @@ await Assert.ThrowsAsync( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_EachSupportedProtocol_Success(SslProtocols protocol) { await ClientAsyncSslHelper(protocol, protocol); @@ -71,7 +68,6 @@ public async Task ClientAsyncAuthenticate_MismatchProtocols_Fails( [Fact] // TODO we need to update the network security config to make this work on Android - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_AllServerAllClient_Success() { await ClientAsyncSslHelper( @@ -81,7 +77,6 @@ await ClientAsyncSslHelper( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_AllServerVsIndividualClientSupportedProtocols_Success( SslProtocols clientProtocol) { @@ -90,7 +85,6 @@ public async Task ClientAsyncAuthenticate_AllServerVsIndividualClientSupportedPr [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAsyncAuthenticate_IndividualServerVsAllClientSupportedProtocols_Success( SslProtocols serverProtocol) { diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs index bbe0a633c03756..6059ec3477184a 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientDefaultEncryptionTest.cs @@ -21,7 +21,6 @@ public ClientDefaultEncryptionTest(ITestOutputHelper output) } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientDefaultEncryption_ServerRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -44,7 +43,6 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientDefaultEncryption_ServerAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs index 1e1e57167fe3f3..dea9fbe963f9b1 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAllowNoEncryptionTest.cs @@ -20,7 +20,6 @@ public ServerAllowNoEncryptionTest(ITestOutputHelper output) } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAllowNoEncryption_ClientRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -45,7 +44,6 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAllowNoEncryption_ClientAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 5d8785916960e8..7dd52bd2d66398 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -38,14 +38,12 @@ public void Dispose() [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProtocols protocol) { await ServerAsyncSslHelper(protocol, protocol); } [Theory] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] [MemberData(nameof(ProtocolMismatchData))] public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( SslProtocols clientProtocol, @@ -67,7 +65,6 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( [Theory] [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_AllClientVsIndividualServerSupportedProtocols_Success( SslProtocols serverProtocol) { @@ -75,7 +72,6 @@ public async Task ServerAsyncAuthenticate_AllClientVsIndividualServerSupportedPr } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_SimpleSniOptions_Success() { var state = new object(); @@ -104,7 +100,6 @@ public async Task ServerAsyncAuthenticate_SimpleSniOptions_Success() [Theory] [MemberData(nameof(SupportedProtocolData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_SniSetVersion_Success(SslProtocols version) { var serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = _serverCertificate, EnabledSslProtocols = version }; @@ -146,7 +141,6 @@ private async Task OptionsTask(SslServerAuthenti } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_AsyncOptions_Success() { var state = new object(); @@ -203,7 +197,6 @@ public async Task ServerAsyncAuthenticate_FailingOptionCallback_Throws(bool useA } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_VerificationDelegate_Success() { bool validationCallbackCalled = false; @@ -236,7 +229,6 @@ public async Task ServerAsyncAuthenticate_VerificationDelegate_Success() } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_ConstructorVerificationDelegate_Success() { bool validationCallbackCalled = false; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs index f2b02a4201c906..992cafcc581f1e 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerRequireEncryptionTest.cs @@ -21,7 +21,6 @@ public ServerRequireEncryptionTest(ITestOutputHelper output) } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerRequireEncryption_ClientRequireEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); @@ -44,7 +43,6 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerRequireEncryption_ClientAllowNoEncryption_ConnectWithEncryption() { (NetworkStream clientStream, NetworkStream serverStream) = TestHelper.GetConnectedTcpStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs index 5b962e6f14d08f..f726ace9aacf88 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs @@ -104,7 +104,6 @@ public async Task SslStream_StreamToStream_DuplicateOptions_Throws() [Theory] [MemberData(nameof(Alpn_TestData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Alpn_Success(List clientProtocols, List serverProtocols, SslApplicationProtocol expected) { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs index c1a026d0eac8fe..17cf39145e4f6c 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamConformanceTests.cs @@ -49,7 +49,6 @@ await new[] } } - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamMemoryConformanceTests : SslStreamConformanceTests { protected override Task CreateConnectedStreamsAsync() => @@ -65,7 +64,6 @@ protected override Task CreateConnectedStreamsAsync() => } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls11))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls11NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { #pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete @@ -74,14 +72,12 @@ public sealed class SslStreamTls11NetworkConformanceTests : SslStreamDefaultNetw } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls12))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls12NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { protected override SslProtocols GetSslProtocols() => SslProtocols.Tls12; } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls13))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public sealed class SslStreamTls13NetworkConformanceTests : SslStreamDefaultNetworkConformanceTests { protected override SslProtocols GetSslProtocols() => SslProtocols.Tls13; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs index c00a352931d054..20301a08b647f1 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs @@ -28,7 +28,6 @@ public SslStreamMutualAuthenticationTest() [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_RequireClientCert_IsMutuallyAuthenticated_ReturnsTrue(bool clientCertificateRequired, bool useClientSelectionCallback) { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs index c7b4b173e9cc12..497db07a89a3c7 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs @@ -69,7 +69,6 @@ public void Tls13IsSupported_GetValue_ReturnsTrue() } [ConditionalFact(nameof(Tls13Supported))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public void NegotiatedCipherSuite_SslProtocolIsTls13_ShouldBeTls13() { var p = new ConnectionParams() @@ -91,7 +90,6 @@ public void NegotiatedCipherSuite_SslProtocolIsTls13_ShouldBeTls13() [InlineData(SslProtocols.Tls11)] #pragma warning restore SYSLIB0039 [InlineData(SslProtocols.Tls12)] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public void NegotiatedCipherSuite_SslProtocolIsLowerThanTls13_ShouldMatchTheProtocol(SslProtocols protocol) { var p = new ConnectionParams() diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs index 3f56d8bdad0a31..fd051025446e76 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs @@ -70,7 +70,6 @@ public static IEnumerable SslStream_StreamToStream_Authentication_Succ [ConditionalTheory] [MemberData(nameof(SslStream_StreamToStream_Authentication_Success_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Authentication_Success(X509Certificate serverCert = null, X509Certificate clientCert = null) { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -87,7 +86,6 @@ public async Task SslStream_StreamToStream_Authentication_Success(X509Certificat } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Authentication_IncorrectServerName_Fail() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -131,7 +129,6 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout(client.AuthenticateAsClien [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Read_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -160,7 +157,6 @@ public async Task Read_CorrectlyUnlocksAfterFailure() [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Write_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -185,7 +181,6 @@ public async Task Write_CorrectlyUnlocksAfterFailure() } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Read_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -211,7 +206,6 @@ public async Task Read_InvokedSynchronously() [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task Write_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); @@ -236,7 +230,6 @@ public async Task Write_InvokedSynchronously() [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_Dispose_Throws() { if (this is SslStreamStreamToStreamTest_SyncBase) @@ -289,7 +282,6 @@ public async Task SslStream_StreamToStream_Dispose_Throws() } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_StreamToStream_EOFDuringFrameRead_ThrowsIOException() { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs index 843340cecb6444..51b28f5b26f60c 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs @@ -76,7 +76,6 @@ public static IEnumerable OneOrBothUseDefaulData() [ConditionalTheory] [MemberData(nameof(OneOrBothUseDefaulData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientAndServer_OneOrBothUseDefault_Ok(SslProtocols? clientProtocols, SslProtocols? serverProtocols) { using (X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate()) From f7ca23a11386f5c5213028a6c2537c70138e81f3 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 28 Jun 2022 15:06:50 +0200 Subject: [PATCH 05/39] Rename certificate file --- .../FunctionalTests/res/raw/{ndx_ca.pem => ndx_test_root_ca} | 0 .../tests/FunctionalTests/res/xml/network_security_config.xml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/{ndx_ca.pem => ndx_test_root_ca} (100%) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca similarity index 100% rename from src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_ca.pem rename to src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml index 0de2bb2c11169d..42d8f97ead2b70 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml @@ -2,7 +2,7 @@ - + From ff09605d6dade46a57f5a5cb16cca622ca4df96f Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 28 Jun 2022 15:44:57 +0200 Subject: [PATCH 06/39] Revert unnecessary changes --- eng/testing/AndroidRunnerTemplate.sh | 2 +- .../System/Net/Configuration.Certificates.cs | 2 -- .../ClientAsyncAuthenticateTest.cs | 5 ++-- .../SslAuthenticationOptionsTest.cs | 1 - .../FunctionalTests/SslStreamAlpnTests.cs | 4 ++-- .../SslStreamNegotiatedCipherSuiteTest.cs | 2 +- .../SslStreamNetworkStreamTest.cs | 24 ++++--------------- .../tests/FunctionalTests/SslStreamSniTest.cs | 12 ++-------- 8 files changed, 13 insertions(+), 39 deletions(-) diff --git a/eng/testing/AndroidRunnerTemplate.sh b/eng/testing/AndroidRunnerTemplate.sh index cefb5b46f75466..d981d240c816f9 100644 --- a/eng/testing/AndroidRunnerTemplate.sh +++ b/eng/testing/AndroidRunnerTemplate.sh @@ -40,7 +40,7 @@ $HARNESS_RUNNER android test \ --package-name="net.dot.$ASSEMBLY_NAME" \ --app="$EXECUTION_DIR/bin/$TEST_NAME.apk" \ --output-directory="$XHARNESS_OUT" \ - --timeout=5600 \ + --timeout=1800 \ $ADDITIONAL_ARGS _exitCode=$? diff --git a/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs b/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs index 839732f2a0a7c0..d3b0cf224dae30 100644 --- a/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs +++ b/src/libraries/Common/tests/System/Net/Configuration.Certificates.cs @@ -37,8 +37,6 @@ static Certificates() { try { - // TODO these server certificates should be added into the network_security_config.xml on Android - // + can we even read those files on Android? are they copied correctly into the APK? --- they are copied into the assets/assets.zip archive, so I guess they should be readable just fine byte[] serverCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testservereku.contoso.com.pfx")); byte[] clientCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testclienteku.contoso.com.pfx")); byte[] noEKUCertificateBytes = File.ReadAllBytes(Path.Combine(TestDataFolder, "testnoeku.contoso.com.pfx")); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs index fc259f39279d5f..73c102d51e953a 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs @@ -67,7 +67,6 @@ public async Task ClientAsyncAuthenticate_MismatchProtocols_Fails( } [Fact] - // TODO we need to update the network security config to make this work on Android public async Task ClientAsyncAuthenticate_AllServerAllClient_Success() { await ClientAsyncSslHelper( @@ -146,7 +145,7 @@ private async Task ClientAsyncSslHelper( Task clientTask = client.AuthenticateAsClientAsync(new SslClientAuthenticationOptions { EnabledSslProtocols = clientSslProtocols, - RemoteCertificateValidationCallback = AllowAnyServerCertificate, // TODO this is not enough on Android - the OS will interfere with the validation process + RemoteCertificateValidationCallback = AllowAnyServerCertificate, TargetHost = serverName }); serverTask = server.AuthenticateAsServerAsync( new SslServerAuthenticationOptions { @@ -168,7 +167,7 @@ private async Task ClientAsyncSslHelper( client.Close(); try { - await serverTask.WaitAsync(TestConfiguration.PassingTestTimeout); + await serverTask; } catch (Exception ex) { diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs index 8c73cc291cf9d8..581951fa76ad03 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs @@ -19,7 +19,6 @@ public abstract class SslClientAuthenticationOptionsTestBase protected abstract bool TestAuthenticateAsync { get; } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientOptions_ServerOptions_NotMutatedDuringAuthentication() { using (X509Certificate2 clientCert = Configuration.Certificates.GetClientCertificate()) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs index f726ace9aacf88..8b0e9ab6165ffb 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlpnTests.cs @@ -182,7 +182,7 @@ public async Task SslStream_Http2_Alpn_Success(Uri server) { try { - await client.ConnectAsync(server.Host, server.Port).WaitAsync(TestConfiguration.PassingTestTimeout); + await client.ConnectAsync(server.Host, server.Port); using (SslStream clientStream = new SslStream(client.GetStream(), leaveInnerStreamOpen: false)) { SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions @@ -191,7 +191,7 @@ public async Task SslStream_Http2_Alpn_Success(Uri server) TargetHost = server.Host }; - await clientStream.AuthenticateAsClientAsync(TestAuthenticateAsync, clientOptions).WaitAsync(TestConfiguration.PassingTestTimeout); + await clientStream.AuthenticateAsClientAsync(TestAuthenticateAsync, clientOptions); Assert.Equal("h2", clientStream.NegotiatedApplicationProtocol.ToString()); } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs index 497db07a89a3c7..90dcc49db8725b 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs @@ -629,7 +629,7 @@ private static async Task WaitForSecureConnection(SslStream client, S try { // since we broke connection the server should finish - await serverTask.WaitAsync(TestConfiguration.PassingTestTimeout); + await serverTask; } catch (AuthenticationException) { } catch (Win32Exception) { } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs index 590cc86678eec9..548328b964db09 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs @@ -537,7 +537,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( client.AuthenticateAsClientAsync(clientOptions, cts.Token), server.AuthenticateAsServerAsync(serverOptions, cts.Token)); // need this to complete TLS 1.3 handshake - await TestHelper.PingPong(client, server, cts.Token); + await TestHelper.PingPong(client, server); Assert.Null(server.RemoteCertificate); // Client needs to be reading for renegotiation to happen. @@ -688,9 +688,6 @@ public async Task SslStream_NestedAuth_Throws() [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_TargetHostName_Succeeds(bool useEmptyName, bool useCallback) { - using CancellationTokenSource cts = new CancellationTokenSource(); - cts.CancelAfter(TestConfiguration.PassingTestTimeout); - string targetName = useEmptyName ? string.Empty : Guid.NewGuid().ToString("N"); int count = 0; @@ -736,7 +733,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( client.AuthenticateAsClientAsync(clientOptions), server.AuthenticateAsServerAsync(serverOptions)); - await TestHelper.PingPong(client, server, cts.Token); + await TestHelper.PingPong(client, server); Assert.Equal(targetName, client.TargetHostName); Assert.Equal(targetName, server.TargetHostName); @@ -813,9 +810,6 @@ public async Task SslStream_UntrustedCaWithCustomCallback_OK(bool usePartialChai [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCallback) { - using CancellationTokenSource cts = new CancellationTokenSource(); - cts.CancelAfter(TestConfiguration.PassingTestTimeout); - string errorMessage; var clientOptions = new SslClientAuthenticationOptions() { TargetHost = "localhost" }; if (customCallback) @@ -849,18 +843,11 @@ public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCall using (SslStream client = new SslStream(clientStream)) using (SslStream server = new SslStream(serverStream)) { - Task t1 = client.AuthenticateAsClientAsync(clientOptions, cts.Token); - Task t2 = server.AuthenticateAsServerAsync(serverOptions, cts.Token); + Task t1 = client.AuthenticateAsClientAsync(clientOptions, CancellationToken.None); + Task t2 = server.AuthenticateAsServerAsync(serverOptions, CancellationToken.None); var e = await Assert.ThrowsAsync(() => t1); - if (!PlatformDetection.IsAndroid) - { - Assert.Contains(errorMessage, e.Message); - } - else - { - // TODO - } + Assert.Contains(errorMessage, e.Message); // Server side should finish since we run custom callback after handshake is done. await t2; } @@ -951,7 +938,6 @@ public async Task SslStream_ClientCertificate_SendsChain() [InlineData(16384 * 100, 4096, 1024, true)] [InlineData(16384 * 100, 1024 * 20, 1024, true)] [InlineData(16384, 3, 3, true)] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_RandomSizeWrites_OK(int bufferSize, int readBufferSize, int writeBufferSize, bool useAsync) { byte[] dataToCopy = RandomNumberGenerator.GetBytes(bufferSize); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs index e4b73b9397469f..e544b63a800427 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs @@ -55,9 +55,6 @@ await WithVirtualConnection(async (server, client) => [MemberData(nameof(HostNameData))] public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws(string hostName) { - using CancellationTokenSource cts = new CancellationTokenSource(); - cts.CancelAfter(TestConfiguration.PassingTestTimeout); - X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); int timesCallbackCalled = 0; @@ -91,7 +88,7 @@ public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws return serverCert; }; - await Assert.ThrowsAsync(() => server.AuthenticateAsServerAsync(options, cts.Token)); + await Assert.ThrowsAsync(() => server.AuthenticateAsServerAsync(options, CancellationToken.None)); Assert.Equal(0, timesCallbackCalled); } @@ -102,9 +99,6 @@ public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection(string hostName) { - using CancellationTokenSource cts = new CancellationTokenSource(); - cts.CancelAfter(TestConfiguration.PassingTestTimeout); - X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); int timesCallbackCalled = 0; @@ -134,7 +128,7 @@ public async Task SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection(s SslServerAuthenticationOptions options = DefaultServerOptions(); options.ServerCertificate = serverCert; - await TaskTimeoutExtensions.WhenAllOrAnyFailed(new[] { clientJob, server.AuthenticateAsServerAsync(options, cts.Token) }); + await TaskTimeoutExtensions.WhenAllOrAnyFailed(new[] { clientJob, server.AuthenticateAsServerAsync(options, CancellationToken.None) }); Assert.Equal(1, timesCallbackCalled); } @@ -162,8 +156,6 @@ await WithVirtualConnection(async (server, client) => }; var cts = new CancellationTokenSource(); - cts.CancelAfter(TestConfiguration.PassingTestTimeout); - await Assert.ThrowsAsync(WithAggregateExceptionUnwrapping(async () => await server.AuthenticateAsServerAsync(options, cts.Token) )); From 039d051d6ac60c1c3f1baf37b0c06872f87cac84 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 1 Jul 2022 11:54:46 +0200 Subject: [PATCH 07/39] TMP: re-throw caught exception to reveal more information in logs --- .../tests/FunctionalTests/ServerAsyncAuthenticateTest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 7dd52bd2d66398..9c64206f79b7ce 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -59,6 +59,10 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( expectedToFail: true); }); + // TODO remove this temporary re-throw + if (e is not AuthenticationException) + throw e; + Assert.NotNull(e); Assert.IsAssignableFrom(expectedException, e); } From 98db19ba3356cdf852b9d4adbd0f86900a3b0af3 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 1 Jul 2022 13:51:11 +0200 Subject: [PATCH 08/39] Revert "TMP: re-throw caught exception to reveal more information in logs" This reverts commit 039d051d6ac60c1c3f1baf37b0c06872f87cac84. --- .../tests/FunctionalTests/ServerAsyncAuthenticateTest.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 9c64206f79b7ce..7dd52bd2d66398 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -59,10 +59,6 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( expectedToFail: true); }); - // TODO remove this temporary re-throw - if (e is not AuthenticationException) - throw e; - Assert.NotNull(e); Assert.IsAssignableFrom(expectedException, e); } From a4c25b485c307d5b5a1ed914c0c2b79790849d98 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 4 Jul 2022 12:48:24 +0200 Subject: [PATCH 09/39] TMP: add and update res folders until they are merged into runtime-assets --- .../res/raw/ndx_test_root_ca.pem | 19 ++++++++++++ .../testselfsignedservereku_contoso_com.pem | 30 +++++++++++++++++++ .../res/xml/network_security_config.xml | 10 +++++++ .../tests/res/raw/ndx_test_root_ca.pem | 19 ++++++++++++ .../testselfsignedservereku_contoso_com.pem | 30 +++++++++++++++++++ .../tests/res/xml/network_security_config.xml | 10 +++++++ .../res/xml/network_security_config.xml | 1 + 7 files changed, 119 insertions(+) create mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem create mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem create mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml create mode 100644 src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem create mode 100644 src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem create mode 100644 src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem new file mode 100644 index 00000000000000..f3b1b7732f5127 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb +MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx +MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm +v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb +tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN +NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY +uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco +5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB +o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM +Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL +BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 +l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG +eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 +RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK +XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD +7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem new file mode 100644 index 00000000000000..ace567381a2972 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu +MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe +Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz +ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk +i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 +X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp +ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl +FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp +LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa +/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy +QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj +sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX +UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU +h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC +AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G +A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA +YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e +fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg +KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz +/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt +n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 +X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs +O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 +Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy +RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V +ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt +Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml new file mode 100644 index 00000000000000..71490ea97c0b7b --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem b/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem new file mode 100644 index 00000000000000..f3b1b7732f5127 --- /dev/null +++ b/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb +MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx +MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm +v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb +tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN +NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY +uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco +5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB +o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM +Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL +BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 +l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG +eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 +RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK +XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD +7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem new file mode 100644 index 00000000000000..ace567381a2972 --- /dev/null +++ b/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu +MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe +Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz +ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk +i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 +X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp +ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl +FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp +LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa +/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy +QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj +sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX +UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU +h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC +AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G +A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA +YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e +fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg +KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz +/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt +n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 +X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs +O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 +Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy +RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V +ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt +Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= +-----END CERTIFICATE----- diff --git a/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml b/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml new file mode 100644 index 00000000000000..71490ea97c0b7b --- /dev/null +++ b/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml index 42d8f97ead2b70..71490ea97c0b7b 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml @@ -4,6 +4,7 @@ + From 4acb16b98233156ce8eaacea369455aa8ac4736f Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 4 Jul 2022 15:43:27 +0200 Subject: [PATCH 10/39] Fix System.Net.Requests tests --- .../tests/FileWebRequestTest.cs | 4 ---- .../tests/HttpWebRequestTest.cs | 10 ---------- .../System.Net.Requests/tests/LoggingTest.cs | 1 - .../tests/System.Net.Requests.Tests.csproj | 10 ++++++++++ .../System.Net.Security.Tests.csproj | 20 +++++++++---------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/libraries/System.Net.Requests/tests/FileWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/FileWebRequestTest.cs index 94e0303fd9cc86..0212efc57dd382 100644 --- a/src/libraries/System.Net.Requests/tests/FileWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/FileWebRequestTest.cs @@ -88,7 +88,6 @@ public abstract class FileWebRequestTestBase public abstract Task GetRequestStreamAsync(WebRequest request); [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task ReadFile_ContainsExpectedContent() { string path = Path.GetTempFileName(); @@ -126,7 +125,6 @@ public async Task ReadFile_ContainsExpectedContent() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task WriteFile_ContainsExpectedContent() { string path = Path.GetTempFileName(); @@ -153,7 +151,6 @@ public async Task WriteFile_ContainsExpectedContent() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task WriteThenReadFile_WriteAccessResultsInNullResponseStream() { string path = Path.GetTempFileName(); @@ -186,7 +183,6 @@ public async Task WriteThenReadFile_WriteAccessResultsInNullResponseStream() protected virtual bool EnableConcurrentReadWriteTests => true; [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task RequestAfterResponse_throws() { string path = Path.GetTempFileName(); diff --git a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs index c54fe136cef073..397520164eb56b 100644 --- a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs @@ -326,7 +326,6 @@ public void AllowReadStreamBuffering_SetTrueThenGet_ExpectTrue(Uri remoteServer) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task ContentLength_Get_ExpectSameAsGetResponseStream(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1367,7 +1366,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task GetResponseAsync_GetResponseStream_ContainsHost(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1414,7 +1412,6 @@ public void Range_Add_Success(Uri remoteServer) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task GetResponseAsync_PostRequestStream_ContainsData(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1460,7 +1457,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] [ActiveIssue("https://github.com/dotnet/runtime/issues/56798", TestPlatforms.tvOS)] public async Task GetResponseAsync_UseDefaultCredentials_ExpectSuccess(bool useSsl) { @@ -1501,7 +1497,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] [ActiveIssue("https://github.com/dotnet/runtime/issues/56798", TestPlatforms.tvOS)] public async Task HaveResponse_GetResponseAsync_ExpectTrue(bool useSsl) { @@ -1521,7 +1516,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task Headers_GetResponseHeaders_ContainsExpectedValue(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1621,7 +1615,6 @@ public void RequestUri_CreateHttpThenGet_ExpectSameUri(Uri remoteServer) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task ResponseUri_GetResponseAsync_ExpectSameUri(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1645,7 +1638,6 @@ public void SupportsCookieContainer_GetDefault_ExpectTrue(Uri remoteServer) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task SimpleScenario_UseGETVerb_Success(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1662,7 +1654,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task SimpleScenario_UsePOSTVerb_Success(bool useSsl) { var options = new LoopbackServer.Options { UseSsl = useSsl }; @@ -1685,7 +1676,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public async Task ContentType_AddHeaderWithNoContent_SendRequest_HeaderGetsSent(bool useSsl) { const string ContentType = "text/plain; charset=utf-8"; diff --git a/src/libraries/System.Net.Requests/tests/LoggingTest.cs b/src/libraries/System.Net.Requests/tests/LoggingTest.cs index 4a508a1f8b9cb6..892fb0b0399ac4 100644 --- a/src/libraries/System.Net.Requests/tests/LoggingTest.cs +++ b/src/libraries/System.Net.Requests/tests/LoggingTest.cs @@ -10,7 +10,6 @@ public class LoggingTest { [Fact] [SkipOnCoreClr("System.Net.Tests are flaky", ~RuntimeConfiguration.Release)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/37087", TestPlatforms.Android)] public void EventSource_ExistsWithCorrectId() { Type esType = typeof(WebRequest).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false); diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index f8ee055fa994e2..cb0a2bcb359f33 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -7,7 +7,17 @@ true $(NoWarn);SYSLIB0014 + + true + + + + + PreserveNewest + + + diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index 2f9398a3d3a6b1..e59bc4e54272dd 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -5,7 +5,17 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS true true + + true + + + + + PreserveNewest + + + @@ -133,14 +143,4 @@ - - - - true - - - - PreserveNewest - - From 3dad204ce122378262bc46ee97b0223e4cd4b164 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 4 Jul 2022 17:50:12 +0200 Subject: [PATCH 11/39] Re-enable System.Net.Http functional tests --- .../HttpClientHandlerTest.AcceptAllCerts.cs | 3 +- .../HttpClientHandlerTest.Cancellation.cs | 4 - ...ttpClientHandlerTest.ClientCertificates.cs | 2 - .../Net/Http/HttpClientHandlerTest.Cookies.cs | 18 ---- .../Net/Http/HttpClientHandlerTest.Proxy.cs | 3 - ...ttpClientHandlerTest.ServerCertificates.cs | 4 +- .../HttpClientHandlerTest.SslProtocols.cs | 4 +- .../System/Net/Http/HttpClientHandlerTest.cs | 33 +++---- .../tests/FunctionalTests/DiagnosticsTests.cs | 2 - .../tests/FunctionalTests/HPackTest.cs | 1 - .../HttpClientHandlerTest.Finalization.cs | 2 +- .../HttpClientHandlerTest.Headers.cs | 13 --- .../HttpClientHandlerTest.Http2.cs | 96 +++---------------- .../tests/FunctionalTests/HttpClientTest.cs | 1 - .../ResponseStreamZeroByteReadTests.cs | 2 - .../SocketsHttpHandlerTest.Cancellation.cs | 2 - ...SocketsHttpHandlerTest.Http2FlowControl.cs | 15 +-- ...cketsHttpHandlerTest.Http2KeepAlivePing.cs | 4 - .../FunctionalTests/SocketsHttpHandlerTest.cs | 26 ----- .../tests/FunctionalTests/SocksProxyTest.cs | 9 +- .../System.Net.Http.Functional.Tests.csproj | 9 ++ 21 files changed, 55 insertions(+), 198 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs index ebd154b3a0a027..9ced9648aa3e96 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs @@ -46,7 +46,6 @@ public void SingletonReturnsTrue() #pragma warning restore SYSLIB0039 [InlineData(SslProtocols.None, false)] [InlineData(SslProtocols.None, true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SetDelegate_ConnectionSucceeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol) { #pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete @@ -99,7 +98,7 @@ await TestHelper.WhenAllCompletedOrAnyFailed( [OuterLoop] [ConditionalTheory(nameof(ClientSupportsDHECipherSuites))] [MemberData(nameof(InvalidCertificateServers))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/68898", TestPlatforms.Android)] public async Task InvalidCertificateServers_CertificateValidationDisabled_Succeeds(string url) { using (HttpClientHandler handler = CreateHttpClientHandler()) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cancellation.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cancellation.cs index 14c99f34edaf29..06bcd8298cf5d9 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cancellation.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cancellation.cs @@ -29,7 +29,6 @@ public HttpClientHandler_Cancellation_Test(ITestOutputHelper output) : base(outp [InlineData(false, CancellationMode.Token)] [InlineData(true, CancellationMode.Token)] [ActiveIssue("https://github.com/dotnet/runtime/issues/36634", TestPlatforms.Browser)] // out of memory - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsync_CancelDuringRequestContentSend_TaskCanceledQuickly(bool chunkedTransfer, CancellationMode mode) { if (LoopbackServerFactory.Version >= HttpVersion20.Value && chunkedTransfer) @@ -88,7 +87,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [Theory] [MemberData(nameof(OneBoolAndCancellationMode))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_CancelDuringResponseHeadersReceived_TaskCanceledQuickly(bool connectionClose, CancellationMode mode) { if (LoopbackServerFactory.Version >= HttpVersion20.Value && connectionClose) @@ -209,7 +207,6 @@ await ValidateClientCancellationAsync(async () => [Theory] [MemberData(nameof(ThreeBools))] [ActiveIssue("https://github.com/dotnet/runtime/issues/65429", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_CancelDuringResponseBodyReceived_Unbuffered_TaskCanceledQuickly(bool chunkedTransfer, bool connectionClose, bool readOrCopyToAsync) { if (LoopbackServerFactory.Version >= HttpVersion20.Value && (chunkedTransfer || connectionClose)) @@ -293,7 +290,6 @@ await ValidateClientCancellationAsync(async () => [InlineData(CancellationMode.CancelPendingRequests, true)] [InlineData(CancellationMode.DisposeHttpClient, true)] [SkipOnPlatform(TestPlatforms.Browser, "Browser doesn't have blocking synchronous Stream.ReadByte and so it waits for whole body")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_CancelPendingRequests_DoesntCancelReadAsyncOnResponseStream(CancellationMode mode, bool copyToAsync) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs index e26fce26f79253..69685b9f40bb39 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs @@ -81,7 +81,6 @@ private HttpClient CreateHttpClientWithCert(X509Certificate2 cert) [InlineData(1, true)] [InlineData(2, true)] [InlineData(3, false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Manual_CertificateOnlySentWhenValid_Success(int certIndex, bool serverExpectsClientCertificate) { var options = new LoopbackServer.Options { UseSsl = true }; @@ -130,7 +129,6 @@ await TestHelper.WhenAllCompletedOrAnyFailed( [Theory] [InlineData(6, false)] [InlineData(3, true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Manual_CertificateSentMatchesCertificateReceived_Success( int numberOfRequests, bool reuseClient) // validate behavior with and without connection pooling, which impacts client cert usage diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cookies.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cookies.cs index e0b2e5d338c703..b2f03bfbc930e5 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cookies.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Cookies.cs @@ -44,7 +44,6 @@ private static CookieContainer CreateSingleCookieContainer(Uri uri, string cooki private static string GetCookieHeaderValue(string cookieName, string cookieValue) => $"{cookieName}={cookieValue}"; [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_DefaultCoookieContainer_NoCookieSent() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -65,7 +64,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [MemberData(nameof(CookieNamesValuesAndUseCookies))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SetCookieContainer_CookieSent(string cookieName, string cookieValue, bool useCookies) { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -96,7 +94,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SetCookieContainerMultipleCookies_CookiesSent() { var cookies = new Cookie[] @@ -131,7 +128,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_AddCookieHeader_CookieHeaderSent() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -153,7 +149,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_AddMultipleCookieHeaders_CookiesSent() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -223,7 +218,6 @@ private string GetCookieValue(HttpRequestData request) [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SetCookieContainerAndCookieHeader_BothCookiesSent() { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -252,7 +246,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SetCookieContainerAndMultipleCookieHeaders_BothCookiesSent() { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -293,7 +286,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsyncWithRedirect_SetCookieContainer_CorrectCookiesSent() { if (UseVersion == HttpVersion30) @@ -341,7 +333,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url => [Theory] [MemberData(nameof(CookieNamesValuesAndUseCookies))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ReceiveSetCookieHeader_CookieAdded(string cookieName, string cookieValue, bool useCookies) { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -374,7 +365,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ReceiveMultipleSetCookieHeaders_CookieAdded() { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -415,7 +405,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => // ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_NoPathDefined_CookieAddedWithDefaultPath() { await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) => @@ -446,7 +435,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) => // ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_CookiePathDoesNotMatchRequestPath_CookieAccepted() { await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) => @@ -479,7 +467,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) => // ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_Redirect_CookiesArePreserved() { if (UseVersion == HttpVersion30) @@ -529,7 +516,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async serverUrl => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ReceiveSetCookieHeader_CookieUpdated() { const string newCookieValue = "789"; @@ -558,7 +544,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ReceiveSetCookieHeader_CookieRemoved() { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -583,7 +568,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ReceiveInvalidSetCookieHeader_ValidCookiesAdded() { await LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -619,7 +603,6 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsyncWithRedirect_ReceiveSetCookie_CookieSent() { if (UseVersion == HttpVersion30) @@ -680,7 +663,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsyncWithBasicAuth_ReceiveSetCookie_CookieSent() { if (UseVersion == HttpVersion30) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs index 201c1d8e54e86c..42448b2ee1c354 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs @@ -322,7 +322,6 @@ public async Task Proxy_SslProxyUnsupported_Throws() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ProxyTunnelRequest_GetAsync_Success() { if (IsWinHttpHandler) @@ -359,7 +358,6 @@ await LoopbackServer.CreateServerAsync(async (server, uri) => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ProxyTunnelRequest_MaxConnectionsSetButDoesNotApplyToProxyConnect_Success() { if (IsWinHttpHandler) @@ -417,7 +415,6 @@ await server2.AcceptConnectionAsync(async connection2 => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ProxyTunnelRequest_OriginServerSendsProxyAuthChallenge_NoProxyAuthPerformed() { if (IsWinHttpHandler) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index 28ebca017e65e5..eccbaff23a406d 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -282,7 +282,7 @@ private async Task UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(string [OuterLoop("Uses external servers")] [Theory] [MemberData(nameof(CertificateValidationServersAndExpectedPolicies))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, SslPolicyErrors expectedErrors) { const int SEC_E_BUFFER_TOO_SMALL = unchecked((int)0x80090321); @@ -306,7 +306,7 @@ public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, Ss } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] public async Task UseCallback_SelfSignedCertificate_ExpectedPolicyErrors() { using (HttpClientHandler handler = CreateHttpClientHandler()) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs index 238794dbe23522..aca689b2dd110c 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs @@ -101,7 +101,7 @@ public static IEnumerable GetAsync_AllowedSSLVersion_Succeeds_MemberDa [Theory] [MemberData(nameof(GetAsync_AllowedSSLVersion_Succeeds_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_AllowedSSLVersion_Succeeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol) { int count = 0; @@ -243,7 +243,7 @@ public async Task GetAsync_UnsupportedSSLVersion_Throws(SslProtocols sslProtocol } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_NoSpecifiedProtocol_DefaultsToTls12() { using (HttpClientHandler handler = CreateHttpClientHandler()) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index 87fac367760f2d..5dcf50661f4e7b 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -151,9 +151,9 @@ public void Properties_AddItemToDictionary_ItemPresent() } } - [Fact] + [ConditionalFact] [SkipOnPlatform(TestPlatforms.Browser, "ServerCertificateCustomValidationCallback not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "IPv6 loopback with SSL doesn't work on Android")] public async Task GetAsync_IPv6LinkLocalAddressUri_Success() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -186,9 +186,8 @@ await TestHelper.WhenAllCompletedOrAnyFailed( }, options: options); } - [Theory] + [ConditionalTheory] [MemberData(nameof(GetAsync_IPBasedUri_Success_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_IPBasedUri_Success(IPAddress address) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -211,6 +210,11 @@ public async Task GetAsync_IPBasedUri_Success(IPAddress address) var options = new GenericLoopbackOptions { Address = address }; + if (PlatformDetection.IsAndroid && options.UseSsl && address == IPAddress.IPv6Loopback) + { + throw new SkipTestException("IPv6 loopback with SSL doesn't work on Android"); + } + await LoopbackServerFactory.CreateServerAsync(async (server, url) => { _output.WriteLine(url.ToString()); @@ -278,9 +282,8 @@ from useSsl in BoolValues where PlatformDetection.IsNotBrowser || !useSsl select new object[] { address, useSsl }; - [Theory] + [ConditionalTheory] [MemberData(nameof(SecureAndNonSecure_IPBasedUri_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SecureAndNonSecureIPBasedUri_CorrectlyFormatted(IPAddress address, bool useSsl) { if (LoopbackServerFactory.Version >= HttpVersion20.Value) @@ -289,6 +292,11 @@ public async Task GetAsync_SecureAndNonSecureIPBasedUri_CorrectlyFormatted(IPAdd return; } + if (PlatformDetection.IsAndroid && useSsl && address == IPAddress.IPv6Loopback) + { + throw new SkipTestException("IPv6 loopback with SSL doesn't work on Android"); + } + var options = new LoopbackServer.Options { Address = address, UseSsl = useSsl }; bool connectionAccepted = false; string host = ""; @@ -327,7 +335,6 @@ await LoopbackServer.CreateClientAndServerAsync(async url => [InlineData("WWW-Authenticate", "CustomAuth")] [InlineData("", "")] // RFC7235 requires servers to send this header with 401 but some servers don't. [SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ServerNeedsNonStandardAuthAndSetCredential_StatusCodeUnauthorized(string authHeadrName, string authHeaderValue) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -411,7 +418,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -991,7 +997,6 @@ await connection.WriteStringAsync( [InlineData(false, false)] [InlineData(null, false)] [ActiveIssue("https://github.com/dotnet/runtime/issues/65429", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ReadAsStreamAsync_HandlerProducesWellBehavedResponseStream(bool? chunked, bool enableWasmStreaming) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1204,7 +1209,6 @@ await server.AcceptConnectionAsync(async connection => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ReadAsStreamAsync_EmptyResponseBody_HandlerProducesWellBehavedResponseStream() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1300,7 +1304,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/58812", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Dispose_DisposingHandlerCancelsActiveOperationsWithoutResponses() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1421,7 +1424,6 @@ public async Task GetAsync_UnicodeHostName_SuccessStatusCodeInResponse() [Fact] [SkipOnPlatform(TestPlatforms.Browser, "ExpectContinue not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ExpectContinueTrue_NoContent_StillSendsHeader() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1474,7 +1476,6 @@ public static IEnumerable Interim1xxStatusCode() [Theory] [MemberData(nameof(Interim1xxStatusCode))] [SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_1xxResponsesWithHeaders_InterimResponsesHeadersIgnored(HttpStatusCode responseStatusCode) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1550,7 +1551,6 @@ await server.AcceptConnectionAsync(async connection => [Theory] [MemberData(nameof(Interim1xxStatusCode))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_Unexpected1xxResponses_DropAllInterimResponses(HttpStatusCode responseStatusCode) { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1602,7 +1602,6 @@ await server.AcceptConnectionAsync(async connection => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "ExpectContinue not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_MultipleExpected100Responses_ReceivesCorrectResponse() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1653,7 +1652,6 @@ await server.AcceptConnectionAsync(async connection => [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/54160", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_Expect100Continue_RequestBodyFails_ThrowsContentException() { if (IsWinHttpHandler) @@ -1703,7 +1701,6 @@ await server.AcceptConnectionAsync(async connection => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "ExpectContinue not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_No100ContinueReceived_RequestBodySentEventually() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1936,7 +1933,6 @@ await LoopbackServer.CreateServerAsync(async (server, url) => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_RequestVersion20_HttpNotHttps_NoUpgradeRequest() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) @@ -1972,7 +1968,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => #region Uri wire transmission encoding tests [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendRequest_UriPathHasReservedChars_ServerReceivedExpectedPath() { if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index e61006f3437b4b..a84459ac06ad72 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -848,7 +848,6 @@ await GetFactoryForVersion(useVersion).CreateClientAndServerAsync( [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [MemberData(nameof(UseSocketsHttpHandler_WithIdFormat_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_HeadersAreInjectedOnRedirects(bool useSocketsHttpHandler, ActivityIdFormat idFormat) { Activity parent = new Activity("parent"); @@ -933,7 +932,6 @@ public static IEnumerable SocketsHttpHandlerPropagators_WithIdFormat_M [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [MemberData(nameof(SocketsHttpHandlerPropagators_WithIdFormat_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_CustomSocketsHttpHandlerPropagator_PropagatorIsUsed(DistributedContextPropagator propagator, ActivityIdFormat idFormat) { Activity parent = new Activity("parent"); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HPackTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HPackTest.cs index b946c6d6fed43f..18e502f48281d0 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HPackTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HPackTest.cs @@ -32,7 +32,6 @@ public HPackTest(ITestOutputHelper output) : base(output) [Theory] [MemberData(nameof(HeaderEncodingTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task HPack_HeaderEncoding(string headerName, string expectedValue, byte[] expectedEncoding) { await Http2LoopbackServer.CreateClientAndServerAsync( diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs index 0678869ef8250f..9804804117a863 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs @@ -26,7 +26,7 @@ private static Task GetAndDropResponse(HttpClient client, Uri url) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task IncompleteResponseStream_ResponseDropped_CancelsRequestToServer() { using (HttpClient client = CreateHttpClient()) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs index d8def4049a77bb..85d6ee9ca8e6b4 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs @@ -24,7 +24,6 @@ public HttpClientHandlerTest_Headers(ITestOutputHelper output) : base(output) { private sealed class DerivedHttpHeaders : HttpHeaders { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_RequestWithSimpleHeader_ResponseReferencesUnmodifiedRequestHeaders() { const string HeaderKey = "some-header-123", HeaderValue = "this is the expected header value"; @@ -49,7 +48,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [Fact] [SkipOnPlatform(TestPlatforms.Browser, "User-Agent is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_UserAgent_CorrectlyWritten() { string userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.18 Safari/537.36"; @@ -73,7 +71,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_LargeHeaders_CorrectlyWritten() { if (UseVersion == HttpVersion.Version30) @@ -109,7 +106,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_DefaultHeaders_CorrectlyWritten() { const string Version = "2017-04-17"; @@ -171,7 +167,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [InlineData("Accept-CharSet", "text/plain, text/json", false)] // invalid format for header but added with TryAddWithoutValidation [InlineData("Content-Location", "", false)] // invalid format for header but added with TryAddWithoutValidation [InlineData("Max-Forwards", "NotAnInteger", false)] // invalid format for header but added with TryAddWithoutValidation - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_SpecialHeaderKeyOrValue_Success(string key, string value, bool parsable) { if (PlatformDetection.IsBrowser && (key == "Content-Location" || key == "Date" || key == "Accept-CharSet")) @@ -217,7 +212,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [Theory] [InlineData("Content-Security-Policy", 4618)] [InlineData("RandomCustomHeader", 12345)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_LargeHeader_Success(string headerName, int headerValueLength) { var rand = new Random(42); @@ -242,7 +236,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_EmptyResponseHeader_Success() { IList headers = new HttpHeaderData[] { @@ -274,7 +267,6 @@ await server.AcceptConnectionAsync(async connection => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_MissingExpires_ReturnNull() { await LoopbackServerFactory.CreateClientAndServerAsync(async uri => @@ -295,7 +287,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [InlineData("Thu, 01 Dec 1994 16:00:00 GMT", true)] [InlineData("-1", false)] [InlineData("0", false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_Expires_Success(string value, bool isValid) { await LoopbackServerFactory.CreateClientAndServerAsync(async uri => @@ -334,7 +325,6 @@ public void HeadersAdd_CustomExpires_Success(string value, bool isValid) [Theory] [InlineData("Accept-Encoding", "identity,gzip")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_RequestHeaderInResponse_Success(string name, string value) { await LoopbackServerFactory.CreateClientAndServerAsync(async uri => @@ -413,7 +403,6 @@ public async Task SendAsync_GetWithInvalidHostHeader_ThrowsException() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/54160", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_WithZeroLengthHeaderName_Throws() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -458,7 +447,6 @@ private static readonly (string Name, Encoding ValueEncoding, string Separator, [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Socket is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_CustomRequestEncodingSelector_CanSendNonAsciiHeaderValues() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -514,7 +502,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Socket is not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_CustomResponseEncodingSelector_CanReceiveNonAsciiHeaderValues() { await LoopbackServerFactory.CreateClientAndServerAsync( diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index 90421159618685..b2cf1fac3da7ae 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -63,7 +63,6 @@ private async Task AssertProtocolErrorForIOExceptionAsync(Task task, ProtocolErr } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_ClientPreface_Sent() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -78,7 +77,6 @@ public async Task Http2_ClientPreface_Sent() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_InitialSettings_SentAndAcked() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -111,7 +109,6 @@ public async Task Http2_InitialSettings_SentAndAcked() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_DataSentBeforeServerPreface_ProtocolError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -130,7 +127,6 @@ public async Task Http2_DataSentBeforeServerPreface_ProtocolError() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_NoResponseBody_Success() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -151,7 +147,6 @@ public async Task Http2_NoResponseBody_Success() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_ZeroLengthResponseBody_Success() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -210,7 +205,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_ServerSendsValidSettingsValues_Success() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -246,7 +240,6 @@ public async Task Http2_ServerSendsValidSettingsValues_Success() [InlineData(SettingId.MaxFrameSize, 16383)] [InlineData(SettingId.MaxFrameSize, 162777216)] [InlineData(SettingId.InitialWindowSize, 0x80000000)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_ServerSendsInvalidSettingsValue_Error(SettingId settingId, uint value) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -264,7 +257,6 @@ public async Task Http2_ServerSendsInvalidSettingsValue_Error(SettingId settingI } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_StreamResetByServerBeforeHeadersSent_RequestFails() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -284,7 +276,6 @@ public async Task Http2_StreamResetByServerBeforeHeadersSent_RequestFails() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_StreamResetByServerAfterHeadersSent_RequestFails() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -307,7 +298,6 @@ public async Task Http2_StreamResetByServerAfterHeadersSent_RequestFails() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_StreamResetByServerAfterPartialBodySent_RequestFails() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -332,7 +322,6 @@ public async Task Http2_StreamResetByServerAfterPartialBodySent_RequestFails() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_StreamRefused_RequestIsRetried() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -368,7 +357,6 @@ public async Task GetAsync_StreamRefused_RequestIsRetried() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsync_StreamRefused_RequestIsRetried() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -409,7 +397,7 @@ public async Task PostAsync_StreamRefused_RequestIsRetried() [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SettingsFrameNotSentOnNewConnection_ClientApplies100StreamLimit() { const int DefaultMaxConcurrentStreams = 100; @@ -461,7 +449,7 @@ public async Task GetAsync_SettingsFrameNotSentOnNewConnection_ClientApplies100S [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] // TODO revisit outerloop tests public async Task GetAsync_ServerDelaysSendingSettingsThenSetsLowerMaxConcurrentStreamsLimitThenIncreaseIt_ClientAppliesEachLimitChangeProperly() { const int DefaultMaxConcurrentStreams = 100; @@ -522,7 +510,7 @@ public async Task GetAsync_ServerDelaysSendingSettingsThenSetsLowerMaxConcurrent [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ServerSendSettingsWithoutMaxConcurrentStreams_ClientAppliesInfiniteLimit() { const int DefaultMaxConcurrentStreams = 100; @@ -584,7 +572,6 @@ public async Task GetAsync_ServerSendSettingsWithoutMaxConcurrentStreams_ClientA // "If a DATA frame is received whose stream identifier field is 0x0, the recipient MUST // respond with a connection error (Section 5.4.1) of type PROTOCOL_ERROR." [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DataFrame_NoStream_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -611,7 +598,6 @@ public async Task DataFrame_NoStream_ConnectionError() // "Receiving any frame other than HEADERS or PRIORITY on a stream in this state MUST // be treated as a connection error (Section 5.4.1) of type PROTOCOL_ERROR." [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DataFrame_IdleStream_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -638,7 +624,6 @@ public async Task DataFrame_IdleStream_ConnectionError() // headers from the server on an idle stream. We fall back to treating this as a connection // level error, as we do for other unexpected frames on idle streams. [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task HeadersFrame_IdleStream_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -706,7 +691,6 @@ private static Frame MakeSimpleDataFrame(int streamId, bool endStream = false) = 0, streamId); [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_ContinuationBeforeHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -727,7 +711,6 @@ public async Task ResponseStreamFrames_ContinuationBeforeHeaders_ConnectionError } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_DataBeforeHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -748,7 +731,6 @@ public async Task ResponseStreamFrames_DataBeforeHeaders_ConnectionError() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_HeadersAfterHeadersWithoutEndHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -770,7 +752,6 @@ public async Task ResponseStreamFrames_HeadersAfterHeadersWithoutEndHeaders_Conn } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_HeadersAfterHeadersAndContinuationWithoutEndHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -793,7 +774,6 @@ public async Task ResponseStreamFrames_HeadersAfterHeadersAndContinuationWithout } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_DataAfterHeadersWithoutEndHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -815,7 +795,6 @@ public async Task ResponseStreamFrames_DataAfterHeadersWithoutEndHeaders_Connect } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResponseStreamFrames_DataAfterHeadersAndContinuationWithoutEndHeaders_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -841,7 +820,6 @@ public async Task ResponseStreamFrames_DataAfterHeadersAndContinuationWithoutEnd // "An endpoint MUST treat a GOAWAY frame with a stream identifier other than 0x0 as a // connection error (Section 5.4.1) of type PROTOCOL_ERROR." [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_NonzeroStream_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -865,7 +843,6 @@ public async Task GoAwayFrame_NonzeroStream_ConnectionError() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_NewRequest_NewConnection() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -897,7 +874,6 @@ public async Task GoAwayFrame_NewRequest_NewConnection() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_ServerDisconnect_AbortStreams() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -925,7 +901,6 @@ await Assert.ThrowsAnyAsync(() => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_RequestWithBody_ServerDisconnect_AbortStreamsAndThrowIOException() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -958,7 +933,6 @@ public async Task GoAwayFrame_RequestWithBody_ServerDisconnect_AbortStreamsAndTh } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_UnprocessedStreamFirstRequestFinishedFirst_RequestRestarted() { // This test case is similar to GoAwayFrame_UnprocessedStreamFirstRequestWaitsUntilSecondFinishes_RequestRestarted @@ -1004,7 +978,6 @@ public async Task GoAwayFrame_UnprocessedStreamFirstRequestFinishedFirst_Request } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_UnprocessedStreamFirstRequestWaitsUntilSecondFinishes_RequestRestarted() { using (await Watchdog.CreateAsync()) @@ -1047,7 +1020,6 @@ public async Task GoAwayFrame_UnprocessedStreamFirstRequestWaitsUntilSecondFinis } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_RequestInFlight_Finished() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -1093,7 +1065,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DataFrame_TooLong_ConnectionError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1116,7 +1087,6 @@ public async Task DataFrame_TooLong_ConnectionError() [ConditionalTheory(nameof(SupportsAlpn))] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task CompletedResponse_FrameReceived_Ignored(bool sendDataFrame) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1150,7 +1120,6 @@ public async Task CompletedResponse_FrameReceived_Ignored(bool sendDataFrame) [ConditionalTheory(nameof(SupportsAlpn))] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task EmptyResponse_FrameReceived_Ignored(bool sendDataFrame) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1179,7 +1148,6 @@ public async Task EmptyResponse_FrameReceived_Ignored(bool sendDataFrame) } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task CompletedResponse_WindowUpdateFrameReceived_Success() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1250,7 +1218,6 @@ public static IEnumerable ValidAndInvalidProtocolErrorsAndBool() [ConditionalTheory(nameof(SupportsAlpn))] [MemberData(nameof(ValidAndInvalidProtocolErrorsAndBool))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ResetResponseStream_FrameReceived_Ignored(ProtocolErrors error, bool dataFrame) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1308,7 +1275,6 @@ await new[] } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_NoPendingStreams_ConnectionClosed() { using (await Watchdog.CreateAsync()) @@ -1330,7 +1296,6 @@ public async Task GoAwayFrame_NoPendingStreams_ConnectionClosed() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_AllPendingStreamsValid_RequestsSucceedAndConnectionClosed() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1395,7 +1360,6 @@ public async Task GoAwayFrame_AllPendingStreamsValid_RequestsSucceedAndConnectio } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GoAwayFrame_AbortAllPendingStreams_StreamFailWithExpectedException() { using (await Watchdog.CreateAsync()) @@ -1504,7 +1468,6 @@ private static async Task ReadToEndOfStream(Http2LoopbackConnection connect [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_FlowControl_ClientDoesNotExceedWindows() { const int ContentSize = 100_000; @@ -1597,7 +1560,7 @@ public async Task Http2_FlowControl_ClientDoesNotExceedWindows() [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_InitialWindowSize_ClientDoesNotExceedWindows() { const int ContentSize = DefaultInitialWindowSize + 1000; @@ -1717,7 +1680,6 @@ public async Task Http2_InitialWindowSize_ClientDoesNotExceedWindows() [InlineData(DefaultInitialWindowSize + 32 * 1024)] [InlineData(DefaultInitialWindowSize + 64 * 1024)] [InlineData(DefaultInitialWindowSize + 96 * 1024)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_SendOverStreamWindowSizeWithoutExplicitFlush_ClientSendsUpToFullWindowSize(int contentSize) { var content = new ByteArrayContent(new byte[contentSize]); @@ -1771,7 +1733,6 @@ public async Task Http2_SendOverStreamWindowSizeWithoutExplicitFlush_ClientSends [InlineData(DefaultInitialWindowSize + 32 * 1024)] [InlineData(DefaultInitialWindowSize + 64 * 1024)] [InlineData(DefaultInitialWindowSize + 96 * 1024)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_SendOverConnectionWindowSizeWithoutExplicitFlush_ClientSendsUpToFullWindowSize(int contentSize) { var content = new ByteArrayContent(new byte[contentSize]); @@ -1820,7 +1781,7 @@ public async Task Http2_SendOverConnectionWindowSizeWithoutExplicitFlush_ClientS [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_MaxConcurrentStreams_LimitEnforced() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1889,7 +1850,7 @@ public async Task Http2_MaxConcurrentStreams_LimitEnforced() [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_WaitingForStream_Cancellation() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1939,7 +1900,6 @@ public async Task Http2_WaitingForStream_Cancellation() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_WaitingOnWindowCredit_Cancellation() { // The goal of this test is to get the client into the state where it has sent the headers, @@ -1987,7 +1947,6 @@ public async Task Http2_WaitingOnWindowCredit_Cancellation() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_PendingSend_Cancellation() { // The goal of this test is to get the client into the state where it is sending content, @@ -2026,7 +1985,7 @@ public async Task Http2_PendingSend_Cancellation() [OuterLoop("Uses Task.Delay")] [InlineData(false)] [InlineData(true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_PendingSend_SendsReset(bool waitForData) { var cts = new CancellationTokenSource(); @@ -2096,7 +2055,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_PendingReceive_SendsReset(bool doRead) { var cts = new CancellationTokenSource(); @@ -2166,7 +2124,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2Connection_Should_Wrap_HttpContent_InvalidOperationException() { // test for https://github.com/dotnet/runtime/issues/30187 @@ -2194,7 +2151,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2Connection_Should_Not_Wrap_HttpContent_CustomException() { // Assert existing HttpConnection behaviour in which custom HttpContent exception types are surfaced as-is @@ -2227,7 +2183,6 @@ private class CustomException : Exception { } [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncExpect100Continue_SendRequest_Ok(bool send100Continue) { await Http2LoopbackServer.CreateClientAndServerAsync(async url => @@ -2263,7 +2218,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncExpect100Continue_NonSuccessResponse_RequestBodyNotSent() { string responseContent = "no no!"; @@ -2395,7 +2349,6 @@ private async Task SendAndReceiveRequestEOFAsync(DuplexContent duplexContent, St } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_ClientSendsEndStream_Success() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2456,7 +2409,6 @@ public async Task PostAsyncDuplex_ClientSendsEndStream_Success() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_ServerSendsEndStream_Success() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2517,7 +2469,6 @@ public async Task PostAsyncDuplex_ServerSendsEndStream_Success() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_RequestContentException_ResetsStream() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2575,7 +2526,6 @@ public async Task PostAsyncDuplex_RequestContentException_ResetsStream() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_RequestContentExceptionAfterResponseEndReceivedButBeforeConsumed_ResetsStreamAndThrowsOnResponseStreamRead() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2640,7 +2590,7 @@ public async Task PostAsyncDuplex_RequestContentExceptionAfterResponseEndReceive [OuterLoop("Uses Task.Delay")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_CancelledBeforeResponseHeadersReceived_ResetsStream() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2697,7 +2647,6 @@ public async Task PostAsyncDuplex_CancelledBeforeResponseHeadersReceived_ResetsS } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_ServerResetsStream_Throws() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2759,7 +2708,7 @@ public async Task PostAsyncDuplex_ServerResetsStream_Throws() [OuterLoop("Uses Task.Delay")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_DisposeResponseBodyBeforeEnd_ResetsStreamAndThrowsOnRequestStreamWriteAndResponseStreamRead() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2827,7 +2776,7 @@ public async Task PostAsyncDuplex_DisposeResponseBodyBeforeEnd_ResetsStreamAndTh [OuterLoop("Uses Task.Delay")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_DisposeResponseBodyAfterEndReceivedButBeforeConsumed_ResetsStreamAndThrowsOnRequestStreamWriteAndResponseStreamRead() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2901,7 +2850,7 @@ public async Task PostAsyncDuplex_DisposeResponseBodyAfterEndReceivedButBeforeCo [OuterLoop("Uses Task.Delay")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_FinishRequestBodyAndDisposeResponseBodyAfterEndReceivedButBeforeConsumed_DoesNotResetStream() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2967,7 +2916,6 @@ public async Task PostAsyncDuplex_FinishRequestBodyAndDisposeResponseBodyAfterEn } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_ServerCompletesResponseBodyThenResetsStreamWithNoError_SuccessAndRequestBodyCancelled() { // Per section 8.1 of the RFC: @@ -3037,7 +2985,6 @@ public async Task PostAsyncDuplex_ServerCompletesResponseBodyThenResetsStreamWit } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncNonDuplex_ServerCompletesResponseBodyThenResetsStreamWithNoError_SuccessAndRequestBodyCancelled() { // Per section 8.1 of the RFC: @@ -3090,7 +3037,7 @@ public async Task PostAsyncNonDuplex_ServerCompletesResponseBodyThenResetsStream [InlineData(true, HttpStatusCode.OK)] [InlineData(false, HttpStatusCode.OK)] [OuterLoop("Uses Task.Delay")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_ConcurentSendReceive_Ok(bool shouldWaitForRequestBody, HttpStatusCode responseCode) { string requestContent = new string('*', 300); @@ -3158,7 +3105,7 @@ public async Task SendAsync_ConcurentSendReceive_Ok(bool shouldWaitForRequestBod [Fact] [OuterLoop("Uses Task.Delay")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_ConcurentSendReceive_Fail() { TaskCompletionSource tsc = new TaskCompletionSource(); @@ -3231,7 +3178,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => [Fact] [OuterLoop("Waits for seconds for events that shouldn't happen")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_StreamContentRequestBody_WaitsForRequestBodyToComplete() { var waitToSendRequestBody = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -3281,7 +3228,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_ProtocolMismatch_Throws() { HttpClientHandler handler = CreateHttpClientHandler(); @@ -3318,7 +3264,6 @@ await server.AcceptConnectionAsync(async connection => // rfc7540 8.1.2.3. [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_MultipleStatusHeaders_Throws() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -3336,7 +3281,6 @@ public async Task Http2GetAsync_MultipleStatusHeaders_Throws() // rfc7540 8.1.2.3. [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_StatusHeaderNotFirst_Throws() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -3355,7 +3299,6 @@ public async Task Http2GetAsync_StatusHeaderNotFirst_Throws() // rfc7540 8.1.2.3. [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_TrailigPseudo_Throw() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -3378,7 +3321,6 @@ public async Task Http2GetAsync_TrailigPseudo_Throw() [InlineData(0)] [InlineData(1)] [InlineData(2)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2SendAsync_LargeHeaders_CorrectlyWritten(int continuationCount) { // Intentionally larger than 2x16K in total because that's the limit that will trigger a CONTINUATION frame in HTTP2. @@ -3422,7 +3364,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task InboundWindowSize_Exceeded_Throw() { var semaphore = new SemaphoreSlim(0); @@ -3500,7 +3441,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync( [Fact] [OuterLoop("Uses Task.Delay")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SocketSendQueueFull_RequestCanceled_ThrowsOperationCanceled() { TaskCompletionSource clientComplete = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -3542,7 +3483,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task MaxResponseHeadersLength_Exact_Success(bool huffmanEncode) { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3573,7 +3513,6 @@ await con.SendResponseHeadersAsync(streamId, isTrailingHeader: true, headers: ne [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task MaxResponseHeadersLength_Exceeded_Throws(bool huffmanEncode) { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3603,7 +3542,6 @@ await con.SendResponseHeadersAsync(streamId, isTrailingHeader: true, headers: ne } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task MaxResponseHeadersLength_Malicious_Throws() { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3631,7 +3569,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DynamicTableSizeUpdate_Exceeds_Settings_Throws() { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3657,7 +3594,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DynamicTable_Reuse_Concat() { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3688,7 +3624,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DynamicTable_Resize_Success() { await Http2LoopbackServer.CreateClientAndServerAsync( @@ -3767,7 +3702,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( [Theory] [MemberData(nameof(DynamicTable_Data))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task DynamicTable_Receipt_Success(IEnumerable headers) { await Http2LoopbackServer.CreateClientAndServerAsync( diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs index 00589f8f09cbf6..d5eb72a54ee553 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs @@ -1188,7 +1188,6 @@ public static IEnumerable VersionSelectionMemberData() [Theory] [MemberData(nameof(VersionSelectionMemberData))] [SkipOnPlatform(TestPlatforms.Browser, "Version is ignored on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_CorrectVersionSelected_LoopbackServer(Version requestVersion, HttpVersionPolicy versionPolicy, Version serverVersion, bool useSsl, object expectedResult) { await HttpAgnosticLoopbackServer.CreateClientAndServerAsync( diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs index 4909e8ca0f5b1b..19caaab4404aae 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs @@ -80,7 +80,6 @@ public static IEnumerable ZeroByteRead_IssuesZeroByteReadOnUnderlyingS [Theory] [MemberData(nameof(ZeroByteRead_IssuesZeroByteReadOnUnderlyingStream_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] [SkipOnPlatform(TestPlatforms.Browser, "ConnectCallback is not supported on Browser")] public async Task ZeroByteRead_IssuesZeroByteReadOnUnderlyingStream(StreamConformanceTests.ReadWriteMode readMode, bool useSsl) { @@ -226,7 +225,6 @@ public ResponseStreamZeroByteReadTestBase(ITestOutputHelper output) : base(outpu [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ZeroByteRead_BlocksUntilDataIsAvailable(bool async) { var zeroByteReadIssued = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs index 96e3b53cdcb9f0..0fdd4c97771d78 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs @@ -110,7 +110,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectionFailure_AfterInitialRequestCancelled_SecondRequestSucceedsOnNewConnection(bool useSsl) { if (UseVersion == HttpVersion.Version30) @@ -264,7 +263,6 @@ public async Task RequestsCanceled_NoConnectionAttemptForCanceledRequests() [OuterLoop("Incurs significant delay")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Expect100Continue_WaitsExpectedPeriodOfTimeBeforeSendingContent() { await LoopbackServerFactory.CreateClientAndServerAsync(async uri => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs index 4cee5beec976b4..4862c0a4ae52c5 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs @@ -30,7 +30,6 @@ public SocketsHttpHandler_Http2FlowControl_Test(ITestOutputHelper output) : base private static Http2Options NoAutoPingResponseHttp2Options => new Http2Options() { EnableTransparentPingResponse = false }; [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task InitialHttp2StreamWindowSize_SentInSettingsFrame() { const int WindowSize = 123456; @@ -50,7 +49,6 @@ public async Task InitialHttp2StreamWindowSize_SentInSettingsFrame() [Theory] [InlineData(0)] // Invalid PING payload [InlineData(1)] // Unexpected PING response - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public Task BadRttPingResponse_RequestShouldFail(int mode) { return Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -86,7 +84,6 @@ public Task BadRttPingResponse_RequestShouldFail(int mode) [OuterLoop("Runs long")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task HighBandwidthDelayProduct_ClientStreamReceiveWindowWindowScalesUp() { int maxCredit = await TestClientWindowScalingAsync( @@ -100,8 +97,7 @@ public async Task HighBandwidthDelayProduct_ClientStreamReceiveWindowWindowScale } [OuterLoop("Runs long")] - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void DisableDynamicWindowScaling_HighBandwidthDelayProduct_WindowRemainsConstant() { static async Task RunTest() @@ -121,8 +117,7 @@ static async Task RunTest() } [OuterLoop("Runs long")] - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void MaxStreamWindowSize_WhenSet_WindowDoesNotScaleAboveMaximum() { const int MaxWindow = 654321; @@ -145,8 +140,7 @@ static async Task RunTest() } [OuterLoop("Runs long")] - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void StreamWindowScaleThresholdMultiplier_HighValue_WindowScalesSlower() { static async Task RunTest() @@ -167,8 +161,7 @@ static async Task RunTest() } [OuterLoop("Runs long")] - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void StreamWindowScaleThresholdMultiplier_LowValue_WindowScalesFaster() { static async Task RunTest() diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs index 57ab51d3fa175e..d760e8e9c53e95 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs @@ -40,7 +40,6 @@ public SocketsHttpHandler_Http2KeepAlivePing_Test(ITestOutputHelper output) : ba [OuterLoop("Runs long")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task KeepAlivePingDelay_Infinite_NoKeepAlivePingIsSent() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -101,7 +100,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(HttpKeepAlivePingPolicy.Always)] [InlineData(HttpKeepAlivePingPolicy.WithActiveRequests)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task KeepAliveConfigured_KeepAlivePingsAreSentAccordingToPolicy(HttpKeepAlivePingPolicy policy) { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -181,7 +179,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => [OuterLoop("Runs long")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task KeepAliveConfigured_NoPingResponseDuringActiveStream_RequestShouldFail() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -232,7 +229,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => [OuterLoop("Runs long")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task HttpKeepAlivePingPolicy_Always_NoPingResponseBetweenStreams_SecondRequestShouldFail() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 6797e8e07a82b5..4efa7b32dbd47e 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -890,7 +890,6 @@ public SocketsHttpHandler_Http2_TrailingHeaders_Test(ITestOutputHelper output) : protected override Version UseVersion => HttpVersion.Version20; [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -919,7 +918,6 @@ public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection() [InlineData(false)] [InlineData(true)] [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -956,7 +954,6 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool resp } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_TrailerHeaders_TrailingPseudoHeadersThrow() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -981,7 +978,6 @@ public async Task Http2GetAsync_TrailerHeaders_TrailingPseudoHeadersThrow() [InlineData(false)] [InlineData(true)] [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1033,7 +1029,6 @@ public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Availab } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_TrailerHeaders_TrailingHeaderNoBody() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1058,7 +1053,6 @@ public async Task Http2GetAsync_TrailerHeaders_TrailingHeaderNoBody() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2GetAsync_TrailingHeaders_NoData_EmptyResponseObserved() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1538,7 +1532,6 @@ await server.AcceptConnectionAsync(async connection2 => [Theory] [InlineData("PooledConnectionLifetime")] [InlineData("PooledConnectionIdleTimeout")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_SmallConnectionTimeout_SubsequentRequestUsesDifferentConnection(string timeoutPropertyName) { await Http2LoopbackServerFactory.CreateServerAsync(async (server, url) => @@ -1625,7 +1618,6 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [OuterLoop] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public void HandlerDroppedWithoutDisposal_NotKeptAlive() { var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -2223,7 +2215,6 @@ public async Task Http2_MultipleConnectionsEnabled_ConnectionLimitNotReached_Con } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_MultipleConnectionsEnabled_ManyRequestsEnqueuedSimultaneously_SufficientConnectionsCreated() { // This is equal to Http2Connection.InitialMaxConcurrentStreams, which is the limit we impose before we have received the peer's initial SETTINGS frame. @@ -2317,7 +2308,6 @@ public async Task Http2_MultipleConnectionsEnabled_InfiniteRequestsCompletelyBlo } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnections_Success() { const int MaxConcurrentStreams = 2; @@ -2377,7 +2367,6 @@ public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnectio [ConditionalFact(nameof(SupportsAlpn))] [OuterLoop("Incurs long delay")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_MultipleConnectionsEnabled_IdleConnectionTimeoutExpired_ConnectionRemovedAndNewCreated() { const int MaxConcurrentStreams = 2; @@ -2542,7 +2531,6 @@ public SocketsHttpHandlerTest_ConnectCallback(ITestOutputHelper output) : base(o [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_ContextHasCorrectProperties_Success(bool syncRequest, bool syncCallback) { if (syncRequest && UseVersion > HttpVersion.Version11) @@ -2602,7 +2590,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_BindLocalAddress_Success(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -2637,7 +2624,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_UseMemoryBuffer_Success(bool useSsl) { (Stream clientStream, Stream serverStream) = ConnectedStreams.CreateBidirectional(); @@ -2676,7 +2662,6 @@ public async Task ConnectCallback_UseMemoryBuffer_Success(bool useSsl) [ActiveIssue("https://github.com/dotnet/runtime/issues/44183", TestPlatforms.Windows)] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_UseUnixDomainSocket_Success(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -2726,7 +2711,6 @@ public async Task ConnectCallback_UseUnixDomainSocket_Success(bool useSsl) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_ConnectionPrefix_Success(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -2856,7 +2840,6 @@ public async Task ConnectCallback_ReturnsNull_ThrowsHttpRequestException(bool us [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_SslStream_OK(bool useSslStream) { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -2905,7 +2888,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_DerivedSslStream_OK() { await LoopbackServerFactory.CreateClientAndServerAsync( @@ -2950,7 +2932,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ConnectCallback_NoAlpn_OK() { // Create HTTP 1.1 loopback. Http2 should downgrade @@ -3161,7 +3142,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_SimpleDelegatingStream_Success(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -3205,7 +3185,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_ConnectionPrefix_Success(bool useSsl) { byte[] RequestPrefix = "request prefix\r\n"u8.ToArray(); @@ -3286,7 +3265,6 @@ public async Task PlaintextStreamFilter_ConnectionPrefix_Success(bool useSsl) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_ExceptionDuringCallback_ThrowsHttpRequestExceptionWithInnerException(bool useSsl) { Exception e = new Exception("hello!"); @@ -3328,7 +3306,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_ReturnsNull_ThrowsHttpRequestException(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -3373,7 +3350,6 @@ public SocketsHttpHandlerTest_PlaintextStreamFilter_Http11(ITestOutputHelper out [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_CustomStream_Success(bool useSsl) { GenericLoopbackOptions options = new GenericLoopbackOptions() { UseSsl = useSsl }; @@ -3421,7 +3397,6 @@ await LoopbackServerFactory.CreateClientAndServerAsync( [Theory] [InlineData(false)] [InlineData(true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PlaintextStreamFilter_Logging_Success(bool useSsl) { bool log = int.TryParse(Environment.GetEnvironmentVariable("DOTNET_TEST_SOCKETSHTTPHANDLERLOG"), out int value) && value == 1; @@ -3663,7 +3638,6 @@ public SocketsHttpHandler_RequestContentLengthMismatchTest(ITestOutputHelper out [InlineData(1, 0)] [InlineData(1, 2)] [InlineData(2, 1)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task ContentLength_DoesNotMatchRequestContentLength_Throws(int contentLength, int bytesSent) { await LoopbackServerFactory.CreateClientAndServerAsync(async uri => diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs index 67a6d5451d9d1c..654238067b0500 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net.Test.Common; using System.Threading.Tasks; +using Microsoft.DotNet.XUnitExtensions; using Xunit; using Xunit.Abstractions; @@ -25,9 +26,8 @@ from useAuth in BoolValues from host in Hosts(scheme) select new object[] { scheme, useSsl, useAuth, host }; - [Theory] + [ConditionalTheory] [MemberData(nameof(TestLoopbackAsync_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task TestLoopbackAsync(string scheme, bool useSsl, bool useAuth, string host) { if (useSsl && UseVersion == HttpVersion.Version20 && !PlatformDetection.SupportsAlpn) @@ -35,6 +35,11 @@ public async Task TestLoopbackAsync(string scheme, bool useSsl, bool useAuth, st return; } + if (PlatformDetection.IsAndroid && useSsl && host == "::1") + { + throw new SkipTestException("IPv6 loopback with SSL doesn't work on Android"); + } + await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index 8d686b8343d4ed..5765ff1772b96a 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -6,7 +6,16 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX true + + true + + + + + PreserveNewest + + From b1806a162a5253f61b3501d58823e60e5ec46448 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 7 Jul 2022 11:29:18 +0200 Subject: [PATCH 12/39] Try fixing failing test --- .../ServerAsyncAuthenticateTest.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 7dd52bd2d66398..b686b2e331f0d8 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -47,8 +47,7 @@ public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProto [MemberData(nameof(ProtocolMismatchData))] public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( SslProtocols clientProtocol, - SslProtocols serverProtocol, - Type expectedException) + SslProtocols serverProtocol) { Exception e = await Record.ExceptionAsync( () => @@ -60,7 +59,18 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( }); Assert.NotNull(e); - Assert.IsAssignableFrom(expectedException, e); + + if (PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process)) + { + Assert.True( + e is AuthenticationException || e is System.IO.IOException, + $"the exception should be either AuthenticationException or IOException and not {e.GetType().FullName}" + ); + } + else + { + Assert.IsType(e); + } } [Theory] @@ -336,7 +346,7 @@ public static IEnumerable ProtocolMismatchData() if (clientProtocol != serverProtocol) { - yield return new object[] { clientProtocol, serverProtocol, typeof(AuthenticationException) }; + yield return new object[] { clientProtocol, serverProtocol }; } } } From 7f2e0e3638e3aa33362eba61ef315e061c9a87ee Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 7 Jul 2022 15:49:07 +0200 Subject: [PATCH 13/39] Skip failing test --- .../tests/FunctionalTests/SocketsHttpHandlerTest.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 4efa7b32dbd47e..bad5a0d0201504 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -2310,6 +2310,11 @@ public async Task Http2_MultipleConnectionsEnabled_InfiniteRequestsCompletelyBlo [ConditionalFact(nameof(SupportsAlpn))] public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnections_Success() { + if (PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process)) + { + throw new SkipTestException("Test fails on Android x64 and x86"); + } + const int MaxConcurrentStreams = 2; using Http2LoopbackServer server = Http2LoopbackServer.CreateServer(); using SocketsHttpHandler handler = CreateHandler(); From c2615af371ef595ce8c8200d28d393ff7530294b Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 7 Jul 2022 16:18:17 +0200 Subject: [PATCH 14/39] Add missing using --- .../tests/FunctionalTests/SocketsHttpHandlerTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index bad5a0d0201504..090c4175d74274 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -17,6 +17,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; using Xunit; using Xunit.Abstractions; From a895adb432f42ce89da0c37c1bdde047adb94440 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 11 Jul 2022 11:25:36 +0200 Subject: [PATCH 15/39] Remove temporary test data --- .../System.Net.Http.Functional.Tests.csproj | 7 ----- .../res/raw/ndx_test_root_ca.pem | 19 ------------ .../testselfsignedservereku_contoso_com.pem | 30 ------------------- .../res/xml/network_security_config.xml | 10 ------- .../tests/System.Net.Requests.Tests.csproj | 7 ----- .../tests/res/raw/ndx_test_root_ca.pem | 19 ------------ .../testselfsignedservereku_contoso_com.pem | 30 ------------------- .../tests/res/xml/network_security_config.xml | 10 ------- .../System.Net.Security.Tests.csproj | 7 ----- .../FunctionalTests/res/raw/ndx_test_root_ca | 19 ------------ .../testselfsignedservereku_contoso_com.pem | 30 ------------------- .../res/xml/network_security_config.xml | 10 ------- 12 files changed, 198 deletions(-) delete mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem delete mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem delete mode 100644 src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml delete mode 100644 src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem delete mode 100644 src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem delete mode 100644 src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml delete mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca delete mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem delete mode 100644 src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index 5765ff1772b96a..bb10491c46ecf1 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -9,13 +9,6 @@ true - - - - - PreserveNewest - - diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem deleted file mode 100644 index f3b1b7732f5127..00000000000000 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/ndx_test_root_ca.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb -MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx -MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm -v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb -tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN -NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY -uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco -5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB -o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM -Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL -BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 -l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG -eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 -RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK -XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD -7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem deleted file mode 100644 index ace567381a2972..00000000000000 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu -MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe -Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz -ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk -i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 -X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp -ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl -FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp -LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa -/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy -QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj -sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX -UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU -h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC -AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G -A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA -YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e -fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg -KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz -/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt -n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 -X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs -O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 -Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy -RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V -ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt -Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml deleted file mode 100644 index 71490ea97c0b7b..00000000000000 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/res/xml/network_security_config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index cb0a2bcb359f33..a12c55f9422aa4 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -10,13 +10,6 @@ true - - - - - PreserveNewest - - diff --git a/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem b/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem deleted file mode 100644 index f3b1b7732f5127..00000000000000 --- a/src/libraries/System.Net.Requests/tests/res/raw/ndx_test_root_ca.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb -MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx -MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm -v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb -tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN -NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY -uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco -5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB -o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM -Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL -BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 -l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG -eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 -RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK -XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD -7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem deleted file mode 100644 index ace567381a2972..00000000000000 --- a/src/libraries/System.Net.Requests/tests/res/raw/testselfsignedservereku_contoso_com.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu -MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe -Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz -ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk -i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 -X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp -ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl -FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp -LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa -/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy -QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj -sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX -UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU -h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC -AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G -A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA -YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e -fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg -KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz -/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt -n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 -X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs -O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 -Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy -RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V -ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt -Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml b/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml deleted file mode 100644 index 71490ea97c0b7b..00000000000000 --- a/src/libraries/System.Net.Requests/tests/res/xml/network_security_config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index e59bc4e54272dd..d7fdccf481bbee 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -8,13 +8,6 @@ true - - - - - PreserveNewest - - diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca deleted file mode 100644 index f3b1b7732f5127..00000000000000 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/ndx_test_root_ca +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDEzCCAfugAwIBAgIQMmqZISHkNa9CRIejcKfJ0zANBgkqhkiG9w0BAQsFADAb -MRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMCAXDTE1MDEyMDE2Mzk0MFoYDzIx -MTUwMTIwMTY0OTQwWjAbMRkwFwYDVQQDExBORFggVGVzdCBSb290IENBMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsoCIqyKisENYWpW/ETxatwOs0tQm -v1J/DdvYJf5jqtAbgwkqRTkAdBoz+Qm8qp1iG7JOs/Kbm+Pg3dX2t3WAm6INViwb -tbO9tZXg1l/JIobzm6ydaBnlOEbV2MT4iZOYd8dAmmSFiFzUNejqZQlQEhBbCNdN -NKQkhXY3Hih6mRSIoojU+cnzufA+ljGgfZZD4IfA0nXfYhY3HeYeJd62z+4dXFZY -uaKoTnGeYVwwn5kBKs4Nu6hPUZDczXl6dJLuZpBHxB/5IxhRpiK4NFcJL+A62mco -5Cs7tnIiIPrtvV+15Sht3KNh701nuSi+iCaw+BTPMhvz+q13QWY2EkUvEQIDAQAB -o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuaSM -Cyt8HbmNrqLzId+bVu0zSbQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEL -BQADggEBAKC2zVHBZvG4JVEu/F3dIFthzR+WyCxbvfUABewlAkrQfko/JLiOJtR5 -l9gxKeSjGrrdzgumsrs1oNdDPWxwuQbvfwQr3MLSIpfrfYMJsXnDQbh3yjuhfQeG -eyrGPijJNlmyo8lBKbaNvR1MHG8/1O1+Rh2Omi8IN/IQaB8K+LrMOx/bkhyVn3N5 -RFBqrOs1HzJQ+/skvn4QxlrD/0yFwoSy6FuM+dMUDDPP6MUztD0tFNq5rPwUeaWK -XUJyKqfAtMMA6dRdeiyvm20Wj8t8cfFDMIyGynyyEkG3pVhtwh4WTdxXxc9CKyzD -7Sp7I7L/ckSl2KVdDH8BZqCp2GO1Ct0= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem b/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem deleted file mode 100644 index ace567381a2972..00000000000000 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/res/raw/testselfsignedservereku_contoso_com.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFLDCCAxSgAwIBAgIQfmtqh0j0E4xKOEtQct2gDDANBgkqhkiG9w0BAQsFADAu -MSwwKgYDVQQDDCN0ZXN0c2VsZnNpZ25lZHNlcnZlcmVrdS5jb250b3NvLmNvbTAe -Fw0xNzAxMTcxNzM3NTdaFw0zNTAxMTgwMDAwMDBaMC4xLDAqBgNVBAMMI3Rlc3Rz -ZWxmc2lnbmVkc2VydmVyZWt1LmNvbnRvc28uY29tMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA0GTseYG1nulEdl5glEttoncY7S+CKRXWTJFvgFqHlPOk -i7C8qbJz4qE/OPhjEKE5u3poVi372P5dXFhzD41TFRMtk3BA9G7IaPQx9mGClY/3 -X9fLbFJWxmsTn1dQNvpvQ4EZ6I3hUiMeJ8xADLqGYFm0Vn8izLZGAe6sa4x+xSMp -ubcz8135Bs0dnGBAU6vkJ1zfJ8IYsrXR7+r0yY4iMi7BobUVYrP/pdTm8SHroQGl -FpjMVGk/OfAkYA8g47/jLnl4ed4FjwXp22QEEAK2Nl1nXfddM9W0mcKEao5gIgLp -LBWcPoMYhKMS3wpFm64FRoL94HZE6V/uBKWIeZw9KvAl8dqTnGqy9ScnoaIgihLa -/pyeVSdLxIClgUsbuAy3/aVqKxf+diCajNii/iTHhhxe8Q/Dys9XZjV9Ahb18Jzy -QydiaBfsJOStoxfiw576YLXmYs1ZhGqEavOU6eIRiGJWUoV5HaEw3xxM2gZe+dUj -sJob10m3NbS30jpcLpcRDYUTp9i4Ds4d54RTunyDmmFDJ2WpK87m5yCkgi3htwRX -UwlBwP/vtj8QNXoJNAvUXbiCyvV2HMLjXVcQS9yikIvyJHqrX+j0HoZusNCN2BHU -h2XClkdjKuUL5cStoCWbGxQXPXxqU5ar0+rdr4cy2n5yM/sgWab8dOFFqkISX1EC -AwEAAaNGMEQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/BAQDAgWgMB0G -A1UdDgQWBBRMQJRiV8BycdZmKrBLb7yIFpCgjDANBgkqhkiG9w0BAQsFAAOCAgEA -YWsjqQkQocix7Ij0J6T9cCho1cKzSWR1dh4uuMJvThTr+As2lv5NdilGa19Ita5e -fkooIZ3cke7TNX7na5iQS/vfhh3RhnC02mvxCUdXVMwrB1nUXA8DA80d0N2KhWeg -KcsfhtYlTGUehF7nTRQNqsh5DPI1X0oW2wSjB/dXfQmbS8TyspdSoq3hc7ahBYiz -/S+IFPxpwMLi9RFYRJa0nhDEnCgoUt8sVTrbLUfQvkpbXvzelscL3yJMEP2qlRXt -n2d8khOg7ZXDUUelYm8HgLlP2UbAKs5XIIADtdgprpbav/ZMeBcqmx/YcxBE2oO2 -X9YFAvEj65NPzu+vlWkFgTL+fGk34+PFEjV/Ts0EPfdZIAD7T7Wu7efMbLvLyKZs -O8y8Wo/95jb5grpym0pjfdR5b1/o5TfTsDjE88GfgqHjvxv31VihZ1Zh5dqdErE2 -Hi8hboIDVuYRKIBc4+gf5loWWuNIL5tB3coUvGMdO1o0W+DmtkZu2CEjGrfEtjNy -RxFWKjZ4HGf8iMgBlzyb+N8k7rprEOpQ/3qzRdMciQRi2Ee49gu50YjTzqMIZR9V -ZLElXpj4kJePbJzFxrLuDy8jIOoHstyft39tH7IY6ucjH4DUQzAZO/TJKDuEHxHt -Z6W8nh15R7EEpUp6Q3vQyBMqZf2j3732r8LjKbj3jPw= ------END CERTIFICATE----- diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml b/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml deleted file mode 100644 index 71490ea97c0b7b..00000000000000 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/res/xml/network_security_config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - From cf0ae39fdba3eeadeb2a6b6551a1d8faf341bff2 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 12 Jul 2022 18:57:14 +0200 Subject: [PATCH 16/39] Relax exception type assertion for Android --- .../tests/FunctionalTests/ServerAsyncAuthenticateTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index b686b2e331f0d8..f3fe1df4a6f43c 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -60,7 +60,7 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( Assert.NotNull(e); - if (PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process)) + if (PlatformDetection.IsAndroid) { Assert.True( e is AuthenticationException || e is System.IO.IOException, From b73c45c5239b40e90f6e57b4a561791f8f41adc5 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Wed, 13 Jul 2022 19:04:07 +0200 Subject: [PATCH 17/39] Code cleanup --- .../Http/HttpClientHandlerTest.SslProtocols.cs | 2 -- .../HttpClientHandlerTest.Finalization.cs | 1 - .../HttpClientHandlerTest.Http2.cs | 16 ---------------- .../tests/System.Net.Requests.Tests.csproj | 1 - .../System.Net.Security.Tests.csproj | 1 - 5 files changed, 21 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs index aca689b2dd110c..58aaee300d336a 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs @@ -101,7 +101,6 @@ public static IEnumerable GetAsync_AllowedSSLVersion_Succeeds_MemberDa [Theory] [MemberData(nameof(GetAsync_AllowedSSLVersion_Succeeds_MemberData))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_AllowedSSLVersion_Succeeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol) { int count = 0; @@ -243,7 +242,6 @@ public async Task GetAsync_UnsupportedSSLVersion_Throws(SslProtocols sslProtocol } [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_NoSpecifiedProtocol_DefaultsToTls12() { using (HttpClientHandler handler = CreateHttpClientHandler()) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs index 9804804117a863..49989acffb36cf 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Finalization.cs @@ -26,7 +26,6 @@ private static Task GetAndDropResponse(HttpClient client, Uri url) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task IncompleteResponseStream_ResponseDropped_CancelsRequestToServer() { using (HttpClient client = CreateHttpClient()) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index 9ac335e02067c3..c519690c0835bb 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -127,7 +127,6 @@ public async Task Http2_DataSentBeforeServerPreface_ProtocolError() } [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_StreamResetByServerBeforePrefix_RequestFailsWithGoawayProtocolError() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -429,7 +428,6 @@ public async Task PostAsync_StreamRefused_RequestIsRetried() [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_SettingsFrameNotSentOnNewConnection_ClientApplies100StreamLimit() { const int DefaultMaxConcurrentStreams = 100; @@ -481,7 +479,6 @@ public async Task GetAsync_SettingsFrameNotSentOnNewConnection_ClientApplies100S [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] // TODO revisit outerloop tests public async Task GetAsync_ServerDelaysSendingSettingsThenSetsLowerMaxConcurrentStreamsLimitThenIncreaseIt_ClientAppliesEachLimitChangeProperly() { const int DefaultMaxConcurrentStreams = 100; @@ -542,7 +539,6 @@ public async Task GetAsync_ServerDelaysSendingSettingsThenSetsLowerMaxConcurrent [OuterLoop("Uses delays")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task GetAsync_ServerSendSettingsWithoutMaxConcurrentStreams_ClientAppliesInfiniteLimit() { const int DefaultMaxConcurrentStreams = 100; @@ -1592,7 +1588,6 @@ public async Task Http2_FlowControl_ClientDoesNotExceedWindows() [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_InitialWindowSize_ClientDoesNotExceedWindows() { const int ContentSize = DefaultInitialWindowSize + 1000; @@ -1813,7 +1808,6 @@ public async Task Http2_SendOverConnectionWindowSizeWithoutExplicitFlush_ClientS [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_MaxConcurrentStreams_LimitEnforced() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -1882,7 +1876,6 @@ public async Task Http2_MaxConcurrentStreams_LimitEnforced() [OuterLoop("Uses Task.Delay")] [ConditionalFact(nameof(SupportsAlpn))] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_WaitingForStream_Cancellation() { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) @@ -2017,7 +2010,6 @@ public async Task Http2_PendingSend_Cancellation() [OuterLoop("Uses Task.Delay")] [InlineData(false)] [InlineData(true)] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task Http2_PendingSend_SendsReset(bool waitForData) { var cts = new CancellationTokenSource(); @@ -2622,7 +2614,6 @@ public async Task PostAsyncDuplex_RequestContentExceptionAfterResponseEndReceive [OuterLoop("Uses Task.Delay")] [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_CancelledBeforeResponseHeadersReceived_ResetsStream() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2740,7 +2731,6 @@ public async Task PostAsyncDuplex_ServerResetsStream_Throws() [OuterLoop("Uses Task.Delay")] [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_DisposeResponseBodyBeforeEnd_ResetsStreamAndThrowsOnRequestStreamWriteAndResponseStreamRead() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2808,7 +2798,6 @@ public async Task PostAsyncDuplex_DisposeResponseBodyBeforeEnd_ResetsStreamAndTh [OuterLoop("Uses Task.Delay")] [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_DisposeResponseBodyAfterEndReceivedButBeforeConsumed_ResetsStreamAndThrowsOnRequestStreamWriteAndResponseStreamRead() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -2882,7 +2871,6 @@ public async Task PostAsyncDuplex_DisposeResponseBodyAfterEndReceivedButBeforeCo [OuterLoop("Uses Task.Delay")] [Fact] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task PostAsyncDuplex_FinishRequestBodyAndDisposeResponseBodyAfterEndReceivedButBeforeConsumed_DoesNotResetStream() { byte[] contentBytes = "Hello world"u8.ToArray(); @@ -3069,7 +3057,6 @@ public async Task PostAsyncNonDuplex_ServerCompletesResponseBodyThenResetsStream [InlineData(true, HttpStatusCode.OK)] [InlineData(false, HttpStatusCode.OK)] [OuterLoop("Uses Task.Delay")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_ConcurentSendReceive_Ok(bool shouldWaitForRequestBody, HttpStatusCode responseCode) { string requestContent = new string('*', 300); @@ -3137,7 +3124,6 @@ public async Task SendAsync_ConcurentSendReceive_Ok(bool shouldWaitForRequestBod [Fact] [OuterLoop("Uses Task.Delay")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_ConcurentSendReceive_Fail() { TaskCompletionSource tsc = new TaskCompletionSource(); @@ -3210,7 +3196,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => [Fact] [OuterLoop("Waits for seconds for events that shouldn't happen")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SendAsync_StreamContentRequestBody_WaitsForRequestBodyToComplete() { var waitToSendRequestBody = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -3473,7 +3458,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync( [Fact] [OuterLoop("Uses Task.Delay")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Android)] public async Task SocketSendQueueFull_RequestCanceled_ThrowsOperationCanceled() { TaskCompletionSource clientComplete = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index a12c55f9422aa4..868d3582b442a1 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -10,7 +10,6 @@ true - diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index 3730866da1eb03..36f81014ccf92b 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -8,7 +8,6 @@ true - From 0802f46a689a7670a5469bdafbc8ace5c046b651 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 15 Jul 2022 15:58:35 +0200 Subject: [PATCH 18/39] Fix test failures in System.Net.WebSockets.Client.Tests --- .../tests/System.Net.WebSockets.Client.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj index 56c8ad1f7f194b..8615693825d14a 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj +++ b/src/libraries/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj @@ -5,6 +5,8 @@ $(DefineConstants);NETSTANDARD false + + true From beef03112c010cdfc2afb66236c4e5f7999f8a25 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 15 Jul 2022 16:24:16 +0200 Subject: [PATCH 19/39] Remove active issue attribute --- .../System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs index 9ced9648aa3e96..87fa4d0ae2c592 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs @@ -98,7 +98,7 @@ await TestHelper.WhenAllCompletedOrAnyFailed( [OuterLoop] [ConditionalTheory(nameof(ClientSupportsDHECipherSuites))] [MemberData(nameof(InvalidCertificateServers))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68898", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] public async Task InvalidCertificateServers_CertificateValidationDisabled_Succeeds(string url) { using (HttpClientHandler handler = CreateHttpClientHandler()) From 8b3e7facec2551aca1c7eb485f5a5dac85a72a6c Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 15 Jul 2022 18:32:12 +0200 Subject: [PATCH 20/39] Remove most explicit usages of the server certificate custom validation callback in tests --- .../HttpClientHandlerTest.AcceptAllCerts.cs | 9 ++-- ...ttpClientHandlerTest.ClientCertificates.cs | 6 +-- .../Net/Http/HttpClientHandlerTest.Proxy.cs | 21 +++----- ...ttpClientHandlerTest.ServerCertificates.cs | 8 +-- .../HttpClientHandlerTest.SslProtocols.cs | 10 ++-- .../System/Net/Http/HttpClientHandlerTest.cs | 11 +--- .../tests/System/Net/Http/TestHelper.cs | 15 ++++++ .../tests/FunctionalTests/DiagnosticsTests.cs | 17 ++---- .../HttpClientHandlerTest.Http2.cs | 14 ++--- ...lientHandlerTestBase.SocketsHttpHandler.cs | 12 ++++- .../tests/FunctionalTests/HttpClientTest.cs | 9 +--- .../ResponseStreamZeroByteReadTests.cs | 7 +-- .../SocketsHttpHandlerTest.Cancellation.cs | 3 +- ...cketsHttpHandlerTest.Http2KeepAlivePing.cs | 44 ++++++--------- .../FunctionalTests/SocketsHttpHandlerTest.cs | 53 +++++++------------ .../tests/FunctionalTests/SocksProxyTest.cs | 3 +- .../tests/FunctionalTests/TelemetryTest.cs | 3 +- .../tests/ConnectTest.Http2.cs | 8 +-- 18 files changed, 100 insertions(+), 153 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs index 87fa4d0ae2c592..0c38ede8fa4a1b 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs @@ -54,11 +54,9 @@ public async Task SetDelegate_ConnectionSucceeds(SslProtocols acceptedProtocol, requestOnlyThisProtocol |= PlatformDetection.IsOSX && acceptedProtocol == SslProtocols.Tls; #pragma warning restore SYSLIB0039 - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; - if (requestOnlyThisProtocol) { handler.SslProtocols = acceptedProtocol; @@ -98,13 +96,12 @@ await TestHelper.WhenAllCompletedOrAnyFailed( [OuterLoop] [ConditionalTheory(nameof(ClientSupportsDHECipherSuites))] [MemberData(nameof(InvalidCertificateServers))] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] public async Task InvalidCertificateServers_CertificateValidationDisabled_Succeeds(string url) { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; (await client.GetAsync(url)).Dispose(); } } diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs index 69685b9f40bb39..a6dd3bbe63291d 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ClientCertificates.cs @@ -68,8 +68,7 @@ public void ClientCertificates_ClientCertificateOptionsAutomatic_ThrowsException private HttpClient CreateHttpClientWithCert(X509Certificate2 cert) { - HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); Assert.NotNull(cert); handler.ClientCertificates.Add(cert); Assert.True(handler.ClientCertificates.Contains(cert)); @@ -188,10 +187,9 @@ await LoopbackServer.CreateServerAsync(async (server, url) => [InlineData(ClientCertificateOption.Automatic)] public async Task AutomaticOrManual_DoesntFailRegardlessOfWhetherClientCertsAreAvailable(ClientCertificateOption mode) { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; handler.ClientCertificateOptions = mode; await LoopbackServer.CreateServerAsync(async server => diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs index 42448b2ee1c354..bedf1ffd70c029 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs @@ -220,10 +220,9 @@ public async Task AuthenticatedProxyTunnelRequest_PostAsyncWithCreds_Success(Net }; using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create(options)) - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; handler.Proxy = new WebProxy(proxyServer.Uri) { Credentials = ConstructCredentials(cred, proxyServer.Uri, BasicAuth, wrapCredsInCache) }; using (HttpResponseMessage response = await client.PostAsync(Configuration.Http.SecureRemoteEchoServer, new StringContent(content))) @@ -296,9 +295,8 @@ public async Task AuthenticatedProxyTunnelRequest_PostAsyncWithNoCreds_Throws() using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create(options)) { - HttpClientHandler handler = CreateHttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); handler.Proxy = new WebProxy(proxyServer.Uri); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; using (HttpClient client = CreateHttpClient(handler)) { HttpRequestException e = await Assert.ThrowsAnyAsync(async () => await client.PostAsync("https://nosuchhost.invalid", new StringContent(content))); @@ -333,9 +331,8 @@ public async Task ProxyTunnelRequest_GetAsync_Success() using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create()) { - HttpClientHandler handler = CreateHttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); handler.Proxy = new WebProxy(proxyServer.Uri); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; using (HttpClient client = CreateHttpClient(handler)) { var options = new LoopbackServer.Options { UseSsl = true }; @@ -369,9 +366,8 @@ public async Task ProxyTunnelRequest_MaxConnectionsSetButDoesNotApplyToProxyConn using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create()) { - HttpClientHandler handler = CreateHttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); handler.Proxy = new WebProxy(proxyServer.Uri); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; handler.MaxConnectionsPerServer = 1; using (HttpClient client = CreateHttpClient(handler)) { @@ -424,9 +420,8 @@ public async Task ProxyTunnelRequest_OriginServerSendsProxyAuthChallenge_NoProxy using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create()) { - HttpClientHandler handler = CreateHttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); handler.Proxy = new WebProxy(proxyServer.Uri) { Credentials = ConstructCredentials(new NetworkCredential("username", "password"), proxyServer.Uri, BasicAuth, true) }; - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; using (HttpClient client = CreateHttpClient(handler)) { var options = new LoopbackServer.Options { UseSsl = true }; @@ -649,11 +644,10 @@ public async Task ProxyTunnelRequest_PortSpecified_NotStrippedOffInUri(string ho await LoopbackServer.CreateClientAndServerAsync(async proxyUri => { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { handler.Proxy = new WebProxy(proxyUri); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; try { await client.GetAsync(addressUri); @@ -689,11 +683,10 @@ public async Task ProxyTunnelRequest_UserAgentHeaderAdded(bool addUserAgentHeade await LoopbackServer.CreateClientAndServerAsync(async proxyUri => { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (var client = new HttpClient(handler)) { handler.Proxy = new WebProxy(proxyUri); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; if (addUserAgentHeader) { client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Mozilla", "5.0")); diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index eccbaff23a406d..1a35d4bbe47601 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -32,7 +32,9 @@ public HttpClientHandler_ServerCertificates_Test(ITestOutputHelper output) : bas // This enables customizing ServerCertificateCustomValidationCallback in WinHttpHandler variants: protected bool AllowAllCertificates { get; set; } = true; - protected new HttpClientHandler CreateHttpClientHandler() => CreateHttpClientHandler(UseVersion, allowAllCertificates: AllowAllCertificates); + protected new HttpClientHandler CreateHttpClientHandler() => CreateHttpClientHandler( + useVersion: UseVersion, + allowAllCertificates: UseVersion >= HttpVersion20.Value && AllowAllCertificates); protected override HttpClient CreateHttpClient() => CreateHttpClient(CreateHttpClientHandler()); [Fact] @@ -282,7 +284,7 @@ private async Task UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(string [OuterLoop("Uses external servers")] [Theory] [MemberData(nameof(CertificateValidationServersAndExpectedPolicies))] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, SslPolicyErrors expectedErrors) { const int SEC_E_BUFFER_TOO_SMALL = unchecked((int)0x80090321); @@ -306,7 +308,7 @@ public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, Ss } [Fact] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] public async Task UseCallback_SelfSignedCertificate_ExpectedPolicyErrors() { using (HttpClientHandler handler = CreateHttpClientHandler()) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs index 58aaee300d336a..b7301d29f92793 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs @@ -64,10 +64,9 @@ public void SetGetProtocols_Roundtrips(SslProtocols protocols) [Fact] public async Task SetProtocols_AfterRequest_ThrowsException() { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; await LoopbackServer.CreateServerAsync(async (server, url) => { await TestHelper.WhenAllCompletedOrAnyFailed( @@ -244,11 +243,9 @@ public async Task GetAsync_UnsupportedSSLVersion_Throws(SslProtocols sslProtocol [Fact] public async Task GetAsync_NoSpecifiedProtocol_DefaultsToTls12() { - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; - var options = new LoopbackServer.Options { UseSsl = true, SslProtocols = SslProtocols.Tls12 }; await LoopbackServer.CreateServerAsync(async (server, url) => { @@ -290,11 +287,10 @@ public async Task GetAsync_AllowedClientSslVersionDiffersFromServer_ThrowsExcept return; } - using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { handler.SslProtocols = allowedClientProtocols; - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; var options = new LoopbackServer.Options { UseSsl = true, SslProtocols = acceptedServerProtocols }; await LoopbackServer.CreateServerAsync(async (server, url) => diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index 4590eebb42f5cb..daa55476615b3a 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -166,9 +166,7 @@ public async Task GetAsync_IPv6LinkLocalAddressUri_Success() return; } - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; - + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler); var options = new GenericLoopbackOptions { Address = TestHelper.GetIPv6LinkLocalAddress() }; @@ -200,12 +198,7 @@ public async Task GetAsync_IPBasedUri_Success(IPAddress address) return; } - using HttpClientHandler handler = CreateHttpClientHandler(); - if (PlatformDetection.IsNotBrowser) - { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; - } - + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler); var options = new GenericLoopbackOptions { Address = address }; diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 98c19464db941a..760271969a4288 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -163,5 +163,20 @@ public static X509Certificate2 CreateServerSelfSignedCertificate(string name = " return cert; } } + + public static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertificates = false) + { + var handler = new SocketsHttpHandler(); + + if (allowAllCertificates) + { + // On Android, it is not enough to set the custom validation callback, the certificates also need to be trusted by the OS. + // See HttpClientHandlerTestBase.SocketsHttpHandler.cs:CreateHttpClientHandler for more details. + + handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + } + + return handler; + } } } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index 3f757798ca97d2..9e4ba1739aab12 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -1138,20 +1138,9 @@ private static void AssertHeadersAreInjected(HttpRequestData request, Activity p private static async Task<(HttpRequestMessage, HttpResponseMessage)> GetAsync(string useVersion, string testAsync, Uri uri, CancellationToken cancellationToken = default, bool useSocketsHttpHandler = false) { - HttpMessageHandler handler; - if (useSocketsHttpHandler) - { - var socketsHttpHandler = new SocketsHttpHandler(); - socketsHttpHandler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; - handler = socketsHttpHandler; - } - else - { - handler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates - }; - } + HttpMessageHandler handler = useSocketsHttpHandler + ? CreateSocketsHttpHandler(allowAllCertificates: true) + : CreateHttpClientHandler(allowAllCertificates: true); using var client = new HttpClient(handler); var request = CreateRequest(HttpMethod.Get, uri, Version.Parse(useVersion), exactVersion: true); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index 88b80ce09ab9c2..61700200dd1602 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -1932,8 +1932,7 @@ public async Task Http2_WaitingOnWindowCredit_Cancellation() // to ensure the request is cancelled as expected. const int ContentSize = DefaultInitialWindowSize + 1; - HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var content = new ByteAtATimeContent(ContentSize); @@ -2248,10 +2247,9 @@ public async Task PostAsyncExpect100Continue_NonSuccessResponse_RequestBodyNotSe await Http2LoopbackServer.CreateClientAndServerAsync(async url => { - using (var handler = new SocketsHttpHandler()) + using (var handler = CreateSocketsHttpHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler)) { - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; // Increase default Expect: 100-continue timeout to ensure that we don't accidentally fire the timer and send the request body. handler.Expect100ContinueTimeout = TimeSpan.FromSeconds(300); @@ -2520,9 +2518,7 @@ public async Task ConnectAsync_ReadWriteWebSocketStream() StreamingHttpContent requestContent = new StreamingHttpContent(); - using var handler = new SocketsHttpHandler(); - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; - + using var handler = CreateSocketsHttpHandler(allowAllCertificates: true); using HttpClient client = new HttpClient(handler); HttpRequestMessage request = new(HttpMethod.Connect, server.Address); @@ -3311,9 +3307,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async url => [ConditionalFact(nameof(SupportsAlpn))] public async Task Http2_ProtocolMismatch_Throws() { - HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; - + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using (HttpClient client = CreateHttpClient()) { // Create HTTP/1.1 loopback server and advertise HTTP2 via ALPN. diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index 62aef6675f0cdf..993c57086c1964 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -34,14 +34,24 @@ protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = HttpClientHandler handler = (PlatformDetection.SupportsAlpn && useVersion != HttpVersion.Version30) ? new HttpClientHandler() : new VersionHttpClientHandler(useVersion); - if (useVersion >= HttpVersion.Version20 && allowAllCertificates) + if (allowAllCertificates) { + // On Android, it is not enough to set the custom validation callback, the certificates also need to be trusted by the OS. + // The public keys of our self-signed certificates that are used by the loopback server are part of the System.Net.TestData + // package and they can be included in a the Android test apk by adding the following property to the test's .csproj: + // + // true + // + handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; } return handler; } + protected static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertificates = false) + => TestHelper.CreateSocketsHttpHandler(allowAllCertificates); + protected Http3LoopbackServer CreateHttp3LoopbackServer(Http3Options options = default) { return new Http3LoopbackServer(options); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs index d5eb72a54ee553..7df98495bf7bda 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs @@ -225,8 +225,7 @@ public async Task GetContentAsync_WhenCannotConnect_ExceptionContainsHostInfo() { const string Host = "localhost:1234"; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = (context, token) => { @@ -1199,11 +1198,7 @@ await HttpAgnosticLoopbackServer.CreateClientAndServerAsync( VersionPolicy = versionPolicy }; - using HttpClientHandler handler = CreateHttpClientHandler(); - if (useSsl) - { - handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; - } + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSsl); using HttpClient client = CreateHttpClient(handler); client.Timeout = TimeSpan.FromSeconds(30); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs index 19caaab4404aae..3b8bfd0d75a1b5 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs @@ -96,11 +96,8 @@ public async Task ZeroByteRead_IssuesZeroByteReadOnUnderlyingStream(StreamConfor } }); - using var handler = new SocketsHttpHandler - { - ConnectCallback = delegate { return ValueTask.FromResult(httpConnection); } - }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + using var handler = TestHelper.CreateSocketsHttpHandler(allowAllCertificates: true); + handler.ConnectCallback = delegate { return ValueTask.FromResult(httpConnection); }; using var client = new HttpClient(handler); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs index 0fdd4c97771d78..7a0315186a657d 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs @@ -131,10 +131,9 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => TaskCompletionSource tcsFirstConnectionInitiated = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); TaskCompletionSource tcsFirstRequestCanceled = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - using (var handler = CreateHttpClientHandler()) + using (var handler = CreateHttpClientHandler(allowAllCertificates: true)) using (var client = CreateHttpClient(handler)) { - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; var socketsHandler = GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs index b34ad1c9696cb3..d735ad7d68f0c4 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs @@ -44,13 +44,10 @@ public async Task KeepAlivePingDelay_Infinite_NoKeepAlivePingIsSent() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { - SocketsHttpHandler handler = new SocketsHttpHandler() - { - KeepAlivePingTimeout = TimeSpan.FromSeconds(1), - KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always, - KeepAlivePingDelay = Timeout.InfiniteTimeSpan - }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + SocketsHttpHandler handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.KeepAlivePingTimeout = TimeSpan.FromSeconds(1); + handler.KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always; + handler.KeepAlivePingDelay = Timeout.InfiniteTimeSpan; using HttpClient client = new HttpClient(handler); client.DefaultRequestVersion = HttpVersion.Version20; @@ -104,13 +101,10 @@ public async Task KeepAliveConfigured_KeepAlivePingsAreSentAccordingToPolicy(Htt { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { - SocketsHttpHandler handler = new SocketsHttpHandler() - { - KeepAlivePingTimeout = TimeSpan.FromSeconds(10), - KeepAlivePingPolicy = policy, - KeepAlivePingDelay = TimeSpan.FromSeconds(1) - }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + SocketsHttpHandler handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.KeepAlivePingTimeout = TimeSpan.FromSeconds(10); + handler.KeepAlivePingPolicy = policy; + handler.KeepAlivePingDelay = TimeSpan.FromSeconds(1); using HttpClient client = new HttpClient(handler); client.DefaultRequestVersion = HttpVersion.Version20; @@ -183,13 +177,10 @@ public async Task KeepAliveConfigured_NoPingResponseDuringActiveStream_RequestSh { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { - SocketsHttpHandler handler = new SocketsHttpHandler() - { - KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5), - KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests, - KeepAlivePingDelay = TimeSpan.FromSeconds(1) - }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + SocketsHttpHandler handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5); + handler.KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests; + handler.KeepAlivePingDelay = TimeSpan.FromSeconds(1); using HttpClient client = new HttpClient(handler); client.DefaultRequestVersion = HttpVersion.Version20; @@ -233,13 +224,10 @@ public async Task HttpKeepAlivePingPolicy_Always_NoPingResponseBetweenStreams_Se { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { - SocketsHttpHandler handler = new SocketsHttpHandler() - { - KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5), - KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always, - KeepAlivePingDelay = TimeSpan.FromSeconds(1) - }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + SocketsHttpHandler handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5); + handler.KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always; + handler.KeepAlivePingDelay = TimeSpan.FromSeconds(1); using HttpClient client = new HttpClient(handler); client.DefaultRequestVersion = HttpVersion.Version20; diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index f299bcf26c7cc3..8d752106640c5e 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -1585,10 +1585,9 @@ public void ConnectionsPooledThenDisposed_NoUnobservedTaskExceptions(bool secure var releaseServer = new TaskCompletionSource(); await LoopbackServer.CreateClientAndServerAsync(async uri => { - using (var handler = new SocketsHttpHandler()) + using (var handler = CreateSocketsHttpHandler(allowAllCertificates: true)) using (HttpClient client = CreateHttpClient(handler, useVersionString)) { - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; handler.PooledConnectionLifetime = TimeSpan.FromMilliseconds(1); var exceptions = new List(); @@ -2558,8 +2557,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( requestMessage.Version = UseVersion; requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionExact; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2603,8 +2601,7 @@ public async Task ConnectCallback_BindLocalAddress_Success(bool useSsl) await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2649,8 +2646,7 @@ public async Task ConnectCallback_UseMemoryBuffer_Success(bool useSsl) Task clientTask = Task.Run(async () => { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = (context, token) => new ValueTask(clientStream); @@ -2678,8 +2674,7 @@ public async Task ConnectCallback_UseUnixDomainSocket_Success(bool useSsl) listenSocket.Bind(serverEP); listenSocket.Listen(); - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2728,8 +2723,7 @@ public async Task ConnectCallback_ConnectionPrefix_Success(bool useSsl) listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0)); listenSocket.Listen(); - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSsl); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2782,8 +2776,7 @@ public async Task ConnectCallback_StreamThrowsOnWrite_ExceptionAndStreamDisposed bool disposeCalled = false; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSsl); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = (context, token) => { @@ -2809,8 +2802,7 @@ public async Task ConnectCallback_ExceptionDuringCallback_ThrowsHttpRequestExcep { Exception e = new Exception("hello!"); - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSsl); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = (context, token) => { @@ -2829,8 +2821,7 @@ public async Task ConnectCallback_ExceptionDuringCallback_ThrowsHttpRequestExcep [InlineData(false)] public async Task ConnectCallback_ReturnsNull_ThrowsHttpRequestException(bool useSsl) { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSsl); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = (context, token) => { @@ -2852,8 +2843,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { string[] parts = uri.Authority.Split(':', 2); - HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSslStream); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2862,7 +2852,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( if (useSslStream) { SslClientAuthenticationOptions options = new SslClientAuthenticationOptions(); - options.RemoteCertificateValidationCallback = (a, b, c, d) => true; + options.RemoteCertificateValidationCallback = (a, b, c, d) => true; // TODO ??!! options.TargetHost = parts[0]; if (context.InitialRequestMessage.Version.Major == 2 && PlatformDetection.SupportsAlpn) { @@ -3116,8 +3106,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( requestMessage.Version = UseVersion; requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionExact; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = async (context, token) => { @@ -3154,8 +3143,7 @@ public async Task PlaintextStreamFilter_SimpleDelegatingStream_Success(bool useS await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = (context, token) => { @@ -3202,8 +3190,7 @@ public async Task PlaintextStreamFilter_ConnectionPrefix_Success(bool useSsl) Task clientTask = Task.Run(async () => { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = async (context, token) => { @@ -3283,8 +3270,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( requestMessage.Version = UseVersion; requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionExact; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = (context, token) => { @@ -3322,8 +3308,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( requestMessage.Version = UseVersion; requestMessage.VersionPolicy = HttpVersionPolicy.RequestVersionExact; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = (context, token) => { @@ -3362,8 +3347,7 @@ public async Task PlaintextStreamFilter_CustomStream_Success(bool useSsl) await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = (context, token) => { @@ -3414,8 +3398,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( string sendText = ""; string recvText = ""; - using HttpClientHandler handler = CreateHttpClientHandler(); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.PlaintextStreamFilter = (context, token) => { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs index 654238067b0500..b7e6995f999809 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocksProxyTest.cs @@ -44,11 +44,10 @@ await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { await using var proxy = useAuth ? new LoopbackSocksServer("DOTNET", "424242") : new LoopbackSocksServer(); - using HttpClientHandler handler = CreateHttpClientHandler(); + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler); handler.Proxy = new WebProxy($"{scheme}://127.0.0.1:{proxy.Port}"); - handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; if (useAuth) { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs index f4458d3a276ced..38785e38f45591 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs @@ -626,12 +626,11 @@ await listener.RunWithCallbackAsync(e => events.Enqueue((e, e.ActivityId)), asyn await GetFactoryForVersion(version).CreateClientAndServerAsync( async uri => { - using HttpClientHandler handler = CreateHttpClientHandler(version); + using HttpClientHandler handler = CreateHttpClientHandler(version, allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler, useVersionString); var socketsHttpHandler = GetUnderlyingSocketsHttpHandler(handler); socketsHttpHandler.MaxConnectionsPerServer = 1; - socketsHttpHandler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; // Dummy request to establish connection and ensure that the MaxConcurrentStreams setting has been acknowledged await client.GetStringAsync(uri); diff --git a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs index 23d260c87e2ffe..5dce75f9642713 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs +++ b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs @@ -11,6 +11,8 @@ using Xunit; using Xunit.Abstractions; +using static System.Net.Http.Functional.Tests.TestHelper; + namespace System.Net.WebSockets.Client.Tests { public class ConnectTest_Http2 : ClientWebSocketTestBase @@ -28,8 +30,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { clientSocket.Options.HttpVersion = HttpVersion.Version20; clientSocket.Options.HttpVersionPolicy = Http.HttpVersionPolicy.RequestVersionExact; - using var handler = new SocketsHttpHandler(); - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + using var handler = CreateSocketsHttpHandler(allowAllCertificates: true); Task t = clientSocket.ConnectAsync(uri, new HttpMessageInvoker(handler), cts.Token); var ex = await Assert.ThrowsAnyAsync(() => t); Assert.IsType(ex.InnerException); @@ -54,8 +55,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { cws.Options.HttpVersion = HttpVersion.Version20; cws.Options.HttpVersionPolicy = Http.HttpVersionPolicy.RequestVersionExact; - using var handler = new SocketsHttpHandler(); - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + using var handler = CreateSocketsHttpHandler(allowAllCertificates: true); await cws.ConnectAsync(uri, new HttpMessageInvoker(handler), cts.Token); } }, From 901ad2f7dc0d7bb5e0ffbc9c8d5d150540306e9a Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Sat, 16 Jul 2022 13:37:36 +0200 Subject: [PATCH 21/39] Fix several tests --- .../HttpClientHandlerTest.ServerCertificates.cs | 14 ++++++-------- .../HttpClientHandlerTestBase.WinHttpHandler.cs | 2 +- ...HttpClientHandlerTestBase.SocketsHttpHandler.cs | 2 +- .../FunctionalTests/SocketsHttpHandlerTest.cs | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index 1a35d4bbe47601..0d2ed94f70b8ea 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -398,15 +398,13 @@ public void HttpClientUsesSslCertEnvironmentVariables() RemoteExecutor.Invoke(async (useVersionString, allowAllCertificatesString) => { const string Url = "https://www.microsoft.com"; + var version = Version.Parse(useVersionString); + using HttpClientHandler handler = CreateHttpClientHandler( + useVersion: version, + allowAllCertificates: version >= HttpVersion20.Value && bool.Parse(allowAllCertificatesString)); + using HttpClient client = CreateHttpClient(handler, useVersionString); - HttpClientHandler handler = CreateHttpClientHandler( - Version.Parse(useVersionString), - allowAllCertificates: bool.Parse(allowAllCertificatesString)); - - using (HttpClient client = CreateHttpClient(handler, useVersionString)) - { - await Assert.ThrowsAsync(() => client.GetAsync(Url)); - } + await Assert.ThrowsAsync(() => client.GetAsync(Url)); }, UseVersion.ToString(), AllowAllCertificates.ToString(), new RemoteInvokeOptions { StartInfo = psi }).Dispose(); } } diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs index ddbfecb2b15dcd..ac482ca1f96dc8 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs @@ -10,7 +10,7 @@ public abstract partial class HttpClientHandlerTestBase : FileCleanupTestBase { protected static bool IsWinHttpHandler => true; - protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = true) + protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = false) { useVersion ??= HttpVersion.Version11; diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index 993c57086c1964..b02a4b824a38f3 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -28,7 +28,7 @@ public static bool IsQuicSupported } } - protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = true) + protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = false) { useVersion ??= HttpVersion.Version11; diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 8d752106640c5e..f73f35e14df229 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -2843,7 +2843,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( async uri => { string[] parts = uri.Authority.Split(':', 2); - HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: useSslStream); + HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); var socketsHandler = (SocketsHttpHandler)GetUnderlyingSocketsHttpHandler(handler); socketsHandler.ConnectCallback = async (context, token) => { @@ -2852,7 +2852,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync( if (useSslStream) { SslClientAuthenticationOptions options = new SslClientAuthenticationOptions(); - options.RemoteCertificateValidationCallback = (a, b, c, d) => true; // TODO ??!! + options.RemoteCertificateValidationCallback = (a, b, c, d) => true; options.TargetHost = parts[0]; if (context.InitialRequestMessage.Version.Major == 2 && PlatformDetection.SupportsAlpn) { From 03884500a611b27eb04526d2e03be8adf8fc686c Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Sat, 16 Jul 2022 13:38:43 +0200 Subject: [PATCH 22/39] Remove weird condition --- .../FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs index ac482ca1f96dc8..8d61844703acdc 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs @@ -16,7 +16,7 @@ protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion WinHttpClientHandler handler = new WinHttpClientHandler(useVersion); - if (useVersion >= HttpVersion20.Value && allowAllCertificates) + if (allowAllCertificates) { handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; } From 4ae8433aa2adca108bdb493d72bf82fcbf02f597 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 10:52:33 +0200 Subject: [PATCH 23/39] Code clean-up --- .../tests/FunctionalTests/DiagnosticsTests.cs | 4 ++-- .../tests/FunctionalTests/HttpClientMiniStressTest.cs | 9 +-------- .../tests/StressTests/HttpStress/StressClient.cs | 11 +++-------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index 9e4ba1739aab12..7dacb64476d998 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -942,8 +942,8 @@ public async Task SendAsync_CustomSocketsHttpHandlerPropagator_PropagatorIsUsed( await GetFactoryForVersion(UseVersion).CreateClientAndServerAsync( async uri => { - using var handler = new SocketsHttpHandler { ActivityHeadersPropagator = propagator }; - handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; }; + using var handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.ActivityHeadersPropagator = propagator; using var client = new HttpClient(handler); var request = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); await client.SendAsync(TestAsync, request); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs index 4149c97843b28c..de34a77496ff4e 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs @@ -95,14 +95,7 @@ public abstract class HttpClientMiniStress : HttpClientHandlerTestBase public HttpClientMiniStress(ITestOutputHelper output) : base(output) { } protected override HttpClient CreateHttpClient() => - CreateHttpClient( - new SocketsHttpHandler() - { - SslOptions = new SslClientAuthenticationOptions() - { - RemoteCertificateValidationCallback = delegate { return true; }, - } - }); + CreateHttpClient(CreateSocketsHttpHandler(allowAllCertificates: true)); [ConditionalTheory(typeof(TestEnvironment), nameof(TestEnvironment.IsStressModeEnabled))] [OuterLoop] diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index 76176390615a01..624d19e3e64966 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -54,14 +54,9 @@ HttpMessageHandler CreateHttpHandler() } else { - return new SocketsHttpHandler() - { - PooledConnectionLifetime = _config.ConnectionLifetime.GetValueOrDefault(Timeout.InfiniteTimeSpan), - SslOptions = new SslClientAuthenticationOptions - { - RemoteCertificateValidationCallback = delegate { return true; } - } - }; + SocketsHttpHandler handler = CreateSocketsHttpHandler(allowAllCertificates: true); + handler.PooledConnectionLifetime = _config.ConnectionLifetime.GetValueOrDefault(Timeout.InfiniteTimeSpan); + return handler; } } From 50d3210d83f3b26443cfada6f1b7e9b3312c58b5 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 10:53:10 +0200 Subject: [PATCH 24/39] Remove unrelated active issue attributes --- .../System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs index 5dce75f9642713..241063ab891b20 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs +++ b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs @@ -20,7 +20,7 @@ public class ConnectTest_Http2 : ClientWebSocketTestBase public ConnectTest_Http2(ITestOutputHelper output) : base(output) { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Browser)] + [SkipOnPlatform(TestPlatforms.Browser, "Self-signed certificates are not supported on browser")] public async Task ConnectAsync_VersionNotSupported_Throws() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => @@ -45,7 +45,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", TestPlatforms.Browser)] + [SkipOnPlatform(TestPlatforms.Browser, "Self-signed certificates are not supported on browser")] public async Task ConnectAsync_VersionSupported_Success() { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => From 6d0d981a54df16d1cd7686d924c3520e88749e45 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 10:59:46 +0200 Subject: [PATCH 25/39] Turn ActiveIssue attributes into permanent SkipOnPlatform --- .../FunctionalTests/CertificateValidationRemoteServer.cs | 2 +- .../tests/FunctionalTests/SslAuthenticationOptionsTest.cs | 1 - .../FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs | 5 ++++- .../tests/FunctionalTests/SslStreamNetworkStreamTest.cs | 8 ++++---- .../tests/FunctionalTests/SslStreamSniTest.cs | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs index 148dad9c29d7f2..4d32189528778c 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs @@ -94,7 +94,7 @@ public async Task DefaultConnect_EndToEnd_Ok(string host) [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "The invalid certificate is rejected by Android and the .NET validation code isn't reached")] public Task ConnectWithRevocation_WithCallback(bool checkRevocation) { X509RevocationMode mode = checkRevocation ? X509RevocationMode.Online : X509RevocationMode.NoCheck; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs index 84158ad2c4721b..0029de46bfc3b2 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslAuthenticationOptionsTest.cs @@ -121,7 +121,6 @@ public async Task ClientOptions_ServerOptions_NotMutatedDuringAuthentication() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ClientOptions_TargetHostNull_OK() { (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs index 90dcc49db8725b..04e4a2d412f2ec 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNegotiatedCipherSuiteTest.cs @@ -51,6 +51,10 @@ public class NegotiatedCipherSuiteTest private static Lazy s_cipherSuitePolicySupported = new Lazy(() => { + // see src/libraries/System.Net.Security/src/System/Net/Security/Pal.Android/SafeDeleteSslContext.cs:InitializeSslContext + if (PlatformDetection.IsAndroid) + return false; + try { new CipherSuitesPolicy(Array.Empty()); @@ -154,7 +158,6 @@ public void CipherSuitesPolicy_NothingAllowed_Fails() } [ConditionalFact(nameof(CipherSuitesPolicyAndTls13Supported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public void CipherSuitesPolicy_AllowOneOnOneSideTls13_Success() { bool hasSucceededAtLeastOnce = false; diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs index 8ab43e8732c138..4487bff4ea5234 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs @@ -492,9 +492,9 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls13))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] [InlineData(true)] [InlineData(false)] + [SkipOnPlatform(TestPlatforms.Android, "SslStream Renegotiate is not supported in SslStream on Android")] public async Task SslStream_NegotiateClientCertificateAsyncTls13_Succeeds(bool sendClientCertificate) { bool negotiateClientCertificateCalled = false; @@ -744,7 +744,7 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( [Theory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Self-signed certificates are rejected by Android before the .NET validation is reached")] public async Task SslStream_UntrustedCaWithCustomTrust_OK(bool usePartialChain) { int split = Random.Shared.Next(0, certificates.serverChain.Count - 1); @@ -798,7 +798,7 @@ public async Task SslStream_UntrustedCaWithCustomTrust_OK(bool usePartialChain) [PlatformSpecific(TestPlatforms.AnyUnix)] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Self-signed certificates are rejected by Android before the .NET validation is reached")] public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCallback) { string errorMessage; @@ -845,7 +845,7 @@ public async Task SslStream_UntrustedCaWithCustomCallback_Throws(bool customCall } [ConditionalFact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Self-signed certificates are rejected by Android before the .NET validation is reached")] public async Task SslStream_ClientCertificate_SendsChain() { List streams = new List(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs index e544b63a800427..3029be88e26fde 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSniTest.cs @@ -18,7 +18,7 @@ public class SslStreamSniTest { [Theory] [MemberData(nameof(HostNameData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Host name is not sent on Android")] public async Task SslStream_ClientSendsSNIServerReceives_Ok(string hostName) { X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); @@ -96,7 +96,7 @@ public async Task SslStream_ServerCallbackAndLocalCertificateSelectionSet_Throws [Theory] [MemberData(nameof(HostNameData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "TODO: this test would work with GetServerCertificate(). Is there something wrong with the PEMs?")] public async Task SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection(string hostName) { X509Certificate serverCert = Configuration.Certificates.GetSelfSignedServerCertificate(); From 43ad035a5a66e56e21c86b0651d9194fd18e9c58 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 11:17:07 +0200 Subject: [PATCH 26/39] Update explanation for SkipOnPlatform --- .../System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs | 2 +- .../Net/Http/HttpClientHandlerTest.ServerCertificates.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs index 0c38ede8fa4a1b..cf9af001342177 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AcceptAllCerts.cs @@ -96,7 +96,7 @@ await TestHelper.WhenAllCompletedOrAnyFailed( [OuterLoop] [ConditionalTheory(nameof(ClientSupportsDHECipherSuites))] [MemberData(nameof(InvalidCertificateServers))] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate, the custom validation callback in .NET cannot override OS behavior in the current implementation")] public async Task InvalidCertificateServers_CertificateValidationDisabled_Succeeds(string url) { using (HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true)) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index 0d2ed94f70b8ea..90de3cdee7b934 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -284,7 +284,7 @@ private async Task UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(string [OuterLoop("Uses external servers")] [Theory] [MemberData(nameof(CertificateValidationServersAndExpectedPolicies))] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate, the custom validation callback in .NET cannot override OS behavior in the current implementation")] public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, SslPolicyErrors expectedErrors) { const int SEC_E_BUFFER_TOO_SMALL = unchecked((int)0x80090321); @@ -308,7 +308,7 @@ public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, Ss } [Fact] - [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate before the .NET custom validation callback is reached")] + [SkipOnPlatform(TestPlatforms.Android, "Android rejects the certificate, the custom validation callback in .NET cannot override OS behavior in the current implementation")] public async Task UseCallback_SelfSignedCertificate_ExpectedPolicyErrors() { using (HttpClientHandler handler = CreateHttpClientHandler()) From 38ee4df68e75a6670e73a838c1d857f04175a856 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 11:57:05 +0200 Subject: [PATCH 27/39] Revert partial fix and keep active issue --- .../FunctionalTests/ServerAsyncAuthenticateTest.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index f3fe1df4a6f43c..3ba7978bde1eb5 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -45,6 +45,7 @@ public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProto [Theory] [MemberData(nameof(ProtocolMismatchData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)] public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( SslProtocols clientProtocol, SslProtocols serverProtocol) @@ -59,18 +60,7 @@ public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( }); Assert.NotNull(e); - - if (PlatformDetection.IsAndroid) - { - Assert.True( - e is AuthenticationException || e is System.IO.IOException, - $"the exception should be either AuthenticationException or IOException and not {e.GetType().FullName}" - ); - } - else - { - Assert.IsType(e); - } + Assert.IsType(e); } [Theory] From 03883b753e6c4e7fc4feced6636fa869871655aa Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 12:48:59 +0200 Subject: [PATCH 28/39] Keep active issue for android x64 and x86 --- .../tests/FunctionalTests/SocketsHttpHandlerTest.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index f73f35e14df229..6028f7c127e755 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -2307,14 +2307,12 @@ public async Task Http2_MultipleConnectionsEnabled_InfiniteRequestsCompletelyBlo } } + public static bool IsAndroidX64OrX86 => PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process); + [ConditionalFact(nameof(SupportsAlpn))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", typeof(SocketsHttpHandler_Http2_TrailingHeaders_Test), nameof(IsAndroidX64OrX86))] public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnections_Success() { - if (PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process)) - { - throw new SkipTestException("Test fails on Android x64 and x86"); - } - const int MaxConcurrentStreams = 2; using Http2LoopbackServer server = Http2LoopbackServer.CreateServer(); using SocketsHttpHandler handler = CreateHandler(); From 4ee991ef597170ff044795f60f90c5765098447f Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 14:36:49 +0200 Subject: [PATCH 29/39] Remove invalid attribute --- .../tests/FunctionalTests/SocketsHttpHandlerTest.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 6028f7c127e755..e91f9c086415a7 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -2307,10 +2307,7 @@ public async Task Http2_MultipleConnectionsEnabled_InfiniteRequestsCompletelyBlo } } - public static bool IsAndroidX64OrX86 => PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process); - [ConditionalFact(nameof(SupportsAlpn))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69870", typeof(SocketsHttpHandler_Http2_TrailingHeaders_Test), nameof(IsAndroidX64OrX86))] public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnections_Success() { const int MaxConcurrentStreams = 2; From 74970c1beda99fe69b079ca7fbab971e2062f984 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 18:08:12 +0200 Subject: [PATCH 30/39] Fix test on Browser --- .../Common/tests/System/Net/Http/HttpClientHandlerTest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index daa55476615b3a..f3ecbd32d5ab00 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -198,7 +198,10 @@ public async Task GetAsync_IPBasedUri_Success(IPAddress address) return; } - using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); + // browser doesn't support the server certificate custom validation callback + var allowAllCertificates = PlatformDetection.IsNotBrowser; + + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates); using HttpClient client = CreateHttpClient(handler); var options = new GenericLoopbackOptions { Address = address }; From caff00b11dabfbfe03825714d7a494ec499813df Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 18:15:37 +0200 Subject: [PATCH 31/39] Allow all certificates by default --- .../HttpClientHandlerTestBase.WinHttpHandler.cs | 4 ++-- .../HttpClientHandlerTestBase.SocketsHttpHandler.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs index 8d61844703acdc..0dcd401e9094b4 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs @@ -10,7 +10,7 @@ public abstract partial class HttpClientHandlerTestBase : FileCleanupTestBase { protected static bool IsWinHttpHandler => true; - protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = false) + protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = true) { useVersion ??= HttpVersion.Version11; @@ -29,7 +29,7 @@ protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion protected static WinHttpClientHandler CreateHttpClientHandler(string useVersionString) => CreateHttpClientHandler(Version.Parse(useVersionString)); - protected static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, Version version, bool exactVersion = false) => + protected static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, Version version, bool exactVersion = true) => new HttpRequestMessage(method, uri) { Version = version diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index b02a4b824a38f3..993c57086c1964 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -28,7 +28,7 @@ public static bool IsQuicSupported } } - protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = false) + protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = null, bool allowAllCertificates = true) { useVersion ??= HttpVersion.Version11; From 4f63248821e64d1d4aa9e1f3a1d99f76f17425ea Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 18 Jul 2022 20:44:07 +0200 Subject: [PATCH 32/39] Fix build --- .../Common/tests/System/Net/Http/HttpClientHandlerTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index f3ecbd32d5ab00..be53568987969a 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -201,7 +201,7 @@ public async Task GetAsync_IPBasedUri_Success(IPAddress address) // browser doesn't support the server certificate custom validation callback var allowAllCertificates = PlatformDetection.IsNotBrowser; - using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates); + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: allowAllCertificates); using HttpClient client = CreateHttpClient(handler); var options = new GenericLoopbackOptions { Address = address }; From a200ac67d50a68b617d4813f6aa1a5a4910b8a8c Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 07:14:09 +0200 Subject: [PATCH 33/39] Fix http client handler factory on Browser --- .../Common/tests/System/Net/Http/HttpClientHandlerTest.cs | 5 +---- .../HttpClientHandlerTestBase.SocketsHttpHandler.cs | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index be53568987969a..daa55476615b3a 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -198,10 +198,7 @@ public async Task GetAsync_IPBasedUri_Success(IPAddress address) return; } - // browser doesn't support the server certificate custom validation callback - var allowAllCertificates = PlatformDetection.IsNotBrowser; - - using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: allowAllCertificates); + using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler); var options = new GenericLoopbackOptions { Address = address }; diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index 993c57086c1964..24a6c21dc3d927 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -34,7 +34,8 @@ protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = HttpClientHandler handler = (PlatformDetection.SupportsAlpn && useVersion != HttpVersion.Version30) ? new HttpClientHandler() : new VersionHttpClientHandler(useVersion); - if (allowAllCertificates) + // Browser doesn't support ServerCertificateCustomValidationCallback + if (allowAllCertificates && PlatformDetection.IsNotBrowser) { // On Android, it is not enough to set the custom validation callback, the certificates also need to be trusted by the OS. // The public keys of our self-signed certificates that are used by the loopback server are part of the System.Net.TestData From 59f7e61e4c1593ad3984d9d05992e541a9b40ebe Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 07:14:32 +0200 Subject: [PATCH 34/39] Skip failing test --- .../tests/FunctionalTests/SocketsHttpHandlerTest.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index e91f9c086415a7..ac9ba3c55f5b04 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -2310,6 +2310,11 @@ public async Task Http2_MultipleConnectionsEnabled_InfiniteRequestsCompletelyBlo [ConditionalFact(nameof(SupportsAlpn))] public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnections_Success() { + if (PlatformDetection.IsAndroid && (PlatformDetection.IsX86Process || PlatformDetection.IsX64Process)) + { + throw new SkipTestException("Currently this test is failing on Android API 29 (used on Android-x64 and Android-x86 emulators)"); + } + const int MaxConcurrentStreams = 2; using Http2LoopbackServer server = Http2LoopbackServer.CreateServer(); using SocketsHttpHandler handler = CreateHandler(); From 35b9ed08ccba89a7640e2d301da2febc7e9f7f48 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 08:49:55 +0200 Subject: [PATCH 35/39] Fix net48 build --- src/libraries/Common/tests/System/Net/Http/TestHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 760271969a4288..068cdcfaa7edee 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -164,6 +164,7 @@ public static X509Certificate2 CreateServerSelfSignedCertificate(string name = " } } +#if NETCOREAPP public static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertificates = false) { var handler = new SocketsHttpHandler(); @@ -178,5 +179,6 @@ public static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertifica return handler; } +#endif } } From 8db4b45b933ddb569cac98e5117c506b8854425e Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 08:54:32 +0200 Subject: [PATCH 36/39] Revert unintentional change in WinHttpHandler tests --- .../FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs index 0dcd401e9094b4..81773638085d93 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/HttpClientHandlerTestBase.WinHttpHandler.cs @@ -29,7 +29,7 @@ protected static WinHttpClientHandler CreateHttpClientHandler(Version useVersion protected static WinHttpClientHandler CreateHttpClientHandler(string useVersionString) => CreateHttpClientHandler(Version.Parse(useVersionString)); - protected static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, Version version, bool exactVersion = true) => + protected static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, Version version, bool exactVersion = false) => new HttpRequestMessage(method, uri) { Version = version From 33d52f14d452e4e14b5ed0294add6d0fc7c3ed9e Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 18:14:41 +0200 Subject: [PATCH 37/39] Avoid using unsupported property on Browser --- src/libraries/Common/tests/System/Net/Http/TestHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 068cdcfaa7edee..438bc45f021095 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -169,7 +169,8 @@ public static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertifica { var handler = new SocketsHttpHandler(); - if (allowAllCertificates) + // Browser doesn't support ServerCertificateCustomValidationCallback + if (allowAllCertificates && TestPlatforms.IsNotBrowser) { // On Android, it is not enough to set the custom validation callback, the certificates also need to be trusted by the OS. // See HttpClientHandlerTestBase.SocketsHttpHandler.cs:CreateHttpClientHandler for more details. From 8608d46f763fb156be82b2110864ec24a2e9d589 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 18:16:32 +0200 Subject: [PATCH 38/39] Remove unnecessary default value --- .../HttpClientHandlerTestBase.SocketsHttpHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs index 24a6c21dc3d927..a372c7d372dc1b 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs @@ -50,7 +50,7 @@ protected static HttpClientHandler CreateHttpClientHandler(Version useVersion = return handler; } - protected static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertificates = false) + protected static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertificates) => TestHelper.CreateSocketsHttpHandler(allowAllCertificates); protected Http3LoopbackServer CreateHttp3LoopbackServer(Http3Options options = default) From c07330bc92298af260eef462c982358da0283ce1 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Tue, 19 Jul 2022 19:25:40 +0200 Subject: [PATCH 39/39] Avoid using unsupported property on Browser --- src/libraries/Common/tests/System/Net/Http/TestHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 438bc45f021095..93e49465b698bd 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -170,7 +170,7 @@ public static SocketsHttpHandler CreateSocketsHttpHandler(bool allowAllCertifica var handler = new SocketsHttpHandler(); // Browser doesn't support ServerCertificateCustomValidationCallback - if (allowAllCertificates && TestPlatforms.IsNotBrowser) + if (allowAllCertificates && PlatformDetection.IsNotBrowser) { // On Android, it is not enough to set the custom validation callback, the certificates also need to be trusted by the OS. // See HttpClientHandlerTestBase.SocketsHttpHandler.cs:CreateHttpClientHandler for more details.