[fix] tests

This commit is contained in:
yawnt 2013-08-09 18:58:56 +02:00
parent 16eacfa961
commit a255f984fe
5 changed files with 348 additions and 5 deletions

341
cov/coverage.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
var http = require('http'), var http = require('http'),
https = require('https'), https = require('https'),
url = require('url'), url = require('url'),
caronte = require('./caronte'), caronte = require('./caronte/'),
events = require('eventemitter2'), events = require('eventemitter2'),
proxy = exports; proxy = exports;
@ -40,6 +40,7 @@ proxy.createProxyServer = function createProxyServer(options) {
} }
['target', 'forward'].forEach(function(key) { ['target', 'forward'].forEach(function(key) {
if(!options[key]) return;
options[key] = url.parse(options[key]); options[key] = url.parse(options[key]);
}); });

View File

@ -26,7 +26,7 @@ function deleteLength(req, res, options) {
if(req.method === 'DELETE' && !req.headers['content-length']) { if(req.method === 'DELETE' && !req.headers['content-length']) {
req.headers['content-length'] = '0'; req.headers['content-length'] = '0';
} }
} },
/** /**
* Sets timeout in request socket if it was specified in options. * Sets timeout in request socket if it was specified in options.
@ -42,7 +42,7 @@ function timeout(req, res, options) {
if(options.timeout) { if(options.timeout) {
req.socket.setTimeout(options.timeout); req.socket.setTimeout(options.timeout);
} }
} },
/** /**
* Sets `x-forwarded-*` headers if specified in config. * Sets `x-forwarded-*` headers if specified in config.
@ -69,7 +69,7 @@ function XHeaders(req, res, options) {
(req.headers['x-forwarded-' + header] ? ',' : '') + (req.headers['x-forwarded-' + header] ? ',' : '') +
values[header] values[header]
}); });
} },
/** /**
* Does the actual proxying. If `forward` is enabled fires up * Does the actual proxying. If `forward` is enabled fires up

1
lib/caronte/passes/ws.js Normal file
View File

@ -0,0 +1 @@
// ws

View File

@ -42,7 +42,7 @@ function ForwardStream() {
ForwardStream.prototype.onPipe = function(request) { ForwardStream.prototype.onPipe = function(request) {
this.forwardReq = (options.ssl ? https : http).request( this.forwardReq = (options.ssl ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, request); common.setupOutgoing(options.ssl || {}, options, request)
); );
}; };