diff options
author | Rich Trott <rtrott@gmail.com> | 2018-05-25 13:21:43 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-05-31 09:35:07 +0200 |
commit | eadcee11372d8228bcb203a9ab97a5f7d61d4809 (patch) | |
tree | 4fa22d4c2a03c436c5c0628013b12ff5d2ce75c1 /test/parallel/test-tls-snicallback-error.js | |
parent | 89d211f54acea642cce65be731f4878555283ff0 (diff) | |
download | android-node-v8-eadcee11372d8228bcb203a9ab97a5f7d61d4809.tar.gz android-node-v8-eadcee11372d8228bcb203a9ab97a5f7d61d4809.tar.bz2 android-node-v8-eadcee11372d8228bcb203a9ab97a5f7d61d4809.zip |
tls: throw if SNICallback is not a function
If a value is passed for SNICallback and it is not a function,
createServer() will now throw.
PR-URL: https://github.com/nodejs/node/pull/20969
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-snicallback-error.js')
-rw-r--r-- | test/parallel/test-tls-snicallback-error.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/parallel/test-tls-snicallback-error.js b/test/parallel/test-tls-snicallback-error.js new file mode 100644 index 0000000000..307a359ebb --- /dev/null +++ b/test/parallel/test-tls-snicallback-error.js @@ -0,0 +1,17 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!process.features.tls_sni) + common.skip('compiled without OpenSSL or with old OpenSSL version'); + +const assert = require('assert'); +const tls = require('tls'); + +['fhqwhgads', 42, {}, []].forEach((testValue) => { + assert.throws( + () => { tls.createServer({ SNICallback: testValue }); }, + { code: 'ERR_INVALID_ARG_TYPE', message: /\boptions\.SNICallback\b/ } + ); +}); |