Skip to content

Commit 02df9a3

Browse files
committed
[fix] fix the correct order of arguments in ws-incoming passes
1 parent 881c7e6 commit 02df9a3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/http-proxy/passes/ws-incoming.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,21 @@ var passes = exports;
9696
*
9797
* @api private
9898
*/
99-
function stream(req, socket, server, head, clb) {
99+
function stream(req, socket, options, server, head, clb) {
100100
common.setupSocket(socket);
101101

102102
if (head && head.length) socket.unshift(head);
103103

104104

105-
var proxyReq = (~['https:', 'wss:'].indexOf(server.options.target.protocol) ? https : http).request(
106-
common.setupOutgoing(server.options.ssl || {}, server.options, req)
105+
var proxyReq = (~['https:', 'wss:'].indexOf(options.target.protocol) ? https : http).request(
106+
common.setupOutgoing(options.ssl || {}, options, req)
107107
);
108108
// Error Handler
109109
proxyReq.on('error', function(err){
110-
if(server) {
111-
server.emit('error', err);
112-
}
113-
else {
110+
if (clb) {
114111
clb(err);
112+
} else {
113+
server.emit('error', err, req, res);
115114
}
116115
});
117116

0 commit comments

Comments
 (0)