diff options
author | Martin Baulig <mabaul@microsoft.com> | 2019-10-22 20:15:32 +0300 |
---|---|---|
committer | Martin Baulig <mabaul@microsoft.com> | 2019-10-30 22:37:25 +0300 |
commit | 578e0df42f794e5d557d90f91bc4e922eddfa64c (patch) | |
tree | a99ede40a1d134b13f418f2976e9dd04cef5edf8 /mcs/class/System.Net.Http | |
parent | 27921fbbd06baadeb5fa07049c587e2a214d131f (diff) |
[System.Net.Http]: Bring `HttpClient` from CoreFX on monotouch and xammac.
Diffstat (limited to 'mcs/class/System.Net.Http')
16 files changed, 25 insertions, 21 deletions
diff --git a/mcs/class/System.Net.Http/System.Net.Http/ByteArrayContent.cs b/mcs/class/System.Net.Http/System.Net.Http/ByteArrayContent.cs index ab551ee2735..46a92e38cd2 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/ByteArrayContent.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/ByteArrayContent.cs @@ -63,7 +63,7 @@ namespace System.Net.Http return Task.FromResult<Stream> (new MemoryStream (content, offset, count)); } - protected internal override Task SerializeToStreamAsync (Stream stream, TransportContext context) + protected override Task SerializeToStreamAsync (Stream stream, TransportContext context) { return stream.WriteAsync (content, offset, count); } diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs index 3e91b2d2245..0c697b05a86 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs @@ -44,7 +44,12 @@ namespace System.Net.Http long buffer_size; TimeSpan timeout; -#if !XAMARIN_MODERN && !WASM +#if XAMARIN_MODERN + public HttpClient () + : this (CreateDefaultHandler (), true) + { + } +#elif !WASM public HttpClient () : this (new HttpClientHandler (), true) { diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.macios.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.macios.cs index fb0ca1dfbc9..120d4de4012 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.macios.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.macios.cs @@ -3,13 +3,6 @@ using System.Reflection; namespace System.Net.Http { public partial class HttpClient { -#if !MONOTOUCH_WATCH - public HttpClient () - : this (CreateDefaultHandler ()) - { - } -#endif - static HttpMessageHandler CreateDefaultHandler () { return ObjCRuntime.RuntimeOptions.GetHttpMessageHandler (); diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs index df97dc50bbc..9f40665000e 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs @@ -212,7 +212,12 @@ namespace System.Net.Http return value.Length; } - protected internal abstract Task SerializeToStreamAsync (Stream stream, TransportContext context); + internal Task SerializeToStreamAsync_internal (Stream stream, TransportContext context) + { + return SerializeToStreamAsync (stream, context); + } + + protected abstract Task SerializeToStreamAsync (Stream stream, TransportContext context); protected internal abstract bool TryComputeLength (out long length); } } diff --git a/mcs/class/System.Net.Http/System.Net.Http/MultipartContent.cs b/mcs/class/System.Net.Http/System.Net.Http/MultipartContent.cs index a607167548f..f97f2b523bc 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/MultipartContent.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/MultipartContent.cs @@ -122,7 +122,7 @@ namespace System.Net.Http base.Dispose (disposing); } - protected internal override async Task SerializeToStreamAsync (Stream stream, TransportContext context) + protected override async Task SerializeToStreamAsync (Stream stream, TransportContext context) { // RFC 2046 // @@ -156,7 +156,7 @@ namespace System.Net.Http sb.Clear (); await stream.WriteAsync (buffer, 0, buffer.Length).ConfigureAwait (false); - await c.SerializeToStreamAsync (stream, context).ConfigureAwait (false); + await c.SerializeToStreamAsync_internal (stream, context).ConfigureAwait (false); if (i != nested_content.Count - 1) { sb.Append ('\r').Append ('\n'); diff --git a/mcs/class/System.Net.Http/System.Net.Http/StreamContent.cs b/mcs/class/System.Net.Http/System.Net.Http/StreamContent.cs index b8c27858a26..151a8c37505 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/StreamContent.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/StreamContent.cs @@ -87,7 +87,7 @@ namespace System.Net.Http base.Dispose (disposing); } - protected internal override Task SerializeToStreamAsync (Stream stream, TransportContext context) + protected override Task SerializeToStreamAsync (Stream stream, TransportContext context) { if (contentCopied) { if (!content.CanSeek) { diff --git a/mcs/class/System.Net.Http/corefx/ReadOnlyMemoryContent.cs b/mcs/class/System.Net.Http/corefx/ReadOnlyMemoryContent.cs index f4272bfb550..d20989108b0 100644 --- a/mcs/class/System.Net.Http/corefx/ReadOnlyMemoryContent.cs +++ b/mcs/class/System.Net.Http/corefx/ReadOnlyMemoryContent.cs @@ -7,7 +7,7 @@ namespace System.Net.Http public sealed partial class ReadOnlyMemoryContent : System.Net.Http.HttpContent { public ReadOnlyMemoryContent(System.ReadOnlyMemory<byte> content) => throw new PlatformNotSupportedException(); - protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) => throw new PlatformNotSupportedException(); + protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) => throw new PlatformNotSupportedException(); protected internal override bool TryComputeLength(out long length) => throw new PlatformNotSupportedException(); } }
\ No newline at end of file diff --git a/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.exclude.sources new file mode 100644 index 00000000000..c1788b13bf2 --- /dev/null +++ b/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.exclude.sources @@ -0,0 +1 @@ +HttpClient.DefaultHandler.cs diff --git a/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.sources index f4de7b4ea31..6e2a208bb38 100644 --- a/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.sources +++ b/mcs/class/System.Net.Http/monotouch_System.Net.Http.dll.sources @@ -1,2 +1,2 @@ -#include legacy.sources +#include socketshandler.sources System.Net.Http/HttpClient.macios.cs diff --git a/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.exclude.sources new file mode 100644 index 00000000000..b5624e526e5 --- /dev/null +++ b/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.exclude.sources @@ -0,0 +1 @@ +#include monotouch_System.Net.Http.dll.exclude.sources diff --git a/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.sources index f4de7b4ea31..6a31559fcac 100644 --- a/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.sources +++ b/mcs/class/System.Net.Http/monotouch_tv_System.Net.Http.dll.sources @@ -1,2 +1 @@ -#include legacy.sources -System.Net.Http/HttpClient.macios.cs +#include monotouch_System.Net.Http.dll.sources diff --git a/mcs/class/System.Net.Http/socketshandler.sources b/mcs/class/System.Net.Http/socketshandler.sources index e8622eafe6c..6b7824fe915 100644 --- a/mcs/class/System.Net.Http/socketshandler.sources +++ b/mcs/class/System.Net.Http/socketshandler.sources @@ -8,8 +8,6 @@ HttpRequestMessage.Mono.cs IMonoHttpClientHandler.cs MonoWebRequestHandler.cs -../corlib/System.Diagnostics/Debug.cs - corefx/SocketsHttpHandler.Mono.cs corefx/NetEventSource.Http.cs diff --git a/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.exclude.sources new file mode 100644 index 00000000000..b5624e526e5 --- /dev/null +++ b/mcs/class/System.Net.Http/xammac_System.Net.Http.dll.exclude.sources @@ -0,0 +1 @@ +#include monotouch_System.Net.Http.dll.exclude.sources 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 f4de7b4ea31..6e2a208bb38 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,2 +1,2 @@ -#include legacy.sources +#include socketshandler.sources System.Net.Http/HttpClient.macios.cs diff --git a/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.exclude.sources new file mode 100644 index 00000000000..b5624e526e5 --- /dev/null +++ b/mcs/class/System.Net.Http/xammac_net_4_5_System.Net.Http.dll.exclude.sources @@ -0,0 +1 @@ +#include monotouch_System.Net.Http.dll.exclude.sources 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 f4de7b4ea31..6e2a208bb38 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,2 +1,2 @@ -#include legacy.sources +#include socketshandler.sources System.Net.Http/HttpClient.macios.cs |