From: Marek Safar Date: Tue, 3 Oct 2017 14:32:15 +0000 (+0200) Subject: [System.Net.Http] Updates range check from 3741d16503a973a99c724bdab9a255a5f07a3637 X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=4f673eac7495cf6ce6520bcbf6901a4ba60e6bb5 [System.Net.Http] Updates range check from 3741d16503a973a99c724bdab9a255a5f07a3637 --- 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 c9fd2354abe..3880d418dca 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs @@ -96,7 +96,7 @@ namespace System.Net.Http return timeout; } set { - if (value != System.Threading.Timeout.InfiniteTimeSpan && (value <= TimeSpan.Zero || value.Ticks > int.MaxValue)) + if (value != System.Threading.Timeout.InfiniteTimeSpan && (value <= TimeSpan.Zero || value.TotalMilliseconds > int.MaxValue)) throw new ArgumentOutOfRangeException (); timeout = value; diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs index c87bb7562a1..c51ba6818ba 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs @@ -316,7 +316,7 @@ namespace MonoTests.System.Net.Http } try { - client.Timeout = new TimeSpan(int.MaxValue + 1L); + client.Timeout = TimeSpan.FromMilliseconds (int.MaxValue + 1L); Assert.Fail ("#3"); } catch (ArgumentOutOfRangeException) { }