bf76f2910e
Former-commit-id: 938ba563c6675baa1eb6b639367dda3872c4ffad
21 lines
858 B
C#
21 lines
858 B
C#
namespace System.Net.Http
|
|
{
|
|
partial class HttpClientHandler : HttpMessageHandler
|
|
{
|
|
static IMonoHttpClientHandler CreateDefaultHandler ()
|
|
{
|
|
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
|
|
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
|
|
return new MonoWebRequestHandler ();
|
|
// 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:
|
|
//
|
|
// var handler = new HttpClientHandler { Credentials = ... };
|
|
// var httpClient = new HttpClient (handler);
|
|
//
|
|
// AndroidHttpHandler is used only when we use the parameterless ctor of HttpClient
|
|
return new SocketsHttpHandler ();
|
|
}
|
|
}
|
|
}
|