Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -1139,11 +1139,22 @@ namespace System.Net
Debug.Assert(handler.UseProxy); // Default of handler.UseProxy is true.
Debug.Assert(handler.Proxy == null); // Default of handler.Proxy is null.
// HttpClientHandler default is to use a proxy which is the system proxy.
// This is indicated by the properties 'UseProxy == true' and 'Proxy == null'.
//
// However, HttpWebRequest doesn't have a separate 'UseProxy' property. Instead,
// the default of the 'Proxy' property is a non-null IWebProxy object which is the
// system default proxy object. If the 'Proxy' property were actually null, then
// that means don't use any proxy.
//
// So, we need to map the desired HttpWebRequest proxy settings to equivalent
// HttpClientHandler settings.
if (_proxy == null)
{
handler.UseProxy = false;
}
else
else if (!object.ReferenceEquals(_proxy, WebRequest.GetSystemWebProxy()))
{
handler.Proxy = _proxy;
}