diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs index 8333feb08415b..847b488be5969 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs @@ -963,9 +963,9 @@ private async Task StartRequestAsync(WinHttpRequestState state) // call of the response body data. WINHTTP_OPTION_RECEIVE_TIMEOUT sets a timeout on each // lower layer winsock read. // Timeout.InfiniteTimeSpan will be converted to uint.MaxValue milliseconds (~ 50 days). - // The result a of double->uint cast is unspecified and may differ on ARM. + // The result a of double->uint cast is unspecified and may differ on ARM, returning 0 instead of uint.MaxValue. // To handle Timeout.InfiniteTimespan correctly, we need to cast to Int32 first. - uint optionData = unchecked((uint)(int)_receiveDataTimeout.TotalMilliseconds); + uint optionData = (uint)(int)_receiveDataTimeout.TotalMilliseconds; SetWinHttpOption(state.RequestHandle, Interop.WinHttp.WINHTTP_OPTION_RECEIVE_TIMEOUT, ref optionData); HttpResponseMessage responseMessage = @@ -1010,10 +1010,10 @@ private unsafe void SetTcpKeepalive(SafeWinHttpHandle sessionHandle) onoff = 1, // Timeout.InfiniteTimeSpan will be converted to uint.MaxValue milliseconds (~ 50 days) - // The result a of double->uint cast is unspecified and may differ on ARM. + // The result a of double->uint cast is unspecified and may differ on ARM, returning 0 instead of uint.MaxValue. // To handle Timeout.InfiniteTimespan correctly, we need to cast to Int32 first. - keepaliveinterval = unchecked((uint)(int)_tcpKeepAliveInterval.TotalMilliseconds), - keepalivetime = unchecked((uint)(int)_tcpKeepAliveTime.TotalMilliseconds) + keepaliveinterval = (uint)(int)_tcpKeepAliveInterval.TotalMilliseconds, + keepalivetime = (uint)(int)_tcpKeepAliveTime.TotalMilliseconds }; SetWinHttpOption(