Make WebRequest.GetSystemWebProxy() return a working proxy (dotnet/corefx#41692)
* Make WebRequest.GetSystemWebProxy() return a working proxy
Today it returns a singleton on .NET Core that throws PlatformNotSupportedExceptions, and is only used for its reference identity by the WebRequest implementation. This is problematic for existing code that's taking this proxy and passing it to, for example, ClientWebSocket's Proxy, as it will end up being an expensive nop. In fact, there's currently no way when targeting netstandard2.0 to tell ClientWebSocket to use a default proxy.
With this fix, WebRequest.DefaultWebProxy (which just defaults to GetSystemWebProxy()) will now return HttpClient.DefaultProxy, which is actually a working proxy implementation.
* Stop throwing NotSupportedException from HttpClient.DefaultProxy.set_Credentials
The OS and how the environment is configured determines what concrete type is returned from HttpClient's DefaultProxy property. And currently these different types behave differently from set_Credentials. Two of them are throwing NotSupportedException, which is not expected from the IWebProxy interface. We should just roundtrip the credentials set, even if they're not used.
Commit migrated from https://github.com/dotnet/corefx/commit/
8d21b79b924d29088dbde46d42737a657d466b5e