mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
609cd7f5bf
If user uses invalid type for `options.SNICallback` in TLSSocket(), it's not internal issue of Node.js. So validateFunction() is more proper than assert(). PR-URL: https://github.com/nodejs/node/pull/50530 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
25 lines
558 B
JavaScript
25 lines
558 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const tls = require('tls');
|
|
|
|
for (const SNICallback of ['fhqwhgads', 42, {}, []]) {
|
|
assert.throws(() => {
|
|
tls.createServer({ SNICallback });
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
});
|
|
|
|
assert.throws(() => {
|
|
new tls.TLSSocket(new net.Socket(), { isServer: true, SNICallback });
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
});
|
|
}
|