-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: throw when unable to set ciphers #21557
Conversation
7c7709e
to
bfbeb1d
Compare
src/node_crypto.cc
Outdated
if (!err) { | ||
return env->ThrowError("Failed to set ciphers"); | ||
} | ||
return ThrowCryptoError(env, err); |
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 realise this is an existing pattern but you can just return ThrowCryptoError(env, err, "Failed to set ciphers");
- it will use the message when err == 0
. Either way is fine though, it's the kind of cleanup that can wait for another PR.
/cc @nodejs/tsc |
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.
lgtm
bfbeb1d
to
132a188
Compare
One last CI run before landing: https://ci.nodejs.org/job/node-test-pull-request/15714/ |
132a188
to
a15ea5d
Compare
PR-URL: nodejs#21557 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This PR both clarifies the
ciphers
option for tls connections and makestls.createSecureContext()
throw (with an OpenSSL error message) ifciphers
is not acceptable.It may be worth mimicking this same behavior for other setter functions. While most others at least throw a generic error (while
SetCiphers()
silently ignored the return value when setting ciphers), I think tweaking those to include the OpenSSL error may be more helpful.CI: https://ci.nodejs.org/job/node-test-pull-request/15648/
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes