[fix] fix the correct order of arguments in ws-incoming passes

This commit is contained in:
cronopio 2013-10-21 23:22:32 -05:00
parent 881c7e62e0
commit 02df9a33c5

View File

@ -96,22 +96,21 @@ var passes = exports;
* *
* @api private * @api private
*/ */
function stream(req, socket, server, head, clb) { function stream(req, socket, options, server, head, clb) {
common.setupSocket(socket); common.setupSocket(socket);
if (head && head.length) socket.unshift(head); if (head && head.length) socket.unshift(head);
var proxyReq = (~['https:', 'wss:'].indexOf(server.options.target.protocol) ? https : http).request( var proxyReq = (~['https:', 'wss:'].indexOf(options.target.protocol) ? https : http).request(
common.setupOutgoing(server.options.ssl || {}, server.options, req) common.setupOutgoing(options.ssl || {}, options, req)
); );
// Error Handler // Error Handler
proxyReq.on('error', function(err){ proxyReq.on('error', function(err){
if(server) { if (clb) {
server.emit('error', err);
}
else {
clb(err); clb(err);
} else {
server.emit('error', err, req, res);
} }
}); });