[fix] write status

This commit is contained in:
yawnt 2013-09-15 18:02:00 +02:00
parent 60de543d04
commit e08d4edad3
4 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
var caronte = exports,
web = require('./passes/web');
ws = require('./passes/ws');
web = require('./passes/web-incoming');
ws = require('./passes/ws-incoming');
caronte.createWebProxy = createRightProxy('web');
caronte.createWsProxy = createRightProxy('ws');

View File

@ -91,7 +91,7 @@ function XHeaders(req, res, options) {
function stream(req, res, options) {
if(options.forward) {
var forwardReq = (options.target.protocol === 'https:' ? https : http).request(
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
);
req.pipe(forwardReq);

View File

@ -9,11 +9,17 @@ var passes = exports;
*/
[ // <--
function writeStatusCode(res, proxyRes) {
res.writeHead(proxyRes.statusCode);
},
function writeHeaders(res, proxyRes) {
Object.keys(proxyRes.headers).forEach(function(key) {
res.setHeader(key, proxyRes.headers[key]);
});
}
] // <--
.forEach(function(func) {
passes[func.name] = func;