http-proxy
Advanced tools
Comparing version 0.8.4 to 0.8.5
@@ -77,2 +77,3 @@ /* | ||
args.forEach(function (arg) { | ||
arg = Number(arg) || arg; | ||
switch (typeof arg) { | ||
@@ -356,2 +357,5 @@ case 'string': host = arg; break; | ||
// require('http-proxy').setMaxSockets() should override http's default | ||
// configuration value (which is pretty low). | ||
options.maxSockets = options.maxSockets || maxSockets; | ||
agent = new Agent(options); | ||
@@ -358,0 +362,0 @@ |
{ | ||
"name": "http-proxy", | ||
"version": "0.8.4", | ||
"version": "0.8.5", | ||
"description": "A full-featured http reverse proxy for node.js", | ||
@@ -37,3 +37,3 @@ "author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
"scripts": { | ||
"test": "npm run-script test-http && npm run-script test-https", | ||
"test": "npm run-script test-http && npm run-script test-https && npm run-script test-core", | ||
"test-http": "vows --spec && vows --spec --target=https", | ||
@@ -40,0 +40,0 @@ "test-https": "vows --spec --proxy=https && vows --spec --proxy=https --target=https", |
@@ -32,3 +32,3 @@ // Copyright Joyent, Inc. and other Node contributors. | ||
if (process.platform == 'win32') { | ||
if (process.platform === 'win32') { | ||
exports.PIPE = '\\\\.\\pipe\\libuv-test'; | ||
@@ -58,5 +58,6 @@ } else { | ||
exports.ddCommand = function(filename, kilobytes) { | ||
if (process.platform == 'win32') { | ||
return '"' + process.argv[0] + '" "' + path.resolve(exports.fixturesDir, | ||
'create-file.js') + '" "' + filename + '" ' + (kilobytes * 1024); | ||
if (process.platform === 'win32') { | ||
var p = path.resolve(exports.fixturesDir, 'create-file.js'); | ||
return '"' + process.argv[0] + '" "' + p + '" "' + | ||
filename + '" ' + (kilobytes * 1024); | ||
} else { | ||
@@ -71,3 +72,3 @@ return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes; | ||
if (process.platform == 'win32') { | ||
if (process.platform === 'win32') { | ||
return spawn('cmd.exe', ['/c', 'cd'], options); | ||
@@ -94,2 +95,7 @@ } else { | ||
if (global.setImmediate) { | ||
knownGlobals.push(setImmediate); | ||
knownGlobals.push(clearImmediate); | ||
} | ||
if (global.errno) { | ||
@@ -125,2 +131,6 @@ knownGlobals.push(errno); | ||
knownGlobals.push(DataView); | ||
if (global.Uint8ClampedArray) { | ||
knownGlobals.push(Uint8ClampedArray); | ||
} | ||
} | ||
@@ -146,6 +156,41 @@ | ||
// This function allows one two run an HTTP test agaist both HTTPS and | ||
// normal HTTP modules. This ensures they fit the same API. | ||
exports.httpTest = function httpTest(cb) { | ||
var mustCallChecks = []; | ||
function runCallChecks() { | ||
var failed = mustCallChecks.filter(function(context) { | ||
return context.actual !== context.expected; | ||
}); | ||
failed.forEach(function(context) { | ||
console.log('Mismatched %s function calls. Expected %d, actual %d.', | ||
context.name, | ||
context.expected, | ||
context.actual); | ||
console.log(context.stack.split('\n').slice(2).join('\n')); | ||
}); | ||
if (failed.length) process.exit(1); | ||
} | ||
exports.mustCall = function(fn, expected) { | ||
if (typeof expected !== 'number') expected = 1; | ||
var context = { | ||
expected: expected, | ||
actual: 0, | ||
stack: (new Error).stack, | ||
name: fn.name || '<anonymous>' | ||
}; | ||
// add the exit listener only once to avoid listener leak warnings | ||
if (mustCallChecks.length === 0) process.on('exit', runCallChecks); | ||
mustCallChecks.push(context); | ||
return function() { | ||
context.actual++; | ||
return fn.apply(this, arguments); | ||
}; | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55
226198
80
5225