You've already forked linux-packaging-mono
Imported Upstream version 4.4.0.142
Former-commit-id: 08ca4d6ded648b2ac2eb817c12d5723b52edbb16
This commit is contained in:
@ -6,6 +6,9 @@ LIBRARY = System.Net.Http.dll
|
||||
|
||||
LIB_REFS = System.Core System
|
||||
LIB_MCS_FLAGS = $(EXTRA_LIB_MCS_FLAGS)
|
||||
ifeq (monodroid,$(PROFILE))
|
||||
LIB_MCS_FLAGS += -d:XAMARIN_MODERN
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = -r:System.dll -r:System.Core.dll
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Net.Http {
|
||||
public partial class HttpClient {
|
||||
|
||||
public HttpClient ()
|
||||
: this (GetDefaultHandler (), true)
|
||||
{
|
||||
}
|
||||
|
||||
static HttpMessageHandler GetDefaultHandler ()
|
||||
{
|
||||
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
|
||||
if (type == null)
|
||||
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
|
||||
|
||||
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (method == null)
|
||||
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
|
||||
|
||||
object ret = method.Invoke (null, null);
|
||||
if (ret == null)
|
||||
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
|
||||
|
||||
var handler = ret as HttpMessageHandler;
|
||||
if (handler == null)
|
||||
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
|
||||
return handler;
|
||||
}
|
||||
|
||||
static HttpMessageHandler GetFallback (string message)
|
||||
{
|
||||
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
|
||||
return new HttpClientHandler ();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
#include System.Net.Http.dll.sources
|
||||
System.Net.Http/HttpClient.android.cs
|
Reference in New Issue
Block a user