X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Net.Http%2FSystem.Net.Http%2FHttpClient.cs;h=3880d418dca1fd5c6821f258429359df1862da73;hb=4f673eac7495cf6ce6520bcbf6901a4ba60e6bb5;hp=fc17d4cc95b464a717861d416a4595340e790892;hpb=a9e3b263440ad85c40dd7c4b9aef71bfd9dd8b66;p=mono.git 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 fc17d4cc95b..3880d418dca 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs @@ -33,7 +33,7 @@ using System.IO; namespace System.Net.Http { - public class HttpClient : HttpMessageInvoker + public partial class HttpClient : HttpMessageInvoker { static readonly TimeSpan TimeoutDefault = TimeSpan.FromSeconds (100); @@ -44,10 +44,12 @@ namespace System.Net.Http long buffer_size; TimeSpan timeout; +#if !XAMARIN_MODERN public HttpClient () : this (new HttpClientHandler (), true) { } +#endif public HttpClient (HttpMessageHandler handler) : this (handler, true) @@ -94,7 +96,7 @@ namespace System.Net.Http return timeout; } set { - if (value != System.Threading.Timeout.InfiniteTimeSpan && value < TimeSpan.Zero) + if (value != System.Threading.Timeout.InfiniteTimeSpan && (value <= TimeSpan.Zero || value.TotalMilliseconds > int.MaxValue)) throw new ArgumentOutOfRangeException (); timeout = value; @@ -242,16 +244,17 @@ namespace System.Net.Http if (request.SetIsUsed ()) throw new InvalidOperationException ("Cannot send the same request message multiple times"); - if (request.RequestUri == null) { + var uri = request.RequestUri; + if (uri == null) { if (base_address == null) throw new InvalidOperationException ("The request URI must either be an absolute URI or BaseAddress must be set"); request.RequestUri = base_address; - } else if (!request.RequestUri.IsAbsoluteUri) { + } else if (!uri.IsAbsoluteUri || uri.Scheme == Uri.UriSchemeFile && uri.OriginalString.StartsWith ("/", StringComparison.Ordinal)) { if (base_address == null) throw new InvalidOperationException ("The request URI must either be an absolute URI or BaseAddress must be set"); - request.RequestUri = new Uri (base_address, request.RequestUri); + request.RequestUri = new Uri (base_address, uri); } if (headers != null) {