public bool GetAutoProxyForUrl(string sUrl, out IPEndPoint ipepResult) { int num = 0; WinHTTPNative.WINHTTP_PROXY_INFO wINHTTP_PROXY_INFO; bool flag; if (!(flag = WinHTTPNative.WinHttpGetProxyForUrl(this._hSession, sUrl, ref this._oAPO, out wINHTTP_PROXY_INFO))) { num = Marshal.GetLastWin32Error(); } if (flag) { if (IntPtr.Zero != wINHTTP_PROXY_INFO.lpszProxy) { string text = Marshal.PtrToStringUni(wINHTTP_PROXY_INFO.lpszProxy); ipepResult = Utilities.IPEndPointFromHostPortString(text); if (ipepResult == null) { FiddlerApplication.Log.LogFormat("Proxy Configuration Script specified an unreachable proxy: {0} for URL: {1}", new object[] { text, sUrl }); } } else { ipepResult = null; } Utilities.GlobalFreeIfNonZero(wINHTTP_PROXY_INFO.lpszProxy); Utilities.GlobalFreeIfNonZero(wINHTTP_PROXY_INFO.lpszProxyBypass); return(true); } int num2 = num; if (num2 <= 12015) { if (num2 == 12006) { FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failure; Fiddler only supports HTTP/HTTPS for PAC script URLs."); goto IL_13D; } if (num2 == 12015) { FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failure; you must set the AutoProxyLogon registry key to TRUE."); goto IL_13D; } } else { switch (num2) { case 12166: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script contents were not valid."); goto IL_13D; case 12167: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failed."); goto IL_13D; default: if (num2 == 12180) { FiddlerApplication._Log.LogString("Fiddler.Network.AutoProxy> AutoProxy Detection failed."); goto IL_13D; } break; } } FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> Proxy determination failed with error code: " + num); IL_13D: Utilities.GlobalFreeIfNonZero(wINHTTP_PROXY_INFO.lpszProxy); Utilities.GlobalFreeIfNonZero(wINHTTP_PROXY_INFO.lpszProxyBypass); ipepResult = null; return(false); }
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); if (ipepResult == null) { FiddlerApplication.Log.LogFormat("Proxy Configuration Script specified an unreachable proxy: {0} for URL: {1}", new object[] { sHostAndPort, sUrl }); } } else { ipepResult = null; } Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxy); Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxyBypass); return(true); } int num2 = num; if (num2 <= 0x2eef) { switch (num2) { case 0x2ee6: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failure; Fiddler only supports HTTP/HTTPS for PAC script URLs."); goto Label_013E; case 0x2eef: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failure; you must set the AutoProxyLogon registry key to TRUE."); goto Label_013E; } } else { switch (num2) { case 0x2f86: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script contents were not valid."); goto Label_013E; case 0x2f87: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> PAC Script download failed."); goto Label_013E; default: if (num2 != 0x2f94) { goto Label_0124; } FiddlerApplication._Log.LogString("Fiddler.Network.AutoProxy> AutoProxy Detection failed."); goto Label_013E; } } Label_0124: FiddlerApplication._Log.LogString("Fiddler.Network.ProxyPAC> Proxy determination failed with error code: " + num); Label_013E: Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxy); Utilities.GlobalFreeIfNonZero(winhttp_proxy_info.lpszProxyBypass); ipepResult = null; return(false); }