Skip to content

Commit 379b5f7

Browse files
codebyteretargos
authored andcommitted
tls: tweak clientCertEngine argument parsing
PR-URL: #38900 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 69fa9e1 commit 379b5f7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/internal/tls.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ function configSecureContext(context, options = {}, name = 'options') {
305305
}
306306
}
307307

308-
if (clientCertEngine !== undefined) {
308+
if (typeof clientCertEngine === 'string') {
309309
if (typeof context.setClientCertEngine !== 'function')
310310
throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
311-
if (typeof clientCertEngine !== 'string') {
312-
throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
313-
['string', 'null', 'undefined'],
314-
clientCertEngine);
315-
}
316-
context.setClientCertEngine(clientCertEngine);
311+
else
312+
context.setClientCertEngine(clientCertEngine);
313+
} else if (clientCertEngine !== undefined) {
314+
throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
315+
['string', 'null', 'undefined'],
316+
clientCertEngine);
317317
}
318318

319319
if (ticketKeys !== undefined) {

0 commit comments

Comments
 (0)