Beispiel #1
0
 internal void CollectConnectoidAndGatewayInfo()
 {
     this.oAllConnectoids = new WinINETConnectoids();
     this.piPrior         = this.oAllConnectoids.GetDefaultConnectionGatewayInfo();
     if (CONFIG.bForwardToGateway && ((this.piPrior.sPACScriptLocation != null) || this.piPrior.bAutoDetect))
     {
         this.oAutoProxy = new WinHTTPAutoProxy(this.piPrior.bAutoDetect, this.piPrior.sPACScriptLocation);
     }
     else if (this.oAutoProxy != null)
     {
         this.oAutoProxy.Dispose();
         this.oAutoProxy = null;
     }
     if (CONFIG.bForwardToGateway && this.piPrior.bUseManualProxies)
     {
         this._DetermineGatewayIPEndPoints();
         if (string.IsNullOrEmpty(this.piPrior.sHostsThatBypass))
         {
             this.oBypassList = null;
         }
         else
         {
             this.oBypassList = new ProxyBypassList(this.piPrior.sHostsThatBypass);
             if (!this.oBypassList.HasEntries)
             {
                 this.oBypassList = null;
             }
         }
     }
     else
     {
         this._ipepFtpGateway = this._ipepHttpGateway = (IPEndPoint)(this._ipepHttpsGateway = null);
         this.oBypassList     = null;
     }
 }
Beispiel #2
0
        public override string ToString()
        {
            string text = null;

            if (this.iAutoProxySuccessCount < 0)
            {
                text = "\tOffline/disabled\n";
            }
            else
            {
                if (this._bUseAutoDiscovery)
                {
                    string text2 = WinHTTPAutoProxy.GetWPADUrl();
                    if (string.IsNullOrEmpty(text2))
                    {
                        text2 = "Not detected";
                    }
                    text = string.Format("\tWPAD: {0}\n", text2);
                }
                if (this._sPACScriptLocation != null)
                {
                    text = text + "\tConfig script: " + this._sPACScriptLocation + "\n";
                }
            }
            return(text ?? "\tDisabled");
        }
Beispiel #3
0
 public void Dispose()
 {
     if (this.watcherPrefNotify.HasValue)
     {
         FiddlerApplication.Prefs.RemoveWatcher(this.watcherPrefNotify.Value);
     }
     if (this.oAutoProxy != null)
     {
         this.oAutoProxy.Dispose();
         this.oAutoProxy = null;
     }
     this.Stop();
 }
Beispiel #4
0
 private void AssignGateway(WinINETProxyInfo oPI)
 {
     this.piSystemGateway = oPI;
     if (this.piSystemGateway.bAutoDetect || this.piSystemGateway.sPACScriptLocation != null)
     {
         this.oAutoProxy = new WinHTTPAutoProxy(this.piSystemGateway.bAutoDetect, this.piSystemGateway.sPACScriptLocation);
     }
     if (this.piSystemGateway.bUseManualProxies)
     {
         this._DetermineGatewayIPEndPoints();
         if (!string.IsNullOrEmpty(this.piSystemGateway.sHostsThatBypass))
         {
             this.oBypassList = new ProxyBypassList(this.piSystemGateway.sHostsThatBypass);
             if (!this.oBypassList.HasEntries)
             {
                 this.oBypassList = null;
             }
         }
     }
 }
Beispiel #5
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 #6
0
        internal void RefreshUpstreamGatewayInformation()
        {
            this._ipepFtpGateway = (this._ipepHttpGateway = (this._ipepHttpsGateway = null));
            this.piSystemGateway = null;
            this.oBypassList     = null;
            if (this.oAutoProxy != null)
            {
                this.oAutoProxy.Dispose();
                this.oAutoProxy = null;
            }
            switch (CONFIG.UpstreamGateway)
            {
            case GatewayType.None:
                FiddlerApplication.Log.LogString("Setting upstream gateway to none");
                return;

            case GatewayType.Manual:
            {
                WinINETProxyInfo oPI = WinINETProxyInfo.CreateFromStrings(FiddlerApplication.Prefs.GetStringPref("fiddler.network.gateway.proxies", string.Empty), FiddlerApplication.Prefs.GetStringPref("fiddler.network.gateway.exceptions", string.Empty));
                this.AssignGateway(oPI);
                return;
            }

            case GatewayType.System:
                this.AssignGateway(this.oAllConnectoids.GetDefaultConnectionGatewayInfo());
                return;

            case GatewayType.WPAD:
                FiddlerApplication.Log.LogString("Setting upstream gateway to WPAD");
                this.oAutoProxy = new WinHTTPAutoProxy(true, null);
                return;

            default:
                return;
            }
        }
Beispiel #7
0
 private void AssignGateway(WinINETProxyInfo oPI)
 {
     this.piSystemGateway = oPI;
     if (this.piSystemGateway.bAutoDetect || (this.piSystemGateway.sPACScriptLocation != null))
     {
         this.oAutoProxy = new WinHTTPAutoProxy(this.piSystemGateway.bAutoDetect, this.piSystemGateway.sPACScriptLocation);
     }
     if (this.piSystemGateway.bUseManualProxies)
     {
         this._DetermineGatewayIPEndPoints();
         if (!string.IsNullOrEmpty(this.piSystemGateway.sHostsThatBypass))
         {
             this.oBypassList = new ProxyBypassList(this.piSystemGateway.sHostsThatBypass);
             if (!this.oBypassList.HasEntries)
             {
                 this.oBypassList = null;
             }
         }
     }
 }
Beispiel #8
0
        internal void RefreshUpstreamGatewayInformation()
        {
            this._ipepFtpGateway = this._ipepHttpGateway = (IPEndPoint) (this._ipepHttpsGateway = null);
            this.piSystemGateway = null;
            this.oBypassList = null;
            if (this.oAutoProxy != null)
            {
                this.oAutoProxy.Dispose();
                this.oAutoProxy = null;
            }
            switch (CONFIG.UpstreamGateway)
            {
                case GatewayType.None:
                    FiddlerApplication.Log.LogString("Setting upstream gateway to none");
                    return;

                case GatewayType.Manual:
                {
                    WinINETProxyInfo oPI = WinINETProxyInfo.CreateFromStrings(FiddlerApplication.Prefs.GetStringPref("fiddler.network.gateway.proxies", string.Empty), FiddlerApplication.Prefs.GetStringPref("fiddler.network.gateway.exceptions", string.Empty));
                    this.AssignGateway(oPI);
                    return;
                }
                case GatewayType.System:
                    this.AssignGateway(this.oAllConnectoids.GetDefaultConnectionGatewayInfo());
                    return;

                case GatewayType.WPAD:
                    FiddlerApplication.Log.LogString("Setting upstream gateway to WPAD");
                    this.oAutoProxy = new WinHTTPAutoProxy(true, null);
                    return;
            }
        }
Beispiel #9
0
 public void Dispose()
 {
     if (this.watcherPrefNotify.HasValue)
     {
         FiddlerApplication.Prefs.RemoveWatcher(this.watcherPrefNotify.Value);
     }
     //if (this.oRegistryWatcher != null)
     //{
     //    this.oRegistryWatcher.Dispose();
     //}
     this.Stop();
     if (this.oAutoProxy != null)
     {
         this.oAutoProxy.Dispose();
         this.oAutoProxy = null;
     }
 }