Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

https-proxied

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

https-proxied - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

60

lib/https-proxied.js

@@ -9,22 +9,12 @@ var tls = require('tls'),

var agents = {};
var parsers = http.parsers;
function Agent(options) {
http.Agent.call(this, options);
}
inherits(Agent, http.Agent);
Agent.prototype.defaultPort = 443;
Agent.prototype._getConnection = function(host, port, cb) {
function createConnection(port, host, options) {
var s;
cb = cb || function() {};
if (this.options.proxy) {
s = clearTextSocket(host, port, this.options, cb);
if (options.proxy) {
s = clearTextSocket(port, host, options);
}
else {
s = tls.connect(port, host, this.options, cb);
s = tls.connect(port, host, options);
}

@@ -35,5 +25,14 @@

function Agent(options) {
http.Agent.call(this, options);
this.createConnection = createConnection;
}
inherits(Agent, http.Agent);
Agent.prototype.defaultPort = 443;
var Connection = process.binding('crypto').Connection
function clearTextSocket(host, port, options, cb) {
function clearTextSocket(port, host, options) {
var sslcontext = crypto.createCredentials({});

@@ -54,6 +53,3 @@ var pair = tls.createSecurePair(sslcontext, false);

pair._doneFlag = false;
pair.cycle();
pair.on('secure', function() {
if (cb) cb();
});
pair.cycle();
});

@@ -141,24 +137,18 @@

function getAgent(options) {
if (!options.port) options.port = 443;
var globalAgent = new Agent();
var id = options.host + ':' + options.port;
var agent = agents[id];
exports.globalAgent = globalAgent;
exports.Agent = Agent;
if (!agent) {
agent = agents[id] = new Agent(options);
exports.request = function(options, cb) {
if (options.protocol && options.protocol !== 'https:') {
throw new Error('Protocol:' + options.protocol + ' not supported.');
}
return agent;
}
exports.getAgent = getAgent;
exports.Agent = Agent;
exports.request = function(options, cb) {
if (options.agent === undefined) {
options.agent = getAgent(options);
} else if (options.agent === false) {
options.agent = new Agent(options);
options.agent = globalAgent;
}
return http._requestFromAgent(options, cb);
options.createConnection = createConnection;
options.defaultPort = options.defaultPort || 443;
return new http.ClientRequest(options, cb);
};

@@ -165,0 +155,0 @@

{
"name": "https-proxied",
"version": "0.0.3",
"version": "0.0.4",
"description": "A https client that works with SSL proxies",
"engines": { "node": ">=0.4.0" },
"engines": { "node": ">=0.6.0" },
"author": "Vinay Pulim <v@pulim.com>",

@@ -7,0 +7,0 @@ "repository" : {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc