Exemplo n.º 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("KProxy", 1, IntPtr.Zero, IntPtr.Zero, 0);
 }
Exemplo n.º 2
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 (KProxyApplication.Prefs.GetBoolPref("KProxy.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 = KPCONFIG.bAutoProxyLogon;
     return(winhttp_autoproxy_options);
 }