Beispiel #1
0
 public WinHTTPAutoProxy(bool bAutoDiscover, string sAutoConfigUrl)
 {
     this._bUseAutoDiscovery = bAutoDiscover;
     if (!string.IsNullOrEmpty(sAutoConfigUrl))
     {
         this._sPACScriptLocation = sAutoConfigUrl;
     }
     this._oAPO     = GetAutoProxyOptionsStruct(this._sPACScriptLocation, this._bUseAutoDiscovery);
     this._hSession = WinHTTPNative.WinHttpOpen("Fiddler", 1, IntPtr.Zero, IntPtr.Zero, 0);
 }
 public WinHTTPAutoProxy(bool bAutoDiscover, string sAutoConfigUrl)
 {
     this._bUseAutoDiscovery = bAutoDiscover;
     if (!string.IsNullOrEmpty(sAutoConfigUrl))
     {
         if ((sAutoConfigUrl.OICStartsWith("file:") || sAutoConfigUrl.StartsWith(@"\\")) || (sAutoConfigUrl[1] == ':'))
         {
             Proxy.sUpstreamPACScript = GetPACFileText(sAutoConfigUrl);
             if (!string.IsNullOrEmpty(Proxy.sUpstreamPACScript))
             {
                 sAutoConfigUrl = "http://" + CONFIG.sFiddlerListenHostPort + "/UpstreamProxy.pac";
             }
         }
         this._sPACScriptLocation = sAutoConfigUrl;
     }
     this._oAPO = GetAutoProxyOptionsStruct(this._sPACScriptLocation, this._bUseAutoDiscovery);
     this._hSession = WinHTTPNative.WinHttpOpen("Fiddler", 1, IntPtr.Zero, IntPtr.Zero, 0);
 }
Beispiel #3
0
 public WinHTTPAutoProxy(bool bAutoDiscover, string sAutoConfigUrl)
 {
     this._bUseAutoDiscovery = bAutoDiscover;
     if (!string.IsNullOrEmpty(sAutoConfigUrl))
     {
         if (sAutoConfigUrl.OICStartsWith("file:") || sAutoConfigUrl.StartsWith("\\\\") || (sAutoConfigUrl.Length > 2 && sAutoConfigUrl[1] == ':'))
         {
             Proxy.sUpstreamPACScript = WinHTTPAutoProxy.GetPACFileText(sAutoConfigUrl);
             if (!string.IsNullOrEmpty(Proxy.sUpstreamPACScript))
             {
                 FiddlerApplication.Log.LogFormat("!WARNING: System proxy was configured to use a file-protocol sourced script ({0}). Proxy scripts delivered by the file protocol are not supported by many clients. Please see http://blogs.msdn.com/b/ieinternals/archive/2013/10/11/web-proxy-configuration-and-ie11-changes.aspx for more information.", new object[]
                 {
                     sAutoConfigUrl
                 });
                 sAutoConfigUrl = "http://" + CONFIG.sFiddlerListenHostPort + "/UpstreamProxy.pac";
             }
         }
         this._sPACScriptLocation = sAutoConfigUrl;
     }
     this._oAPO     = WinHTTPAutoProxy.GetAutoProxyOptionsStruct(this._sPACScriptLocation, this._bUseAutoDiscovery);
     this._hSession = WinHTTPNative.WinHttpOpen("Fiddler", 1, IntPtr.Zero, IntPtr.Zero, 0);
 }
Beispiel #4
0
 private static WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS GetAutoProxyOptionsStruct(string sPAC, bool bUseAutoDetect)
 {
     WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS result = default(WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS);
     if (FiddlerApplication.Prefs.GetBoolPref("fiddler.network.gateway.DetermineInProcess", false))
     {
         result.dwFlags = 65536;
     }
     else
     {
         result.dwFlags = 0;
     }
     if (bUseAutoDetect)
     {
         result.dwFlags          |= 1;
         result.dwAutoDetectFlags = 3;
     }
     if (sPAC != null)
     {
         result.dwFlags          |= 2;
         result.lpszAutoConfigUrl = sPAC;
     }
     result.fAutoLoginIfChallenged = CONFIG.bAutoProxyLogon;
     return(result);
 }
Beispiel #5
0
 private static WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS GetAutoProxyOptionsStruct(string sPAC, bool bUseAutoDetect)
 {
     WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS winhttp_autoproxy_options = new WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS();
     if (FiddlerApplication.Prefs.GetBoolPref("fiddler.network.gateway.DetermineInProcess", false))
     {
         winhttp_autoproxy_options.dwFlags = 0x10000;
     }
     else
     {
         winhttp_autoproxy_options.dwFlags = 0;
     }
     if (bUseAutoDetect)
     {
         winhttp_autoproxy_options.dwFlags          |= 1;
         winhttp_autoproxy_options.dwAutoDetectFlags = 3;
     }
     if (sPAC != null)
     {
         winhttp_autoproxy_options.dwFlags          |= 2;
         winhttp_autoproxy_options.lpszAutoConfigUrl = sPAC;
     }
     winhttp_autoproxy_options.fAutoLoginIfChallenged = CONFIG.bAutoProxyLogon;
     return(winhttp_autoproxy_options);
 }
 private static WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS GetAutoProxyOptionsStruct(string sPAC, bool bUseAutoDetect)
 {
     WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS winhttp_autoproxy_options = new WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS();
     if (FiddlerApplication.Prefs.GetBoolPref("fiddler.network.gateway.DetermineInProcess", false))
     {
         winhttp_autoproxy_options.dwFlags = 0x10000;
     }
     else
     {
         winhttp_autoproxy_options.dwFlags = 0;
     }
     if (bUseAutoDetect)
     {
         winhttp_autoproxy_options.dwFlags |= 1;
         winhttp_autoproxy_options.dwAutoDetectFlags = 3;
     }
     if (sPAC != null)
     {
         winhttp_autoproxy_options.dwFlags |= 2;
         winhttp_autoproxy_options.lpszAutoConfigUrl = sPAC;
     }
     winhttp_autoproxy_options.fAutoLoginIfChallenged = CONFIG.bAutoProxyLogon;
     return winhttp_autoproxy_options;
 }
Beispiel #7
0
 internal static extern bool WinHttpGetProxyForUrl(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr)] string lpcwszUrl, [In] ref WinHTTPNative.WINHTTP_AUTOPROXY_OPTIONS pAutoProxyOptions, out WinHTTPNative.WINHTTP_PROXY_INFO pProxyInfo);