diff options
Diffstat (limited to 'mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs')
-rw-r--r-- | mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs b/mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs index c483c28f03b..9b4fadc19f1 100644 --- a/mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs +++ b/mcs/class/System.Net.Http/HttpClientHandler.SocketsHandler.Android.cs @@ -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: // |