tls: accept SecureContext object in server.addContext()#47570
Merged
Conversation
addaleax
approved these changes
Apr 15, 2023
anonrig
approved these changes
Apr 15, 2023
Collaborator
Contributor
Author
|
Failing test: It looks like a flaky test (doesn't seem to be related to the PR and tried running locally) |
lpinca
approved these changes
Apr 15, 2023
Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext. Fixes: nodejs#47408
939c576 to
9660674
Compare
jasnell
reviewed
Apr 17, 2023
| [re, tls.createSecureContext(context).context]); | ||
|
|
||
| const secureContext = | ||
| context instanceof common.SecureContext ? context : tls.createSecureContext(context); |
Member
There was a problem hiding this comment.
Might be worth implementing a more efficient isSecureContext(...) method under util/types
Contributor
Author
There was a problem hiding this comment.
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.
jasnell
approved these changes
Apr 17, 2023
Contributor
Author
|
BTW, I can't add the labels myself. So I can't add |
Collaborator
39 tasks
Collaborator
Collaborator
This was referenced Apr 25, 2023
Collaborator
|
Landed in b54504c |
This was referenced Apr 27, 2023
yjl9903
pushed a commit
to yjl9903/node
that referenced
this pull request
Apr 28, 2023
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>
yjl9903
pushed a commit
to yjl9903/node
that referenced
this pull request
Apr 28, 2023
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