70 global::Interop.WinHttp.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig =
default(global::Interop.WinHttp.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG);
73 if (global::Interop.WinHttp.WinHttpGetIEProxyConfigForCurrentUser(out proxyConfig))
81 System.
Net.
NetEventSource.
Info(
this, $
"AutoConfigUrl={AutoConfigUrl}, AutoDetect={AutoDetect}, Proxy={Proxy}, ProxyBypass={ProxyBypass}",
".ctor");
106 public bool GetProxyForUrl(global::Interop.WinHttp.SafeWinHttpHandle sessionHandle,
Uri uri, out global::Interop.WinHttp.WINHTTP_PROXY_INFO proxyInfo)
108 proxyInfo.AccessType = 1u;
116 Unsafe.SkipInit(out global::Interop.WinHttp.WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions);
118 autoProxyOptions.AutoDetectFlags = (
AutoDetect ? 3u : 0u);
119 autoProxyOptions.AutoLoginIfChallenged =
false;
122 autoProxyOptions.Reserved2 = 0u;
126 text =
"https" +
text.Substring(
"wss".Length);
128 else if (uri.
Scheme ==
"ws")
130 text =
"http" +
text.Substring(
"ws".Length);
136 if (global::Interop.WinHttp.WinHttpGetProxyForUrl(sessionHandle,
text, ref autoProxyOptions, out proxyInfo))
150 if ((
long)lastWin32Error == 12015)
157 autoProxyOptions.AutoLoginIfChallenged =
true;
160 if ((
long)lastWin32Error == 12180)
168 if (!flag && !
string.IsNullOrEmpty(
Proxy))
170 proxyInfo.AccessType = 3u;