mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: more regression tests for minDHSize option
Check that tls.connect() fails in the expected way when passing in invalid minDHSize options. PR-URL: https://github.com/nodejs/node/pull/3629 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
parent
cddf358f68
commit
82022a79b0
@ -974,7 +974,7 @@ exports.connect = function(/* [port, host], options, cb */) {
|
||||
assert(typeof options.minDHSize === 'number',
|
||||
'options.minDHSize is not a number: ' + options.minDHSize);
|
||||
assert(options.minDHSize > 0,
|
||||
'options.minDHSize is not a posivie number: ' +
|
||||
'options.minDHSize is not a positive number: ' +
|
||||
options.minDHSize);
|
||||
|
||||
var hostname = options.servername ||
|
||||
|
@ -78,6 +78,15 @@ testDHE1024();
|
||||
assert.throws(() => test(512, true, assert.fail),
|
||||
/DH parameter is less than 1024 bits/);
|
||||
|
||||
[0, -1, -Infinity, NaN].forEach(minDHSize => {
|
||||
assert.throws(() => tls.connect({ minDHSize }),
|
||||
/minDHSize is not a positive number/);
|
||||
});
|
||||
|
||||
[true, false, null, undefined, {}, [], '', '1'].forEach(minDHSize => {
|
||||
assert.throws(() => tls.connect({ minDHSize }), /minDHSize is not a number/);
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(nsuccess, 1);
|
||||
assert.equal(nerror, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user