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.
Might be worth implementing a more efficient isSecureContext(...) method under util/types
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.
|
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