| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5fa40be commit b71c8c4
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -909,7 +909,7 @@ TLSSocket.prototype._init = function(socket, wrap) { | |||
| 909 | 909 | options.SNICallback && | |
| 910 | 910 | (options.SNICallback !== SNICallback || | |
| 911 | 911 | (options.server && options.server._contexts.length))) { | |
| 912 | - assert(typeof options.SNICallback === 'function'); | ||
| 912 | + validateFunction(options.SNICallback, 'options.SNICallback'); | ||
| 913 | 913 | this._SNICallback = options.SNICallback; | |
| 914 | 914 | ssl.enableCertCb(); | |
| 915 | 915 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,11 +4,21 @@ if (!common.hasCrypto) | |||
| 4 | 4 | common.skip('missing crypto'); | |
| 5 | 5 | ||
| 6 | 6 | const assert = require('assert'); | |
| 7 | + const net = require('net'); | ||
| 7 | 8 | const tls = require('tls'); | |
| 8 | 9 | ||
| 9 | - ['fhqwhgads', 42, {}, []].forEach((testValue) => { | ||
| 10 | - assert.throws( | ||
| 11 | - () => { tls.createServer({ SNICallback: testValue }); }, | ||
| 12 | - { code: 'ERR_INVALID_ARG_TYPE', message: /\boptions\.SNICallback\b/ } | ||
| 13 | - ); | ||
| 14 | - }); | ||
| 10 | + for (const SNICallback of ['fhqwhgads', 42, {}, []]) { | ||
| 11 | + assert.throws(() => { | ||
| 12 | + tls.createServer({ SNICallback }); | ||
| 13 | + }, { | ||
| 14 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 15 | + name: 'TypeError', | ||
| 16 | + }); | ||
| 17 | + | ||
| 18 | + assert.throws(() => { | ||
| 19 | + new tls.TLSSocket(new net.Socket(), { isServer: true, SNICallback }); | ||
| 20 | + }, { | ||
| 21 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 22 | + name: 'TypeError', | ||
| 23 | + }); | ||
| 24 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments