From 86b4122323ca32d455714b1149b99acce49a9e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Wed, 2 Nov 2011 13:23:40 +0100 Subject: [PATCH] [v0.6] `http.Agent` uses different structure for sockets --- lib/node-http-proxy/http-proxy.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 7ae8b6c3e..9e5e5450b 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -753,9 +753,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) HttpProxy.prototype.close = function () { [this.forward, this.target].forEach(function (proxy) { if (proxy && proxy.agent) { - proxy.agent.sockets.forEach(function (socket) { - socket.end(); - }); + for (var host in proxy.agent.sockets) { + proxy.agent.sockets[host].forEach(function (socket) { + socket.end(); + }); + } } }); };