diff --git a/lib/caronte/passes/ws.js b/lib/caronte/passes/ws.js index 3f44e5daa..821cb2eb0 100644 --- a/lib/caronte/passes/ws.js +++ b/lib/caronte/passes/ws.js @@ -72,11 +72,11 @@ function XHeaders(req, socket, options) { * */ function stream(req, socket, options, head) { - var r = http.request( + var proxyReq = http.request( common.setupOutgoing(options.ssl || {}, options, req) ); - r.on('upgrade', function(proxyRes, proxySocket, proxyHead) { + proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) { if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead); socket.write('HTTP/1.1 101 Switching Protocols\r\n'); @@ -86,7 +86,7 @@ function stream(req, socket, options, head) { proxySocket.pipe(socket).pipe(proxySocket); }); - r.end(); + proxyReq.end(); } ] // <--