-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
tls: accept SecureContext object in server.addContext() #47570
Conversation
Failing test: It looks like a flaky test (doesn't seem to be related to the PR and tried running locally) |
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408
939c576
to
9660674
Compare
[re, tls.createSecureContext(context).context]); | ||
|
||
const secureContext = | ||
context instanceof common.SecureContext ? context : tls.createSecureContext(context); |
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.
Might be worth implementing a more efficient isSecureContext(...)
method under util/types
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.
I don't think this function is in hot path (there are limited number of subdomains & certs), so might not be worth the perf improvement vs code growth in primordials
. Not too sure, CMIIW.
BTW, I can't add the labels myself. So I can't add |
Landed in b54504c |
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408 PR-URL: nodejs#47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408 PR-URL: nodejs#47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408 PR-URL: nodejs#47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: #47408 PR-URL: #47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: #47408 PR-URL: #47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408 PR-URL: nodejs#47570 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext.
Fixes: #47408