summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Penev <alexander.penev@sap.com>2016-03-14 17:56:02 +0200
committerBenjamin Gruenbaum <inglor@gmail.com>2016-03-17 14:32:49 +0200
commit2e1ae3ead1a3bb7edb8bdb0e717135207d3bfd12 (patch)
tree00f7aa6ff39e918d451fb285bf821a445fabefa5
parent9eb0ef4c2cea8359ee5004638484021bc8093274 (diff)
downloadandroid-node-v8-2e1ae3ead1a3bb7edb8bdb0e717135207d3bfd12.tar.gz
android-node-v8-2e1ae3ead1a3bb7edb8bdb0e717135207d3bfd12.tar.bz2
android-node-v8-2e1ae3ead1a3bb7edb8bdb0e717135207d3bfd12.zip
https: fix ssl socket leak when keepalive is used
SSL sockets leak whenever keep alive is enabled, ca option is set in the global agent, and requests are sent without the ca property. In the following case at Agent.prototype.createSocket a socket will be created with a hashtag name that includes data from the global agents’ ca property. On subsequent requests at Agent.prototype.addRequest we do not find the free socket, because the hashtag name generated there does not take into account the global agents’ ca property, thus creating a new socket and leaving the first socket to timeout. closes: #5699 PR-URL: https://github.com/nodejs/node/pull/5713 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--lib/_http_agent.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/_http_agent.js b/lib/_http_agent.js
index 5828927786..fd74daafec 100644
--- a/lib/_http_agent.js
+++ b/lib/_http_agent.js
@@ -115,6 +115,9 @@ Agent.prototype.addRequest = function(req, options) {
};
}
+ options = util._extend({}, options);
+ options = util._extend(options, this.options);
+
var name = this.getName(options);
if (!this.sockets[name]) {
this.sockets[name] = [];