configure pycurl proxy settings
340199
def configure_proxy(self, curl_object):
        """"""
        curl_object.setopt(curl_object.PROXY, self._proxy_hostname)
        curl_object.setopt(curl_object.PROXYPORT, self._proxy_port)
        curl_object.setopt(curl_object.PROXYTYPE, curl_object.PROXYTYPE_SOCKS5)
        if self._proxy_user and self._proxy_passwd:
            curl_object.setopt(curl_object.PROXYUSERPWD, '%s:%s' % (self._proxy_user, self._proxy_port))
1156774
async def proxy(self, port, proxied_path):
        '''
        
        '''

        if 'Proxy-Connection' in self.request.headers:
            del self.request.headers['Proxy-Connection']

        self._record_activity()

        if self.request.headers.get("Upgrade", "").lower() == 'websocket':
            # We wanna websocket!
            # jupyterhub/jupyter-server-proxy@36b3214
            self.log.info("we wanna websocket, but we don't define WebSocketProxyHandler")
            self.set_status(500)

        body = self.request.body
        if not body:
            if self.request.method == 'POST':
                body = b''
            else:
                body = None

        client = httpclient.AsyncHTTPClient()

        req = self._build_proxy_request(port, proxied_path, body)
        response = await client.fetch(req, raise_error=False)
        # record activity at start and end of requests
        self._record_activity()

        # For all non http errors...
        if response.error and type(response.error) is not httpclient.HTTPError:
            self.set_status(500)
            self.write(str(response.error))
        else:
            self.set_status(response.code, response.reason)

            # clear tornado default header
            self._headers = httputil.HTTPHeaders()

            for header, v in response.headers.get_all():
                if header not in ('Content-Length', 'Transfer-Encoding',
                                  'Content-Encoding', 'Connection'):
                    # some header appear multiple times, eg 'Set-Cookie'
                    self.add_header(header, v)

            if response.body:
                self.write(response.body)
525567
def _configure_device(commands, **kwargs):
    '''
    
    '''
    if salt.utils.platform.is_proxy():
        return __proxy__['nxos.proxy_config'](commands, **kwargs)
    else:
        return _nxapi_config(commands, **kwargs)
586921
function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') {
		if ($proxyhost) {
			$this->proxy = array(
				'host' => $proxyhost,
				'port' => $proxyport,
				'username' => $proxyusername,
				'password' => $proxypassword,
				'authtype' => $proxyauthtype
			);
			if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') {
				$this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword));
			}
		} else {
			$this->debug('remove proxy');
			$proxy = null;
			unsetHeader('Proxy-Authorization');
		}
	}
870017
def set_default_proxy(proxy_type=None, addr=None, port=None, rdns=True, username=None, password=None):
    
    socksocket.default_proxy = (proxy_type, addr, port, rdns,
                                username.encode() if username else None,
                                password.encode() if password else None)
24245
def _setup_transport(self):
        
        if HAVE_PY26_SSL:
            if hasattr(self, 'sslopts'):
                self.sslobj = ssl.wrap_socket(self.sock, **self.sslopts)
            else:
                self.sslobj = ssl.wrap_socket(self.sock)
            self.sslobj.do_handshake()
        else:
            self.sslobj = socket.ssl(self.sock)
420605
def get_client_settings_env(**_):
    

    return {
        'proxy': os.environ.get('https_proxy'),
        'username': os.environ.get('SL_USERNAME'),
        'api_key': os.environ.get('SL_API_KEY'),
    }
806191
protected function configureProxyDomainExclusions()
    {
        $noProxy = $this->config()->get('egress_proxy_exclude_domains');
        if (empty($noProxy)) {
            return;
        }

        if (!is_array($noProxy)) {
            $noProxy = [$noProxy];
        }

        // Merge with exsiting if needed.
        if (Environment::getEnv('NO_PROXY')) {
            $noProxy = array_merge(explode(',', Environment::getEnv('NO_PROXY')), $noProxy);
        }

        /*
         * Set the environment varial for NO_PROXY the same way the
         * proxy variables are set above
         */
        putenv('NO_PROXY=' . implode(',', array_unique($noProxy)));
    }
325818
def configure(name, host, port, auth, current):
    '''
    
    '''
    Config = ConfigParser.ConfigParser()
    if not os.path.exists(os.path.dirname(filename)):
        try:
            os.makedirs(os.path.dirname(filename))
        except Exception as e:
            click.echo(e)
            return
    section_name = None
    if(current.lower() == 'y'):
        section_name = 'Current'
        change_current()
    else:
        section_name = name.capitalize()
    cfgfile = open(filename,'a')
    Config.add_section(section_name)
    Config.set(section_name,'host',host)
    Config.set(section_name,'port',port)
    Config.set(section_name,'auth',auth)
    Config.set(section_name,'name',name.capitalize())
    Config.write(cfgfile)
    cfgfile.close()
508229
def configure(root_url, **kwargs):
    "
    default = kwargs.pop('default', True)
    kwargs['client_agent'] = 'example-client/' + __version__
    if 'headers' not in kwargs:
        kwargs['headers'] = {}
    kwargs['headers']['Accept-Type'] = 'application/json'
    if default:
        default_config.reset(root_url, **kwargs)
    else:
        Client.config = wac.Config(root_url, **kwargs)
936294
def _proxy_settings(self):
        
        if not ('https_proxy' in environ or 'HTTPS_PROXY' in environ
                or 'http_proxy' in environ or 'HTTP_PROXY' in environ):
            return {}
        https_proxy = environ.get('https_proxy')
        if https_proxy is None:
            https_proxy = environ.get('HTTPS_PROXY')
        http_proxy = environ.get('http_proxy')
        if http_proxy is None:
            http_proxy = environ.get('HTTP_PROXY')
        no_proxy = environ.get('no_proxy')
        if no_proxy is None:
            no_proxy = environ.get('NO_PROXY', '')
        no_proxy = no_proxy + ',solr,db'

        out = [
            'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:'
            '/bin:/usr/games:/usr/local/games"\n']
        if https_proxy is not None:
            out.append('https_proxy=' + posix_quote(https_proxy) + '\n')
            out.append('HTTPS_PROXY=' + posix_quote(https_proxy) + '\n')
        if http_proxy is not None:
            out.append('http_proxy=' + posix_quote(http_proxy) + '\n')
            out.append('HTTP_PROXY=' + posix_quote(http_proxy) + '\n')
        if no_proxy is not None:
            out.append('no_proxy=' + posix_quote(no_proxy) + '\n')
            out.append('NO_PROXY=' + posix_quote(no_proxy) + '\n')

        with open(self.sitedir + '/run/proxy-environment', 'w') as f:
            f.write("".join(out))

        return {self.sitedir + '/run/proxy-environment': '/etc/environment'}
601167
def _configure_sockets(self, config, with_streamer=False, with_forwarder=False):
        
        rc_port = config.get('rc_port', 5001)

        self.result_collector.set_hwm(0)
        self.result_collector.bind("tcp://*:{}".format(rc_port))

        self.poller.register(self.result_collector, zmq.POLLIN)
1137517
protected function configure()
        {

            // get systemname
            $sAppName = SystemSettings::get('app_name');

            // set cli options
            $this->setName($sAppName . ':remote:cron')->addOption('app', null, InputOption::VALUE_REQUIRED, 'run only for specific remote app', false)->addOption('force', null, InputOption::VALUE_NONE, 'force to run remote app / ignore cron settings')->setDescription('Run/Crawl registered remote apps');
        }
382080
def change_proxy(self, random=True):
        

        if self.proxylist.size():
            if random:
                proxy = self.proxylist.get_random_proxy()
            else:
                proxy = self.proxylist.get_next_proxy()
            self.setup(proxy=proxy.get_address(),
                       proxy_userpwd=proxy.get_userpwd(),
                       proxy_type=proxy.proxy_type)
        else:
            logger.debug('Proxy list is empty')
395034
function OnBoardingCtrl($scope, $location, $rootScope, $window, $timeout, $sce, 
                        _bind, _req, _modules, _socket) {

  /****************************************************************************/
  /* INITIALIZATION                                                           */
  /****************************************************************************/
  /* Handhsaking [modules] */
  _socket.emit('handshake', 'modules');

  _socket.on('modules', function(state) {
      //console.log('========================================');
      //console.log(JSON.stringify(state, null, 2));
      //console.log('----------------------------------------');
    $scope.modules = state;
    if($scope.modules && $scope.modules.length > 0) {
      $scope.modules.forEach(function(m) {
        if(m.name === 'mod_strip') {
          if(m.installing) {
            if(m.install_status === 'dependencies') {
              $scope.step1_download_done = true;
            }
          }
        }
      });
    }
  });

  /****************************************************************************/
  /* STEPS                                                                    */
  /****************************************************************************/
  $scope.done_step0 = function() {

    $scope.step1_error = null;
    var to_install = ['mod_strip', 'mod_stats'];

    /* Detection of current state. */
    var module = {};

    if($scope.modules && $scope.modules.length > 0) {
      $scope.modules.forEach(function(m) {
        if(to_install.indexOf(m.name) !== -1) {
          module[m.name] = m;
        }
      });
    }

    /* Install to_install modules */
    async.series([
      function(cb_) {
        async.each(to_install, function(m, cb_) {
          if(module[m]) {
            return cb_();
          }
          _modules.add('github:breach/' + m).then(function(data) {
            module[m] = data.module;
            return cb_();
          }, function(reason) { return cb_(reason); });
        }, cb_);
      },
      function(cb_) {
        $scope.step1_add_done = true;
        async.each(to_install, function(m, cb_) {
          _modules.install(module[m].path).then(function(data) {
            return cb_();
          }, function(reason) { return cb_(reason); });
        }, cb_);
      },
      function(cb_) {
        $scope.step1_dependencies_done = true;
        async.each(to_install, function(m, cb_) {
          if(module[m].running) {
            return cb_();
          }
          _modules.run(module[m].path).then(function(data) {
            return cb_();
          }, function(reason) { return cb_(reason); });
        }, cb_);
      }
    ], function(err) {
      if(err) {
        $scope.step1_error = err.split(' at')[0];
      }
      else {
        $scope.step1_run_done = true;
      }
    });

    $('.onboarding').addClass('step-1');
    $('.onboarding').removeClass('step-0');
  };

  $scope.done_step1 = function() {
    $('.onboarding').addClass('step-2');
    $('.onboarding').removeClass('step-1');
  };

  $scope.done_step2 = function() {
    $('.onboarding').addClass('step-3');
    $('.onboarding').removeClass('step-2');
  };

  $scope.done_step3 = function() {
    $('.onboarding').addClass('step-4');
    $('.onboarding').removeClass('step-3');
  };

  $scope.done_step4 = function() {
    $location.path('/');
  };
}
892579
def bind_proxy(self, name, proxy):
        """"""
        if not len(name) or name[0] != '/' or name[-1] != '/':
            raise ValueError(
                "name must start and end with '/': {0}".format(name))
        self._folder_proxys.insert(0, (name, proxy))
741484
private function _setupCurl()
    {
        $requestParams = http_build_query($this->requestParams);

        $this->uri = $this->action;
        if ($this->method == 'GET') {
            $this->uri .= '?'.$requestParams;
        }

        $this->curl = curl_init($this->uri);

        if ($this->method == 'POST') {
            // POST requests
            curl_setopt($this->curl, CURLOPT_POST, true);
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $requestParams);
        }

        // We want to receive the returned data
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
        // Setup custom user agent
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->formatUserAgentInfo());
    }