mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
close websocket if proxyReq is closed before upgrade
avoids leaving client sockets open when upstream connections are rejected.
This commit is contained in:
parent
77305489d9
commit
bcd8a564a8
@ -89,6 +89,10 @@ var passes = exports;
|
|||||||
);
|
);
|
||||||
// Error Handler
|
// Error Handler
|
||||||
proxyReq.on('error', onOutgoingError);
|
proxyReq.on('error', onOutgoingError);
|
||||||
|
proxyReq.on('response', function (res) {
|
||||||
|
// if upgrade event isn't going to happen, close the socket
|
||||||
|
if (!res.upgrade) socket.end();
|
||||||
|
});
|
||||||
|
|
||||||
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
|
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
|
||||||
proxySocket.on('error', onOutgoingError);
|
proxySocket.on('error', onOutgoingError);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user