add test for lower casing header name logic (dotnet/corefx#36708)
authorTomas Weinfurt <tweinfurt@yahoo.com>
Mon, 15 Apr 2019 22:15:32 +0000 (15:15 -0700)
committerGitHub <noreply@github.com>
Mon, 15 Apr 2019 22:15:32 +0000 (15:15 -0700)
* add test for 35164

* update SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2

* fix uwp tests

* change port from 123 to 443

Commit migrated from https://github.com/dotnet/corefx/commit/4e3b46c22cec88a1f0deaa2f594634e5553412e1

39 files changed:
src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs
src/libraries/Common/tests/System/Net/Http/Http2LoopbackServer.cs
src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs
src/libraries/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClient.SelectedSitesTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientEKUTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Asynchrony.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Authentication.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AutoRedirect.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Cancellation.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Cookies.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Decompression.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs [new file with mode: 0644]
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxConnectionsPerServer.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Proxy.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ResponseDrain.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.TrailingHeaders.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpRequestMessageTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpRetryProtocolTests.cs
src/libraries/System.Net.Http/tests/FunctionalTests/IdnaProtocolTests.cs
src/libraries/System.Net.Http/tests/FunctionalTests/PlatformHandlerTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/PostScenarioUWPTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/SchSendAuxRecordHttpTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj

index c9858cf..f644602 100644 (file)
@@ -13,14 +13,14 @@ namespace System.Net.Test.Common
 
     public abstract class LoopbackServerFactory
     {
-        public abstract Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync);
+        public abstract Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync, int millisecondsTimeout = 30_000);
 
         public abstract bool IsHttp11 { get; }
         public abstract bool IsHttp2 { get; }
 
         // Common helper methods
 
-        public Task CreateClientAndServerAsync(Func<Uri, Task> clientFunc, Func<GenericLoopbackServer, Task> serverFunc)
+        public Task CreateClientAndServerAsync(Func<Uri, Task> clientFunc, Func<GenericLoopbackServer, Task> serverFunc, int millisecondsTimeout = 30_000)
         {
             return CreateServerAsync(async (server, uri) =>
             {
@@ -28,7 +28,7 @@ namespace System.Net.Test.Common
                 Task serverTask = serverFunc(server);
 
                 await new Task[] { clientTask, serverTask }.WhenAllOrAnyFailed();
-            });
+            }).TimeoutAfter(millisecondsTimeout);
         }
     }
 
index 54a37d3..6c14210 100644 (file)
@@ -673,11 +673,11 @@ namespace System.Net.Test.Common
     {
         public static readonly Http2LoopbackServerFactory Singleton = new Http2LoopbackServerFactory();
 
-        public override async Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync)
+        public override async Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync, int millisecondsTimeout = 30_000)
         {
             using (var server = Http2LoopbackServer.CreateServer())
             {
-                await funcAsync(server, server.Address);
+                await funcAsync(server, server.Address).TimeoutAfter(millisecondsTimeout);
             }
         }
 
index 409fd11..25cdaf5 100644 (file)
@@ -685,7 +685,7 @@ namespace System.Net.Test.Common
     {
         public static readonly Http11LoopbackServerFactory Singleton = new Http11LoopbackServerFactory();
 
-        public override Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync)
+        public override Task CreateServerAsync(Func<GenericLoopbackServer, Uri, Task> funcAsync, int millisecondsTimeout = 30_000)
         {
             return LoopbackServer.CreateServerAsync((server, uri) => funcAsync(server, uri));
         }
index db011f1..3b21906 100644 (file)
@@ -36,12 +36,7 @@ namespace System.Net.Http.Functional.Tests
         private static Uri s_authenticatedServer = DomainJoinedTestsEnabled ? 
             new Uri($"http://{Configuration.Http.DomainJoinedHttpHost}/test/auth/negotiate/showidentity.ashx") : null;
 
-        private readonly ITestOutputHelper _output;
-
-        public DefaultCredentialsTest(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public DefaultCredentialsTest(ITestOutputHelper output) : base(output) { }
 
         [OuterLoop("Uses external server")]
         [ConditionalTheory(nameof(ServerAuthenticationTestsEnabled))]
index 2b07e41..dc8e57b 100644 (file)
@@ -14,6 +14,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using Microsoft.DotNet.RemoteExecutor;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -23,6 +24,8 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetEventSource is only part of .NET Core.")]
     public abstract class DiagnosticsTest : HttpClientHandlerTestBase
     {
+        public DiagnosticsTest(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public static void EventSource_ExistsWithCorrectId()
         {
index d6decc2..8009eb7 100644 (file)
@@ -8,11 +8,14 @@ using System.Reflection;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClient_SelectedSites_Test : HttpClientHandlerTestBase
     {
+        public HttpClient_SelectedSites_Test(ITestOutputHelper output) : base(output) { }
+
         public static bool IsSelectedSitesTestEnabled() 
         {
             string envVar = Environment.GetEnvironmentVariable("CORFX_NET_HTTP_SELECTED_SITES");
index e2a6cc8..81d3002 100644 (file)
@@ -10,6 +10,7 @@ using System.Security.Cryptography.X509Certificates;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -44,6 +45,8 @@ namespace System.Net.Http.Functional.Tests
 
         private VerboseTestLogging _log = VerboseTestLogging.GetInstance();
 
+        public HttpClientEKUTest(ITestOutputHelper output) : base(output) { }
+
         [ConditionalFact(nameof(CanTestCertificates))]
         public async Task HttpClient_NoEKUServerAuth_Ok()
         {
index 3fd307c..25e0016 100644 (file)
@@ -7,6 +7,7 @@ using System.Net.Test.Common;
 using System.Security.Authentication;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -16,6 +17,8 @@ namespace System.Net.Http.Functional.Tests
     {
         private static bool ClientSupportsDHECipherSuites => (!PlatformDetection.IsWindows || PlatformDetection.IsWindows10Version1607OrGreater);
 
+        public HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public void SingletonReturnsTrue()
         {
index ba18160..2239e49 100644 (file)
@@ -10,11 +10,14 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tests;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClientHandler_Asynchrony_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_Asynchrony_Test(ITestOutputHelper output) : base(output) { }
+
         public static IEnumerable<object[]> ResponseHeadersRead_SynchronizationContextNotUsedByHandler_MemberData() =>
             from responseHeadersRead in new[] { false, true }
             from contentMode in Enum.GetValues(typeof(LoopbackServer.ContentMode)).Cast<LoopbackServer.ContentMode>()
index a67331b..dd882fb 100644 (file)
@@ -19,8 +19,6 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Tests would need to be rewritten due to behavior differences with WinRT")]
     public abstract class HttpClientHandler_Authentication_Test : HttpClientHandlerTestBase
     {
-        private readonly ITestOutputHelper _output;
-
         private const string Username = "testusername";
         private const string Password = "testpassword";
         private const string Domain = "testdomain";
@@ -39,10 +37,7 @@ namespace System.Net.Http.Functional.Tests
             }
         };
 
-        public HttpClientHandler_Authentication_Test(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public HttpClientHandler_Authentication_Test(ITestOutputHelper output) : base(output) { }
 
         [Theory]
         [MemberData(nameof(Authentication_TestData))]
index 8cc5429..9a3fb6f 100644 (file)
@@ -17,7 +17,6 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class HttpClientHandlerTest_AutoRedirect : HttpClientHandlerTestBase
     {
-        readonly ITestOutputHelper _output;
         private const string ExpectedContent = "Test content";
         private const string Username = "testuser";
         private const string Password = "password";
@@ -61,10 +60,7 @@ namespace System.Net.Http.Functional.Tests
             new object[] { 308, "HEAD", "HEAD" },
         };
 
-        public HttpClientHandlerTest_AutoRedirect(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public HttpClientHandlerTest_AutoRedirect(ITestOutputHelper output) : base(output) { }
 
         [OuterLoop("Uses external server")]
         [Theory, MemberData(nameof(RedirectStatusCodes))]
index 77d4caf..9c061ad 100644 (file)
@@ -10,11 +10,14 @@ using System.Net.Test.Common;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClientHandler_Cancellation_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_Cancellation_Test(ITestOutputHelper output) : base(output) { }
+
         [Theory]
         [InlineData(false, CancellationMode.Token)]
         [InlineData(true, CancellationMode.Token)]
index 312d8bd..5d888af 100644 (file)
@@ -26,12 +26,8 @@ namespace System.Net.Http.Functional.Tests
         public bool CanTestClientCertificates =>
             CanTestCertificates && BackendSupportsCustomCertificateHandling;
 
-        public HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output) : base(output) { }
 
-        private readonly ITestOutputHelper _output;
         [Fact]
         public void ClientCertificateOptions_Default()
         {
index ed7822a..060a5ef 100644 (file)
@@ -9,6 +9,7 @@ using System.Net.Test.Common;
 using System.Threading.Tasks;
 using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -22,6 +23,8 @@ namespace System.Net.Http.Functional.Tests
 
         private const string s_simpleContent = "Hello world!";
 
+        public HttpClientHandlerTest_Cookies(ITestOutputHelper output) : base(output) { }
+
         //
         // Send cookie tests
         //
@@ -670,6 +673,8 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class HttpClientHandlerTest_Cookies_Http11 : HttpClientHandlerTestBase
     {
+        public HttpClientHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public async Task GetAsync_ReceiveMultipleSetCookieHeaders_CookieAdded()
         {
index 8af2fdb..dd1a284 100644 (file)
@@ -16,14 +16,9 @@ namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClientHandler_Decompression_Test : HttpClientHandlerTestBase
     {
-        private readonly ITestOutputHelper _output;
-
         public static readonly object[][] CompressedServers = System.Net.Test.Common.Configuration.Http.CompressedServers;
 
-        public HttpClientHandler_Decompression_Test(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public HttpClientHandler_Decompression_Test(ITestOutputHelper output) : base(output) { }
 
         public static IEnumerable<object[]> DecompressedResponse_MethodSpecified_DecompressedContentReturned_MemberData()
         {
index e9326bd..aab7480 100644 (file)
@@ -10,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Microsoft.DotNet.RemoteExecutor;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -17,6 +18,8 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_DefaultProxyCredentials_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public void Default_Get_Null()
         {
diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs
new file mode 100644 (file)
index 0000000..37921cc
--- /dev/null
@@ -0,0 +1,111 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net.Test.Common;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Xunit;
+using Xunit.Abstractions;
+
+namespace System.Net.Http.Functional.Tests
+{
+    using Configuration = System.Net.Test.Common.Configuration;
+
+    public abstract class HttpClientHandlerTest_Headers : HttpClientHandlerTestBase
+    {
+        public HttpClientHandlerTest_Headers(ITestOutputHelper output) : base(output) { }
+
+        [Fact]
+        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";
+
+            await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
+            {
+                using (var client = CreateHttpClient())
+                {
+                    var message = new HttpRequestMessage(HttpMethod.Get, uri);
+                    message.Headers.TryAddWithoutValidation("User-Agent", userAgent);
+                    (await client.SendAsync(message).ConfigureAwait(false)).Dispose();
+                }
+            },
+            async server =>
+            {
+                HttpRequestData requestData = await server.HandleRequestAsync(HttpStatusCode.OK);
+
+                string agent = requestData.GetSingleHeaderValue("User-Agent");
+                Assert.Equal(userAgent, agent);
+            });
+        }
+
+        [Fact]
+        public async Task SendAsync_SpecialCharacterHeader_Success()
+        {
+            string headerValue = "header name with underscore";
+            await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
+            {
+                using (var client = CreateHttpClient())
+                {
+                    var message = new HttpRequestMessage(HttpMethod.Get, uri);
+                    message.Headers.TryAddWithoutValidation("x-Special_name", "header name with underscore");
+                    (await client.SendAsync(message).ConfigureAwait(false)).Dispose();
+                }
+            },
+            async server =>
+            {
+                HttpRequestData requestData = await server.HandleRequestAsync(HttpStatusCode.OK);
+
+                string header = requestData.GetSingleHeaderValue("x-Special_name");
+                Assert.Equal(header, headerValue);
+            });
+        }
+
+        [OuterLoop("Uses external server")]
+        [Theory]
+        [InlineData(false)]
+        [InlineData(true)]
+        public async Task SendAsync_GetWithValidHostHeader_Success(bool withPort)
+        {
+            var m = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
+            m.Headers.Host = withPort ? Configuration.Http.SecureHost + ":443" : Configuration.Http.SecureHost;
+
+            using (HttpClient client = CreateHttpClient())
+            using (HttpResponseMessage response = await client.SendAsync(m))
+            {
+                string responseContent = await response.Content.ReadAsStringAsync();
+                _output.WriteLine(responseContent);
+                TestHelper.VerifyResponseBody(
+                    responseContent,
+                    response.Content.Headers.ContentMD5,
+                    false,
+                    null);
+            }
+        }
+
+        [OuterLoop("Uses external server")]
+        [Fact]
+        public async Task SendAsync_GetWithInvalidHostHeader_ThrowsException()
+        {
+            if (PlatformDetection.IsNetCore && (!UseSocketsHttpHandler || LoopbackServerFactory.IsHttp2))
+            {
+                // Only .NET Framework and SocketsHttpHandler with HTTP/1.x use the Host header to influence the SSL auth.
+                // Host header is not used for HTTP2
+                return;
+            }
+
+            var m = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
+            m.Headers.Host = "hostheaderthatdoesnotmatch";
+
+            using (HttpClient client = CreateHttpClient())
+            {
+                await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(m));
+            }
+        }
+    }
+}
index a82e73f..daba271 100644 (file)
@@ -8,6 +8,7 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -18,6 +19,8 @@ namespace System.Net.Http.Functional.Tests
 
         public static bool SupportsAlpn => PlatformDetection.SupportsAlpn;
 
+        public HttpClientHandlerTest_Http2(ITestOutputHelper output) : base(output) { }
+
         [ConditionalFact(nameof(SupportsAlpn))]
         public async Task Http2_ClientPreface_Sent()
         {
index df5beb4..c73c3a1 100644 (file)
@@ -9,6 +9,7 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -17,6 +18,8 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP connection management behavior is different due to WinRT")]
     public abstract class HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_MaxConnectionsPerServer_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "MaxConnectionsPerServer either returns two or int.MaxValue depending if ctor of HttpClientHandlerTest executed first. Disabling cause of random xunit execution order.")]
         public void Default_ExpectedValue()
index e4532d2..4ed05d6 100644 (file)
@@ -8,6 +8,7 @@ using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -15,6 +16,8 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { }
+
         [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not currently supported on UAP")]
         [Theory]
         [InlineData(0)]
index a0152d5..329e11f 100644 (file)
@@ -17,12 +17,7 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP HTTP stack doesn't support .Proxy property")]
     public abstract class HttpClientHandler_Proxy_Test : HttpClientHandlerTestBase
     {
-        private readonly ITestOutputHelper _output;
-        
-        public HttpClientHandler_Proxy_Test(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public HttpClientHandler_Proxy_Test(ITestOutputHelper output) : base(output) { }
 
         [ActiveIssue(32809)]
         [OuterLoop("Uses external server")]
index 596493b..3ba0fb5 100644 (file)
@@ -8,11 +8,14 @@ using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
    public abstract class HttpClientHandler_ResponseDrain_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_ResponseDrain_Test(ITestOutputHelper output) : base(output) { }
+
         protected virtual void SetResponseDrainTimeout(HttpClientHandler handler, TimeSpan time) { }
 
         [OuterLoop]
index 2216045..1a7e7e7 100644 (file)
@@ -12,6 +12,7 @@ using System.Security.Cryptography.X509Certificates;
 using System.Threading.Tasks;
 using Microsoft.DotNet.RemoteExecutor;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -24,6 +25,8 @@ namespace System.Net.Http.Functional.Tests
         private bool BackendSupportsCustomCertificateHandlingAndClientSupportsDHECipherSuites =>
             (BackendSupportsCustomCertificateHandling && ClientSupportsDHECipherSuites);
 
+        public HttpClientHandler_ServerCertificates_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)]
         public void Ctor_ExpectedDefaultPropertyValues_UapPlatform()
index 9332ae0..9100253 100644 (file)
@@ -11,6 +11,7 @@ using System.Security.Authentication;
 using System.Threading.Tasks;
 using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -20,6 +21,8 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "SslProtocols property requires .NET 4.7.2")]
     public abstract partial class HttpClientHandler_SslProtocols_Test : HttpClientHandlerTestBase
     {
+        public HttpClientHandler_SslProtocols_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public void DefaultProtocols_MatchesExpected()
         {
index f7e3678..08b436c 100644 (file)
@@ -11,6 +11,7 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -23,6 +24,8 @@ namespace System.Net.Http.Functional.Tests
         private static Frame MakeDataFrame(int streamId, byte[] data, bool endStream = false) =>
             new DataFrame(data, (endStream ? FrameFlags.EndStream : FrameFlags.None), 0, streamId);
 
+        public HttpClientHandlerTest_TrailingHeaders_Test (ITestOutputHelper output) : base(output) { }
+
         [Theory]
         [InlineData(false)]
         [InlineData(true)]
index 9ab045a..997e7b7 100644 (file)
@@ -29,7 +29,6 @@ namespace System.Net.Http.Functional.Tests
     // to separately Dispose (or have a 'using' statement) for the handler.
     public abstract class HttpClientHandlerTest : HttpClientHandlerTestBase
     {
-        readonly ITestOutputHelper _output;
         private const string ExpectedContent = "Test content";
         private const string Username = "testuser";
         private const string Password = "password";
@@ -64,12 +63,11 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
-        public HttpClientHandlerTest(ITestOutputHelper output)
+        public HttpClientHandlerTest(ITestOutputHelper output) : base(output)
         {
-            _output = output;
             if (PlatformDetection.IsFullFramework)
             {
-                // On .NET Framework, the default limit for connections/server is very low (2). 
+                // On .NET Framework, the default limit for connections/server is very low (2).
                 // On .NET Core, the default limit is higher. Since these tests run in parallel,
                 // the limit needs to be increased to avoid timeouts when running the tests.
                 System.Net.ServicePointManager.DefaultConnectionLimit = int.MaxValue;
@@ -249,48 +247,6 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
-        [OuterLoop("Uses external server")]
-        [Theory]
-        [InlineData(false)]
-        [InlineData(true)]
-        public async Task SendAsync_GetWithValidHostHeader_Success(bool withPort)
-        {
-            var m = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
-            m.Headers.Host = withPort ? Configuration.Http.SecureHost + ":123" : Configuration.Http.SecureHost;
-
-            using (HttpClient client = CreateHttpClient())
-            using (HttpResponseMessage response = await client.SendAsync(m))
-            {
-                string responseContent = await response.Content.ReadAsStringAsync();
-                _output.WriteLine(responseContent);
-                TestHelper.VerifyResponseBody(
-                    responseContent,
-                    response.Content.Headers.ContentMD5,
-                    false,
-                    null);
-            }
-        }
-
-        [OuterLoop("Uses external server")]
-        [Fact]
-        public async Task SendAsync_GetWithInvalidHostHeader_ThrowsException()
-        {
-            if (PlatformDetection.IsNetCore && (!UseSocketsHttpHandler || LoopbackServerFactory.IsHttp2))
-            {
-                // Only .NET Framework and SocketsHttpHandler with HTTP/1.x use the Host header to influence the SSL auth.
-                // Host header is not used for HTTP2
-                return;
-            }
-
-            var m = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer);
-            m.Headers.Host = "hostheaderthatdoesnotmatch";
-
-            using (HttpClient client = CreateHttpClient())
-            {
-                await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(m));
-            }
-        }
-
         [ActiveIssue(22158, TargetFrameworkMonikers.Uap)]
         [Fact]
         public async Task GetAsync_IPv6LinkLocalAddressUri_Success()
@@ -2660,29 +2616,6 @@ namespace System.Net.Http.Functional.Tests
         }
         #endregion
 
-        [Fact]
-        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";
-
-            await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
-            {
-                using (var client = CreateHttpClient())
-                {
-                    var message = new HttpRequestMessage(HttpMethod.Get, uri);
-                    message.Headers.TryAddWithoutValidation("User-Agent", userAgent);
-                    (await client.SendAsync(message).ConfigureAwait(false)).Dispose();
-                }
-            },
-            async server =>
-            {
-                HttpRequestData requestData = await server.HandleRequestAsync(HttpStatusCode.OK);
-
-                string agent = requestData.GetSingleHeaderValue("User-Agent");
-                Assert.Equal(userAgent, agent);
-            });
-        }
-
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue(11057)]
         public async Task GetAsync_InvalidUrl_ExpectedExceptionThrown()
         {
index 27639e8..129a933 100644 (file)
@@ -7,10 +7,14 @@ using System.IO;
 using System.Reflection;
 using System.Net.Test.Common;
 
+using Xunit.Abstractions;
+
 namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClientHandlerTestBase : FileCleanupTestBase
     {
+        public readonly ITestOutputHelper _output;
+
         protected virtual bool UseSocketsHttpHandler => true;
         protected virtual bool UseHttp2LoopbackServer => false;
 
@@ -19,6 +23,11 @@ namespace System.Net.Http.Functional.Tests
         protected bool IsNetfxHandler => PlatformDetection.IsWindows && PlatformDetection.IsFullFramework;
         protected bool IsUapHandler => PlatformDetection.IsWindows && PlatformDetection.IsUap;
 
+        public HttpClientHandlerTestBase(ITestOutputHelper output)
+        {
+            _output = output;
+        }
+
         protected HttpClient CreateHttpClient() => new HttpClient(CreateHttpClientHandler());
 
         protected HttpClientHandler CreateHttpClientHandler() => CreateHttpClientHandler(UseSocketsHttpHandler, UseHttp2LoopbackServer);
index 5d107a8..2394d65 100644 (file)
@@ -9,11 +9,14 @@ using System.Net.Test.Common;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
     public abstract class HttpClientMiniStress : HttpClientHandlerTestBase
     {
+        public HttpClientMiniStress(ITestOutputHelper output) : base(output) { }
+
         [ConditionalTheory(typeof(TestEnvironment), nameof(TestEnvironment.IsStressModeEnabled))]
         [MemberData(nameof(GetStressOptions))]
         public void SingleClient_ManyGets_Sync(int numRequests, int dop, HttpCompletionOption completionOption)
index 543473b..0a0577e 100644 (file)
@@ -8,6 +8,7 @@ using System.Net.Test.Common;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -16,6 +17,8 @@ namespace System.Net.Http.Functional.Tests
         protected virtual Stream GetStream(Stream s) => s;
         protected virtual Stream GetStream_ClientDisconnectOk(Stream s) => s;
 
+        public HttpProtocolTests(ITestOutputHelper output) : base(output) { }
+
         [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Uap does not support 1.0")]
         [Fact]
         public async Task GetAsync_RequestVersion10_Success()
@@ -642,6 +645,8 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class HttpProtocolTests_Dribble : HttpProtocolTests
     {
+        public HttpProtocolTests_Dribble(ITestOutputHelper output) : base(output) { }
+
         protected override Stream GetStream(Stream s) => new DribbleStream(s);
         protected override Stream GetStream_ClientDisconnectOk(Stream s) => new DribbleStream(s, true);
     }
index dd3c419..aa02d41 100644 (file)
@@ -11,6 +11,7 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -18,6 +19,8 @@ namespace System.Net.Http.Functional.Tests
     {
         Version _expectedRequestMessageVersion = !PlatformDetection.IsFullFramework ? new Version(2,0) : new Version(1, 1);
 
+        public HttpRequestMessageTest(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public void Ctor_Default_CorrectDefaults()
         {
index 4134768..5a8a526 100644 (file)
@@ -9,6 +9,7 @@ using System.Net.Test.Common;
 using System.Text;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -19,6 +20,8 @@ namespace System.Net.Http.Functional.Tests
         // Retry logic is supported by SocketsHttpHandler, CurlHandler, uap, and netfx.  Only WinHttp does not support. 
         private bool IsRetrySupported => !IsWinHttpHandler;
 
+        public HttpRetryProtocolTests(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         [ActiveIssue(26770, TargetFrameworkMonikers.NetFramework)]
         public async Task GetAsync_RetryOnConnectionClosed_Success()
index 7c073c6..aa82b32 100644 (file)
@@ -6,6 +6,7 @@ using System.Collections.Generic;
 using System.Net.Test.Common;
 using System.Threading.Tasks;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace System.Net.Http.Functional.Tests
 {
@@ -13,6 +14,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected abstract bool SupportsIdna { get; }
 
+        public IdnaProtocolTests(ITestOutputHelper output) : base(output) { }
+
         [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP does not support custom proxies.")]
         [Theory]
         [MemberData(nameof(InternationalHostNames))]
index 2720322..85f0d2f 100644 (file)
@@ -12,6 +12,8 @@ namespace System.Net.Http.Functional.Tests
 
     public class PlatformHandler_HttpClientHandler : HttpClientHandlerTestBase
     {
+        public PlatformHandler_HttpClientHandler(ITestOutputHelper output) : base(output) { }
+
         [Theory]
         [InlineData(false)]
         [InlineData(true)]
@@ -59,31 +61,37 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpClientHandler_Asynchrony_Test : HttpClientHandler_Asynchrony_Test
     {
+        public PlatformHandler_HttpClientHandler_Asynchrony_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpProtocolTests : HttpProtocolTests
     {
+        public PlatformHandler_HttpProtocolTests(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpProtocolTests_Dribble : HttpProtocolTests_Dribble
     {
+        public PlatformHandler_HttpProtocolTests_Dribble(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_DiagnosticsTest : DiagnosticsTest
     {
+        public PlatformHandler_DiagnosticsTest(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClient_SelectedSites_Test : HttpClient_SelectedSites_Test
     {
+        public PlatformHandler_HttpClient_SelectedSites_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClientEKUTest : HttpClientEKUTest
     {
+        public PlatformHandler_HttpClientEKUTest(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
@@ -96,6 +104,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test
     {
+        public PlatformHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 #endif
@@ -108,16 +117,19 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandler_DefaultProxyCredentials_Test
     {
+        public PlatformHandler_HttpClientHandler_DefaultProxyCredentials_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientHandler_MaxConnectionsPerServer_Test
     {
+        public PlatformHandler_HttpClientHandler_MaxConnectionsPerServer_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClientHandler_ServerCertificates_Test : HttpClientHandler_ServerCertificates_Test
     {
+        public PlatformHandler_HttpClientHandler_ServerCertificates_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
@@ -135,6 +147,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpClientHandler_SslProtocols_Test : HttpClientHandler_SslProtocols_Test
     {
+        public PlatformHandler_HttpClientHandler_SslProtocols_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
@@ -152,6 +165,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpClientMiniStress : HttpClientMiniStress
     {
+        public PlatformHandler_HttpClientMiniStress(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
@@ -175,6 +189,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_IdnaProtocolTests : IdnaProtocolTests
     {
+        public PlatformHandler_IdnaProtocolTests(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
         // WinHttp on Win7 does not support IDNA
         protected override bool SupportsIdna => !PlatformDetection.IsWindows7 && !PlatformDetection.IsFullFramework;
@@ -182,26 +197,31 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class PlatformHandler_HttpRetryProtocolTests : HttpRetryProtocolTests
     {
+        public PlatformHandler_HttpRetryProtocolTests(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandlerTest_Cookies : HttpClientHandlerTest_Cookies
     {
+        public PlatformHandlerTest_Cookies(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandlerTest_Cookies_Http11 : HttpClientHandlerTest_Cookies_Http11
     {
+        public PlatformHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandler_MaxResponseHeadersLength_Test
     {
+        public PlatformHandler_HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
     public sealed class PlatformHandler_HttpClientHandler_Cancellation_Test : HttpClientHandler_Cancellation_Test
     {
+        public PlatformHandler_HttpClientHandler_Cancellation_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => false;
     }
 
index 2ff7d2a..f55450d 100644 (file)
@@ -25,8 +25,6 @@ namespace System.Net.Http.Functional.Tests
         private static readonly Uri SecureBasicAuthServerUri =
             Configuration.Http.BasicAuthUriForCreds(true, UserName, Password);
 
-        private readonly ITestOutputHelper _output;
-
         public static readonly object[][] EchoServers = Configuration.Http.EchoServers;
         public static readonly object[][] VerifyUploadServers = Configuration.Http.VerifyUploadServers;
 
@@ -37,10 +35,7 @@ namespace System.Net.Http.Functional.Tests
                     new object[] { SecureBasicAuthServerUri }
                 };
 
-        public PostScenarioTest(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public PostScenarioTest(ITestOutputHelper output) : base(output) { }
 
         [ActiveIssue(30057, TargetFrameworkMonikers.Uap)]
         [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework disposes request content after send")]
index 9e76fc2..76a3ce3 100644 (file)
@@ -18,12 +18,7 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class PostScenarioUWPTest : HttpClientHandlerTestBase
     {
-        private readonly ITestOutputHelper _output;
-
-        public PostScenarioUWPTest(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public PostScenarioUWPTest(ITestOutputHelper output) : base(output) { }
 
         [Fact]
         public void Authentication_UseStreamContent_Throws()
index 682e225..57e8a22 100644 (file)
@@ -17,12 +17,7 @@ namespace System.Net.Http.Functional.Tests
 
     public abstract class ResponseStreamTest : HttpClientHandlerTestBase
     {
-        private readonly ITestOutputHelper _output;
-        
-        public ResponseStreamTest(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public ResponseStreamTest(ITestOutputHelper output) : base(output) { }
 
         [OuterLoop("Uses external server")]
         [Theory]
index 0bf5de2..61a1a52 100644 (file)
@@ -15,12 +15,7 @@ namespace System.Net.Http.Functional.Tests
     [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "HttpsTestServer not compatible on UAP")]
     public abstract class SchSendAuxRecordHttpTest : HttpClientHandlerTestBase
     {
-        readonly ITestOutputHelper _output;
-        
-        public SchSendAuxRecordHttpTest(ITestOutputHelper output)
-        {
-            _output = output;
-        }
+        public SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { }
 
         [Fact]
         [PlatformSpecific(TestPlatforms.Windows)]
index 9a963d3..67417ab 100644 (file)
@@ -25,6 +25,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_HttpClientHandler_Asynchrony_Test(ITestOutputHelper output) : base(output) { }
+
         [OuterLoop("Relies on finalization")]
         [Fact]
         public async Task ExecutionContext_HttpConnectionLifetimeDoesntKeepContextAlive()
@@ -91,6 +93,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_HttpProtocolTests(ITestOutputHelper output) : base(output) { }
+
         [Theory]
         [InlineData("delete", "DELETE")]
         [InlineData("options", "OPTIONS")]
@@ -102,21 +106,25 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpProtocolTests_Dribble : HttpProtocolTests_Dribble
     {
+        public SocketsHttpHandler_HttpProtocolTests_Dribble(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandler_DiagnosticsTest : DiagnosticsTest
     {
+        public SocketsHttpHandler_DiagnosticsTest(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandler_HttpClient_SelectedSites_Test : HttpClient_SelectedSites_Test
     {
+        public SocketsHttpHandler_HttpClient_SelectedSites_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandler_HttpClientEKUTest : HttpClientEKUTest
     {
+        public SocketsHttpHandler_HttpClientEKUTest(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -128,6 +136,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -139,6 +148,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandler_DefaultProxyCredentials_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_DefaultProxyCredentials_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -146,6 +156,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_HttpClientHandler_MaxConnectionsPerServer_Test(ITestOutputHelper output) : base(output) { }
+
         [OuterLoop("Incurs a small delay")]
         [Theory]
         [InlineData(0)]
@@ -192,6 +204,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_ServerCertificates_Test : HttpClientHandler_ServerCertificates_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_ServerCertificates_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -206,6 +219,8 @@ namespace System.Net.Http.Functional.Tests
             s.ResponseDrainTimeout = time;
         }
 
+        public SocketsHttpHandler_HttpClientHandler_ResponseDrain_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public void MaxResponseDrainSize_Roundtrips()
         {
@@ -452,6 +467,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_SslProtocols_Test : HttpClientHandler_SslProtocols_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_SslProtocols_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -463,6 +479,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_TrailingHeaders_Test : HttpClientHandlerTest_TrailingHeaders_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_TrailingHeaders_Test(ITestOutputHelper output) : base(output) { }
         // PlatformHandlers don't support trailers.
         protected override bool UseSocketsHttpHandler => true;
     }
@@ -475,6 +492,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientMiniStress : HttpClientMiniStress
     {
+        public SocketsHttpHandler_HttpClientMiniStress(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -498,27 +516,32 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_IdnaProtocolTests : IdnaProtocolTests
     {
+        public SocketsHttpHandler_IdnaProtocolTests(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
         protected override bool SupportsIdna => true;
     }
 
     public sealed class SocketsHttpHandler_HttpRetryProtocolTests : HttpRetryProtocolTests
     {
+        public SocketsHttpHandler_HttpRetryProtocolTests(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandlerTest_Cookies : HttpClientHandlerTest_Cookies
     {
+        public SocketsHttpHandlerTest_Cookies(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandlerTest_Cookies_Http11 : HttpClientHandlerTest_Cookies_Http11
     {
+        public SocketsHttpHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     public sealed class SocketsHttpHandler_HttpClientHandler_Cancellation_Test : HttpClientHandler_Cancellation_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_Cancellation_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
 
         [Fact]
@@ -692,6 +715,7 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandler_MaxResponseHeadersLength_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
@@ -741,6 +765,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_ConnectionUpgrade_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public async Task UpgradeConnection_ReturnsReadableAndWritableStream()
         {
@@ -860,6 +886,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_Connect_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public async Task ConnectMethod_Success()
         {
@@ -948,6 +976,8 @@ namespace System.Net.Http.Functional.Tests
     {
         protected override bool UseSocketsHttpHandler => true;
 
+        public SocketsHttpHandler_HttpClientHandler_ConnectionPooling_Test(ITestOutputHelper output) : base(output) { }
+
         [Fact]
         public async Task MultipleIterativeRequests_SameConnectionReused()
         {
@@ -1567,6 +1597,8 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandler_ExternalConfiguration_Test : HttpClientHandlerTestBase
     {
+        public SocketsHttpHandler_ExternalConfiguration_Test(ITestOutputHelper output) : base(output) { }
+
         private const string EnvironmentVariableSettingName = "DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER";
         private const string AppContextSettingName = "System.Net.Http.UseSocketsHttpHandler";
 
@@ -1647,12 +1679,14 @@ namespace System.Net.Http.Functional.Tests
 
     public sealed class SocketsHttpHandlerTest_Http2 : HttpClientHandlerTest_Http2
     {
+        public SocketsHttpHandlerTest_Http2(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
     }
 
     [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
     public sealed class SocketsHttpHandlerTest_Cookies_Http2 : HttpClientHandlerTest_Cookies
     {
+        public SocketsHttpHandlerTest_Cookies_Http2(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
         protected override bool UseHttp2LoopbackServer => true;
     }
@@ -1661,7 +1695,20 @@ namespace System.Net.Http.Functional.Tests
     public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Http2 : HttpClientHandlerTest
     {
         public SocketsHttpHandlerTest_HttpClientHandlerTest_Http2(ITestOutputHelper output) : base(output) { }
+        protected override bool UseSocketsHttpHandler => true;
+        protected override bool UseHttp2LoopbackServer => true;
+    }
+
+    public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http11 : HttpClientHandlerTest_Headers
+    {
+        public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http11(ITestOutputHelper output) : base(output) { }
+        protected override bool UseSocketsHttpHandler => true;
+    }
 
+    [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
+    public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http2 : HttpClientHandlerTest_Headers
+    {
+        public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http2(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
         protected override bool UseHttp2LoopbackServer => true;
     }
@@ -1669,6 +1716,7 @@ namespace System.Net.Http.Functional.Tests
     [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
     public sealed class SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2 : HttpClientHandler_Cancellation_Test
     {
+        public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2(ITestOutputHelper output) : base(output) { }
         protected override bool UseSocketsHttpHandler => true;
         protected override bool UseHttp2LoopbackServer => true;
     }
index 8f4ce48..6003b5e 100644 (file)
     <Compile Include="HttpMessageInvokerTest.cs" />
     <Compile Include="HttpMethodTest.cs" />
     <Compile Include="HttpClientHandlerTest.Cookies.cs" />
+    <Compile Include="HttpClientHandlerTest.Headers.cs" />
     <Compile Include="HttpRetryProtocolTests.cs" />
     <Compile Include="IdnaProtocolTests.cs" />
     <Compile Include="HttpProtocolTests.cs" />