From f789e8cab8cae241d81e7706ec80ee5245a0becf Mon Sep 17 00:00:00 2001 From: Yoshihiro Kikuchi Date: Thu, 13 Oct 2011 17:48:30 +0900 Subject: [PATCH 1/2] tiny fix in http.js --- lib/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/http.js b/lib/http.js index b3068552d04..ad2e1606fcc 100644 --- a/lib/http.js +++ b/lib/http.js @@ -957,7 +957,7 @@ Agent.prototype.createSocket = function(name, host, port) { }; Agent.prototype.removeSocket = function(s, name, host, port) { if (this.sockets[name] && this.sockets[name].indexOf(s) !== -1) { - this.sockets[name].shift(this.sockets[name].indexOf(s)); + this.sockets[name].splice(this.sockets[name].indexOf(s), 1); } else if (this.sockets[name] && this.sockets[name].length === 0) { // don't leak delete this.sockets[name]; From ee4e22a1734c65a9d4a82a8c4619bd510664f632 Mon Sep 17 00:00:00 2001 From: Yoshihiro Kikuchi Date: Sun, 16 Oct 2011 23:02:34 +0900 Subject: [PATCH 2/2] tiny fix in http.js pt.2 --- lib/http.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/http.js b/lib/http.js index ad2e1606fcc..dc83ec69254 100644 --- a/lib/http.js +++ b/lib/http.js @@ -956,8 +956,11 @@ Agent.prototype.createSocket = function(name, host, port) { return s; }; Agent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name] && this.sockets[name].indexOf(s) !== -1) { - this.sockets[name].splice(this.sockets[name].indexOf(s), 1); + if (this.sockets[name]) { + var index = this.sockets[name].indexOf(s); + if (index !== -1) { + this.sockets[name].splice(index, 1); + } } else if (this.sockets[name] && this.sockets[name].length === 0) { // don't leak delete this.sockets[name];