How to use the tunnel-agent.httpsOverHttps function in tunnel-agent

To help you get started, we’ve selected a few tunnel-agent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wuchangming / node-mitmproxy / src / common / util.js View on Github external
var hostname = urlObject.hostname || 'localhost';

    if (requestIsSSL) {
        if (protocol === 'http:') {
            if (!httpsOverHttpAgent) {
                httpsOverHttpAgent = tunnelAgent.httpsOverHttp({
                    proxy: {
                        host: hostname,
                        port: port
                    }
                });
            }
            return httpsOverHttpAgent
        } else {
            if (!httpsOverHttpsAgent) {
                httpsOverHttpsAgent = tunnelAgent.httpsOverHttps({
                    proxy: {
                        host: hostname,
                        port: port
                    }
                });
            }
            return httpsOverHttpsAgent
        }
    } else {
        if (protocol === 'http:') {
            // if (!httpOverHttpAgent) {
            //     httpOverHttpAgent = tunnelAgent.httpOverHttp({
            //         proxy: {
            //             host: hostname,
            //             port: port
            //         }
github cnpm / cnpmjs.org / common / urllib.js View on Github external
}
    });
    httpsAgent = tunnel.httpsOverHttp({
      proxy: {
        host: urlinfo.hostname,
        port: urlinfo.port
      }
    });
  } else if (urlinfo.protocol === 'https:') {
    httpAgent = tunnel.httpOverHttps({
      proxy: {
        host: urlinfo.hostname,
        port: urlinfo.port
      }
    });
    httpsAgent = tunnel.httpsOverHttps({
      proxy: {
        host: urlinfo.hostname,
        port: urlinfo.port
      }
    });
  } else {
    throw new TypeError('httpProxy format error: ' + config.httpProxy);
  }
} else {
  httpAgent = new HttpAgent({
    timeout: 0,
    keepAliveTimeout: 15000
  });
  httpsAgent = new HttpsAgent({
    timeout: 0,
    keepAliveTimeout: 15000
github faye / faye / src / transport / node_http.js View on Github external
this._httpClient = this._proxySecure ? https : http;
      return;
    }

    var options = assign({
      proxy: {
        host:       this._proxyUri.hostname,
        port:       this._proxyUri.port || this.DEFAULT_PORTS[this._proxyUri.protocol],
        proxyAuth:  this._proxyUri.auth,
        headers:    assign({ host: this.endpoint.host }, proxy.headers)
      }
    }, this._dispatcher.tls);

    if (this._proxySecure) {
      assign(options.proxy, proxy.tls);
      this._tunnel = tunnel.httpsOverHttps(options);
    } else {
      this._tunnel = tunnel.httpsOverHttp(options);
    }
  },

tunnel-agent

HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.

Apache-2.0
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis