mono/mono — pull request #388 by strawd (2012-07-11 20:09:21+00:00)
Title: Fixes for compatibility with ASP.NET Web API Self-hosting

Two issues were preventing mono from running a basic ASP.NET Web API self-hosted server (HttpSelfHostServer):

1. The Web API code assumes that the Scheme of parsed URIs use the same string references as the static Uri.UriScheme* fields (see HttpSelfHostConfiguration.cs, ValidateBaseAddress method). I have changed the URI parsing code in mono to use the static instances when applicable.
2. Web API passes a timeout value of TimeSpan.MaxValue to the underlying channel. Mono uses WaitHandle.WaitOne() to implement that timeout, but WaitOne has a documented max value of int.MaxValue milliseconds. I changed the HTTP channel/listener implementations in mono to check for TimeSpan.MaxValue and pass TimeSpan.FromMilliseconds(int.MaxValue) in that case.