Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ssl socket leak when keepalive is used #5713

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done as a single call like options = Object.assign({}, options, this.options);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was done this way in order to remain consistent with the rest of the file. If we're refactoring this to an Object.assign we might as well refactor the one in createSocket to use Object.assign.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring the rest of the file isn't really necessary, and it will add unnecessary noise, making it a lot harder to use tools like git blame.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So can we keep the same syntax throughout the file (_extends) and refactor it to a Object.assign at a future PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.assign is not available in v0.12 in case the change has to be merged there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benjamingr we usually just update things like that when the code needs to be updated for some other reason.

@saperal ok, feel free to leave this as is.

options = util._extend(options, this.options);

var name = this.getName(options);
if (!this.sockets[name]) {
this.sockets[name] = [];
Expand Down