public bool GetAutoProxyForUrl(string sUrl, out IPEndPoint ipepResult) { WinHTTPNative.WINHTTP_PROXY_INFO winhttp_proxy_info; int num = 0; bool flag = WinHTTPNative.WinHttpGetProxyForUrl(this._hSession, sUrl, ref this._oAPO, out winhttp_proxy_info); if (!flag) { num = Marshal.GetLastWin32Error(); } if (flag) { if (IntPtr.Zero != winhttp_proxy_info.lpszProxy) { string sHostAndPort = Marshal.PtrToStringUni(winhttp_proxy_info.lpszProxy); ipepResult = Utilities.IPEndPointFromHostPortString(sHostAndPort); } else { ipepResult = null; } Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxy); Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxyBypass); return(true); } //Label_013E: Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxy); Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxyBypass); ipepResult = null; return(false); }
public WinHTTPAutoProxy(bool bAutoDiscover, string sAutoBrowserUrl) { this._bUseAutoDiscovery = bAutoDiscover; if (!string.IsNullOrEmpty(sAutoBrowserUrl)) { this._sPACScriptLocation = sAutoBrowserUrl; } this._oAPO = GetAutoProxyOptionsStruct(this._sPACScriptLocation, this._bUseAutoDiscovery); this._hSession = WinHTTPNative.WinHttpOpen("SDVP", 1, IntPtr.Zero, IntPtr.Zero, 0); }
private static string GetWPADUrl() { IntPtr ptr; string str; bool flag = WinHTTPNative.WinHttpDetectAutoProxyBrowserUrl(3, out ptr); if (!flag) { Marshal.GetLastWin32Error(); } if (flag && (IntPtr.Zero != ptr)) { str = Marshal.PtrToStringUni(ptr); } else { str = string.Empty; } Utilities.GlobalFreeIfNonZero(ptr); return(str); }
public void Dispose() { WinHTTPNative.WinHttpCloseHandle(this._hSession); }