https-proxied
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -7,2 +7,3 @@ var tls = require('tls'), | ||
http = require('http'), | ||
HTTPParser = process.binding('http_parser').HTTPParser, | ||
inherits = require('util').inherits; | ||
@@ -14,3 +15,2 @@ | ||
var s; | ||
if (options.proxy) { | ||
@@ -97,3 +97,3 @@ s = clearTextSocket(port, host, options); | ||
var parser = parsers.alloc(parser); | ||
parser.reinitialize('response'); | ||
parser.reinitialize(HTTPParser.RESPONSE); | ||
parser.socket = socket; | ||
@@ -112,3 +112,3 @@ parser.incoming = null; | ||
socket.ondata = function(data, start, end) { | ||
var ret = parser.execute(data, start, end - start); | ||
var ret = parser.execute(data, start, end - start); | ||
if (ret instanceof Error) { | ||
@@ -127,2 +127,3 @@ socket.destroy(ret); | ||
parsers.free(parser); | ||
parser = null; | ||
if (cb) cb(); | ||
@@ -133,3 +134,6 @@ } | ||
socket.on('close', function() { | ||
parsers.free(parser); | ||
if (parser) { | ||
parsers.free(parser); | ||
parser = null; | ||
} | ||
}) | ||
@@ -140,5 +144,8 @@ | ||
var globalAgent = new Agent(); | ||
// each proxy has a globalAgent | ||
var globalAgents = { | ||
null: new Agent() | ||
}; | ||
exports.globalAgent = globalAgent; | ||
exports.globalAgent = globalAgents[null]; | ||
exports.Agent = Agent; | ||
@@ -152,3 +159,10 @@ | ||
if (options.agent === undefined) { | ||
options.agent = globalAgent; | ||
var key = options.proxy || null; | ||
if (key && typeof(key) === 'object') { | ||
key = url.format(key); | ||
} | ||
if (!globalAgents[key]) { | ||
globalAgents[key] = new Agent({proxy: options.proxy}); | ||
} | ||
options.agent = globalAgents[key]; | ||
} | ||
@@ -155,0 +169,0 @@ options.createConnection = createConnection; |
{ | ||
"name": "https-proxied", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A https client that works with SSL proxies", | ||
@@ -5,0 +5,0 @@ "engines": { "node": ">=0.6.0" }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14000
198
4