-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow agent reuse for ClientSSLSecurity if forever option is set #974
Conversation
thanks a lot @Mik13 - could you please document the feature in our |
if (!this.agent) { | ||
options.keepAlive = true; | ||
|
||
this.agent = new https.Agent(options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please initialize this property also within the constructor-function
test/security/ClientSSLSecurity.js
Outdated
firstOptions.agent.should.not.equal(secondOptions.agent); | ||
}); | ||
|
||
it('should not generate different agents if paramter given', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the description to "should return the same agent if paramter is present"
You're welcome @herom. I've changed the test description and added a short documentation to the readme. I hope this works |
Awesome 💛 Thanks a ton @Mik13 😸 |
It should be possible for SSL connections to reuse the tls session. Every request, the https agent is recreated.
This PR changes this:
If the
forever
flag is set in the options per request (3rd parameter) or by default when setting the security (4th parameter), it should reuse the same agent as the previous requests also usingforever
.The
request
-Module handles everything else, like setting thekeep-alive
-flag to the agent and the https module will cache the tls-session to the agent. Because of this, it is important that the same agent is used.Tests added