Skip to content

Commit

Permalink
https: fix ssl socket leak when keepalive is used
Browse files Browse the repository at this point in the history
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: #5713
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
alexpenev-s authored and Myles Borins committed Mar 30, 2016
1 parent c0a24e4 commit 8187661
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [];
Expand Down

0 comments on commit 8187661

Please sign in to comment.