Internal Http SystemProxyInfo object should never be null (dotnet/corefx#37306)
authorDavid Shulman <david.shulman@microsoft.com>
Wed, 1 May 2019 04:14:02 +0000 (21:14 -0700)
committerGitHub <noreply@github.com>
Wed, 1 May 2019 04:14:02 +0000 (21:14 -0700)
commit3b63495bbe4a0c910ca51b98d4a734deffd1b0b5
treeff88c00a98c04a464ac2143d6257d3bec6679116
parent9b9c690b2b54360bfc9a8648f00e6e75869939b5
Internal Http SystemProxyInfo object should never be null (dotnet/corefx#37306)

In order to provide a consistent experience with the HttpClient IWebProxy objects,
the returned internal proxy object which represent the system/platform proxy settings
should never be null. If the platform's settings indicate that no proxy is being used,
then return an instance of the internal HttpNoProxy object.

Note that even if the platform settings indicate that a proxy could be used, any
particular Http request might still not go thru a proxy. The final determination of
what proxy is being used for a request is still governed by the return of the
IWebProxy.IsBypassed and IWebProxy.GetProxy methods.

Contributes to dotnet/corefx#36553

Commit migrated from https://github.com/dotnet/corefx/commit/830bf7fc0346d9453d85ad4ec726c92ac3e72998
src/libraries/System.Net.Http/src/System.Net.Http.csproj
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpNoProxy.cs [new file with mode: 0644]
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SystemProxyInfo.Unix.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SystemProxyInfo.Windows.cs
src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj
src/libraries/System.Net.Http/tests/UnitTests/SystemProxyInfoTest.cs