Imported Upstream version 6.6.0.124

Former-commit-id: 4972203499aaaca002bdc1753d2aa65dc5f58e09
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-10-12 09:01:41 +00:00
parent dfcb8ecdef
commit 159f424ee6
55 changed files with 87 additions and 72 deletions

View File

@@ -8,7 +8,7 @@ namespace System.Net.Test.Common
{
public static partial class Http
{
private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
public static string Host => GetValue("COREFX_HTTPHOST", DefaultAzureServer);

View File

@@ -8,7 +8,7 @@ namespace System.Net.Test.Common
{
public static partial class Security
{
private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
public static string ActiveDirectoryName => GetValue("COREFX_NET_AD_DOMAINNAME");

View File

@@ -7,7 +7,7 @@ namespace System.Net.Test.Common
public static partial class Configuration
{
#pragma warning disable 414
private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
#pragma warning restore 414
private static string GetValue(string envName, string defaultValue=null)

View File

@@ -311,6 +311,7 @@ namespace System.Net.Http.Functional.Tests
}
}
[ActiveIssue(41108)]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP doesn't allow revocation checking to be turned off")]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(ClientSupportsDHECipherSuites), nameof(BackendSupportsX509Chain))]

View File

@@ -1 +1 @@
cc1cfeb44a4adae22fa22fc188bb8c257b167b20
032cfaa560174c072bd4bc0f83345039e97fdeb9

View File

@@ -456,31 +456,35 @@ namespace System.Net.Tests
[InlineData(false)]
[InlineData(true)]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #19225")]
public void KeepAlive_CorrectConnectionHeaderSent(bool? keepAlive)
public async Task KeepAlive_CorrectConnectionHeaderSent(bool? keepAlive)
{
HttpWebRequest request = WebRequest.CreateHttp(Test.Common.Configuration.Http.RemoteEchoServer);
if (keepAlive.HasValue)
await LoopbackServer.CreateServerAsync(async (server, url) =>
{
request.KeepAlive = keepAlive.Value;
}
HttpWebRequest request = WebRequest.CreateHttp(url);
request.Proxy = null; // Don't use a proxy since it might interfere with the Connection: headers.
if (keepAlive.HasValue)
{
request.KeepAlive = keepAlive.Value;
}
using (var response = (HttpWebResponse)request.GetResponse())
using (var body = new StreamReader(response.GetResponseStream()))
{
string content = body.ReadToEnd();
Task<WebResponse> getResponseTask = request.GetResponseAsync();
Task<List<string>> serverTask = server.AcceptConnectionSendResponseAndCloseAsync();
await TaskTimeoutExtensions.WhenAllOrAnyFailed(new Task[] { getResponseTask, serverTask });
List<string> requestLines = await serverTask;
if (!keepAlive.HasValue || keepAlive.Value)
{
// Validate that the request doesn't contain Connection: "close", but we can't validate
// that it does contain Connection: "keep-alive", as that's optional as of HTTP 1.1.
Assert.DoesNotContain("\"Connection\": \"close\"", content, StringComparison.OrdinalIgnoreCase);
// Validate that the request doesn't contain "Connection: close", but we can't validate
// that it does contain "Connection: Keep-Alive", as that's optional as of HTTP 1.1.
Assert.DoesNotContain("Connection: close", requestLines, StringComparer.OrdinalIgnoreCase);
}
else
{
Assert.Contains("\"Connection\": \"close\"", content, StringComparison.OrdinalIgnoreCase);
Assert.DoesNotContain("\"Keep-Alive\"", content, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Connection: close", requestLines, StringComparer.OrdinalIgnoreCase);
Assert.DoesNotContain("Keep-Alive", requestLines, StringComparer.OrdinalIgnoreCase);
}
}
});
}
[Theory, MemberData(nameof(EchoServers))]

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
@@ -15,6 +16,8 @@ using Xunit;
namespace System.Net.Tests
{
using Configuration = System.Net.Test.Common.Configuration;
public class WebClientTest
{
[Fact]
@@ -393,21 +396,26 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer));
}
[OuterLoop("Networking test talking to remote server: issue #11345")]
public static IEnumerable<object[]> RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult_MemberData()
{
yield return new object[] { $"http://{Configuration.Http.Host}", true };
yield return new object[] { Configuration.Http.Host, false };
}
[OuterLoop("Uses external servers")]
[Theory]
[InlineData("http://localhost", true)]
[InlineData("localhost", false)]
[MemberData(nameof(RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult_MemberData))]
public static async Task RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult(string hostHeaderValue, bool throwsWebException)
{
var wc = new WebClient();
wc.Headers["Host"] = hostHeaderValue;
if (throwsWebException)
{
await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer));
await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(Configuration.Http.RemoteEchoServer));
}
else
{
await wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer);
await wc.DownloadStringTaskAsync(Configuration.Http.RemoteEchoServer);
}
}

View File

@@ -17,6 +17,7 @@ namespace System.Net.WebSockets.Client.Tests
{
public CloseTest(ITestOutputHelper output) : base(output) { }
[ActiveIssue(36016)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_ServerInitiatedClose_Success(Uri server)
@@ -194,6 +195,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
[ActiveIssue(36016)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_ServerInitiated_CanSend(Uri server)

View File

@@ -92,9 +92,9 @@ namespace System.Net.WebSockets.Client.Tests
{
Uri server = System.Net.Test.Common.Configuration.WebSockets.RemoteEchoServer;
// Send via the physical address such as "corefx-net.cloudapp.net"
// Set the Host header to logical address like "subdomain.corefx-net.cloudapp.net"
// Verify the scenario works and the remote server received "Host: subdomain.corefx-net.cloudapp.net"
// Send via the physical address such as "corefx-net-http11.azurewebsites.net"
// Set the Host header to logical address like "subdomain.corefx-net-http11.azurewebsites.net"
// Verify the scenario works and the remote server received "Host: subdomain.corefx-net-http11.azurewebsites.net"
string logicalHost = "subdomain." + server.Host;
using (var cws = new ClientWebSocket())