diff options
author | Rolf Bjarne Kvinge <rolf@xamarin.com> | 2016-03-15 15:29:33 +0300 |
---|---|---|
committer | Rodrigo Kumpera <kumpera@gmail.com> | 2016-03-29 01:51:36 +0300 |
commit | 188ec88f3090c4c80911283b1bf4da798fbd3802 (patch) | |
tree | 2ee283920c523eb121501f0afb48af1741119fa5 /mcs/class/System.Net.Http | |
parent | 4c368c394e0d1aba39235e32a49c1feb32a42876 (diff) |
Extend HttpClient to use infrastructure in Xamarin.Mac (via reflection) to pick right type.
List of original contributors:
Chris Hamons <chris.hamons@xamarin.com>
Diffstat (limited to 'mcs/class/System.Net.Http')
3 files changed, 25 insertions, 0 deletions
diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.mac.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.mac.cs new file mode 100644 index 00000000000..42f664c0ed3 --- /dev/null +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.mac.cs @@ -0,0 +1,23 @@ +using System; +using System.Reflection; + +[assembly:System.Runtime.CompilerServices.InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] + +namespace System.Net.Http { + public partial class HttpClient { + + public HttpClient () + : this (GetDefaultHandler (), true) + { + } + + // note: the linker will re-write ObjCRuntime.RuntimeOptions.GetHttpMessageHandler to return the correct type + // unlike, XI where this method itself gets rewritten during linking + static HttpMessageHandler GetDefaultHandler () + { + Type type = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.Mac"); + var method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic); + return (HttpMessageHandler)method.Invoke (null, null); + } + } +} diff --git a/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.sources index fbffe9e7634..216e48da9cd 100644 --- a/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.sources +++ b/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.sources @@ -1 +1,2 @@ #include System.Net.Http.dll.sources +System.Net.Http/HttpClient.mac.cs diff --git a/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.sources index fbffe9e7634..216e48da9cd 100644 --- a/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.sources +++ b/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.sources @@ -1 +1,2 @@ #include System.Net.Http.dll.sources +System.Net.Http/HttpClient.mac.cs |