diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-09-01 16:14:56 +0200 |
---|---|---|
committer | Michael Dawson <michael_dawson@ca.ibm.com> | 2017-09-05 16:47:55 -0400 |
commit | 1403d28e7ded280e7582daa6e999164588d2234e (patch) | |
tree | 2987731226da0e733c1ccbaf8041e5d5badff1b8 /lib | |
parent | dc7f03c897b408c3ac521c491c245a93449f968a (diff) | |
download | android-node-v8-1403d28e7ded280e7582daa6e999164588d2234e.tar.gz android-node-v8-1403d28e7ded280e7582daa6e999164588d2234e.tar.bz2 android-node-v8-1403d28e7ded280e7582daa6e999164588d2234e.zip |
tls: re-allow falsey option values
5723c4c5f06f138 was an unintentional breaking change in that it changed
the behaviour of `tls.createSecureContext()` to throw on false-y input
rather than ignoring it. This breaks real-world applications like `npm`.
This restores the previous behaviour.
PR-URL: https://github.com/nodejs/node/pull/15131
Ref: https://github.com/nodejs/node/pull/15053
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: MichaƫZasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_tls_common.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_tls_common.js b/lib/_tls_common.js index ed0bd4c23f..92ba45d57e 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -80,7 +80,7 @@ exports.createSecureContext = function createSecureContext(options, context) { // NOTE: It's important to add CA before the cert to be able to load // cert's issuer in C++ code. var ca = options.ca; - if (ca !== undefined) { + if (ca) { if (Array.isArray(ca)) { for (i = 0; i < ca.length; ++i) { val = ca[i]; @@ -96,7 +96,7 @@ exports.createSecureContext = function createSecureContext(options, context) { } var cert = options.cert; - if (cert !== undefined) { + if (cert) { if (Array.isArray(cert)) { for (i = 0; i < cert.length; ++i) { val = cert[i]; @@ -115,7 +115,7 @@ exports.createSecureContext = function createSecureContext(options, context) { // which leads to the crash later on. var key = options.key; var passphrase = options.passphrase; - if (key !== undefined) { + if (key) { if (Array.isArray(key)) { for (i = 0; i < key.length; ++i) { val = key[i]; |