Imported Upstream version 6.10.0.76

Former-commit-id: 7f253ed035f518a4ffbc5ce16f84e5a63ffcd26e
This commit is contained in:
Xamarin Public Jenkins (auto-signing) 2020-02-19 09:23:03 +00:00
parent 09b9e50ddf
commit 6b40127559
56 changed files with 491 additions and 409 deletions

View File

@ -1 +1 @@
a7e069795508551ef0c1be92f797265ad793f3d6
9f9b898e4abc3edb64db9402a5baee2cc49a2a28

View File

@ -1 +1 @@
7ba91b6da162e7300d892c8743d7a31590006af6
04362ca837a13dd6f8a7344a6024e79699d1e383

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ generated by GNU Autoconf 2.69. Invocation command line was
## Platform. ##
## --------- ##
hostname = az-ubuntu-general969d80
hostname = az-ubuntu-generalbbe540
uname -m = x86_64
uname -r = 4.15.0-1069-azure
uname -s = Linux
@ -747,7 +747,7 @@ generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_COMMANDS =
$ ./config.status
on az-ubuntu-general969d80
on az-ubuntu-generalbbe540
config.status:1238: creating Makefile
config.status:1238: creating bdw-gc.pc

View File

@ -1 +1 @@
90625bdaa092f23c4986a10f9885f7f2337583e4
3df9dadc1c3166829ffb002b85ded137a5868cfb

View File

@ -41,7 +41,7 @@ static partial class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "6.10.0.74";
public const string MonoVersion = "6.10.0.76";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -1,3 +1,5 @@
using System.Reflection;
namespace System.Net.Http
{
partial class HttpClientHandler : HttpMessageHandler
@ -6,7 +8,12 @@ namespace System.Net.Http
{
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
return new MonoWebRequestHandler ();
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return (IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType);
}
// Ignore other types of handlers here (e.g. AndroidHttpHandler) to keep the old behavior
// and always create SocketsHttpHandler for code like this if MonoWebRequestHandler was not specified:
//

View File

@ -70,7 +70,7 @@ namespace System.Net.Http
TimeSpan? timeout;
bool disposed;
internal MonoWebRequestHandler ()
public MonoWebRequestHandler ()
{
allowAutoRedirect = true;
maxAutomaticRedirections = 50;

View File

@ -11,10 +11,16 @@ namespace System.Net.Http {
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
if (string.IsNullOrEmpty (envvar))
return GetFallback ($"XA_HTTP_CLIENT_HANDLER_TYPE is empty");
return new HttpClientHandler ();
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
return new HttpClientHandler (new MonoWebRequestHandler ());
if (envvar?.StartsWith ("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return new HttpClientHandler ((IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType));
return new HttpClientHandler ();
}
Type handlerType = Type.GetType (envvar, false);
if (handlerType == null && !envvar.Contains (", "))
@ -25,19 +31,11 @@ namespace System.Net.Http {
}
if (handlerType == null)
return GetFallback ($"'{envvar}' type was not found");
return new HttpClientHandler ();
object handlerObj = Activator.CreateInstance (handlerType);
if (handlerObj is HttpMessageHandler msgHandler)
if (Activator.CreateInstance (handlerType) is HttpMessageHandler msgHandler)
return msgHandler;
return GetFallback ($"{handlerObj?.GetType ()} is not a valid HttpMessageHandler or MonoWebRequestHandler");
}
static HttpMessageHandler GetFallback (string message)
{
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
return new HttpClientHandler ();
}
}

View File

@ -12,6 +12,7 @@ System.Net.Http/MultipartContentTest.cs
System.Net.Http/MultipartFormDataContentTest.cs
System.Net.Http/StreamContentTest.cs
System.Net.Http/StringContentTest.cs
System.Net.Http/HttpClientHandlerTests.Android.cs
System.Net.Http.Headers/AuthenticationHeaderValueTest.cs
System.Net.Http.Headers/CacheControlHeaderValueTest.cs
System.Net.Http.Headers/ContentDispositionHeaderValueTest.cs

View File

@ -0,0 +1,77 @@
// 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;
using System.Text;
using System.Net.Http;
using System.Reflection;
using NUnit.Framework;
namespace System.Net.Http.Tests
{
[TestFixture]
public class HttpClientHandlerTestsAndroid
{
static Type GetInnerHandlerType (HttpClient httpClient)
{
BindingFlags bflasgs = BindingFlags.Instance | BindingFlags.NonPublic;
FieldInfo handlerField = typeof (HttpMessageInvoker).GetField("_handler", bflasgs);
Assert.IsNotNull (handlerField);
object handler = handlerField.GetValue (httpClient);
FieldInfo innerHandlerField = handler.GetType ().GetField ("_delegatingHandler", bflasgs);
Assert.IsNotNull (handlerField);
object innerHandler = innerHandlerField.GetValue (handler);
return innerHandler.GetType ();
}
[Test]
public void TestEnvVarSwitchForInnerHttpHandler ()
{
#if !MONODROID
return;
#endif
const string xaHandlerKey = "XA_HTTP_CLIENT_HANDLER_TYPE";
var prevHandler = Environment.GetEnvironmentVariable (xaHandlerKey);
// ""
Environment.SetEnvironmentVariable (xaHandlerKey, "");
var httpClient1 = new HttpClient ();
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient1).Name);
var handler2 = new HttpClientHandler ();
var httpClient2 = new HttpClient (handler2);
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient2).Name);
// "System.Net.Http.MonoWebRequestHandler"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.MonoWebRequestHandler");
var httpClient3 = new HttpClient ();
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient3).Name);
var handler4 = new HttpClientHandler ();
var httpClient4 = new HttpClient (handler4);
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient4).Name);
// "System.Net.Http.MonoWebRequestHandler, System.Net.Http"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.MonoWebRequestHandler, System.Net.Http");
var httpClient5 = new HttpClient ();
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient5).Name);
var handler6 = new HttpClientHandler ();
var httpClient6 = new HttpClient (handler6);
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient6).Name);
// "System.Net.Http.HttpClientHandler"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.HttpClientHandler");
var httpClient7 = new HttpClient ();
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient7).Name);
var handler8 = new HttpClientHandler ();
var httpClient8 = new HttpClient (handler8);
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient8).Name);
Environment.SetEnvironmentVariable (xaHandlerKey, prevHandler);
}
}
}

View File

@ -1,2 +1 @@
#include unit-tests.sources
HttpClientHandlerTests.Android.cs

View File

@ -1 +1 @@
c26403c6244cf774b092aea12d47ef646c97044f
520adfc1c8f0adc6d6eeda8819da60844bae4a97

View File

@ -1 +1 @@
23dae9413736051ed4377d9f190d5601b22f8844
808d4f5f827b4156a75ae5adf667fd13ae1517b6

View File

@ -1 +1 @@
f80052eb45e8ed1027e72e0c8d3f7564e9ae7b0b
cfa3c00b57465d99fe6aa46a80b93d6953031d07

View File

@ -1 +1 @@
d70b70f1f00e1a1982003f99df8e36fc513a7764
0987f9ca316821369eb7378b00b1bfa05d4245ef

View File

@ -1 +1 @@
216d30ea9837ea0059ff6bbb6ffe4f2f524c36f3
fbf0b9bb1d7b4fcf89c17aaf6c60cbbf9877fb9c

View File

@ -1 +1 @@
20734cda4db54c8989e4a14e3d647e64fae7a68e
b70b0437479bfd21ba4b185ac21b630668a2383c

View File

@ -1 +1 @@
638418ec91fa885d3f7ed4cfd106c158b694b7bd
b96e2c9e2da304516d1824be6f87b78ef66b2772

View File

@ -1 +1 @@
1dd188f78f93f0717b52df35a359e53220c8b66c
ba4197f7eeb3ee479049ac67873e77bdb3a36d32

Some files were not shown because too many files have changed in this diff Show More