diff options
author | Shelley Vohr <shelley.vohr@gmail.com> | 2021-06-02 12:10:50 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2021-06-11 08:24:54 +0300 |
commit | 379b5f79a9e974668e632f8cf461a16e6d4e7ba9 (patch) | |
tree | 52b9de5e639c63eecc90d42b5a6c32b62b3d00a5 /lib | |
parent | 69fa9e16e9593618a068213a1afe38883bcff5be (diff) |
tls: tweak clientCertEngine argument parsing
PR-URL: https://github.com/nodejs/node/pull/38900
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/tls.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/internal/tls.js b/lib/internal/tls.js index 0ebecb57c88..0a9eea8f3eb 100644 --- a/lib/internal/tls.js +++ b/lib/internal/tls.js @@ -305,15 +305,15 @@ function configSecureContext(context, options = {}, name = 'options') { } } - if (clientCertEngine !== undefined) { + if (typeof clientCertEngine === 'string') { if (typeof context.setClientCertEngine !== 'function') throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED(); - if (typeof clientCertEngine !== 'string') { - throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`, - ['string', 'null', 'undefined'], - clientCertEngine); - } - context.setClientCertEngine(clientCertEngine); + else + context.setClientCertEngine(clientCertEngine); + } else if (clientCertEngine !== undefined) { + throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`, + ['string', 'null', 'undefined'], + clientCertEngine); } if (ticketKeys !== undefined) { |