| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 53a67ed commit b956635
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,7 +184,11 @@ function oncertcb(info) { | |||
| 184 | 184 | if (!self._handle) | |
| 185 | 185 | return self.destroy(new Error('Socket is closed')); | |
| 186 | 186 | ||
| 187 | - self._handle.certCbDone(); | ||
| 187 | + try { | ||
| 188 | + self._handle.certCbDone(); | ||
| 189 | + } catch (e) { | ||
| 190 | + self.destroy(e); | ||
| 191 | + } | ||
| 188 | 192 | }); | |
| 189 | 193 | }); | |
| 190 | 194 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,42 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + if (!process.features.tls_sni) { | ||
| 4 | + console.log('1..0 # Skipped: node compiled without OpenSSL or ' + | ||
| 5 | + 'with old OpenSSL version.'); | ||
| 6 | + return; | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + const common = require('../common'); | ||
| 10 | + const assert = require('assert'); | ||
| 11 | + | ||
| 12 | + if (!common.hasCrypto) { | ||
| 13 | + console.log('1..0 # Skipped: missing crypto'); | ||
| 14 | + return; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + const tls = require('tls'); | ||
| 18 | + | ||
| 19 | + const options = { | ||
| 20 | + SNICallback: (name, callback) => { | ||
| 21 | + callback(null, tls.createSecureContext()); | ||
| 22 | + } | ||
| 23 | + }; | ||
| 24 | + | ||
| 25 | + const server = tls.createServer(options, (c) => { | ||
| 26 | + common.fail('Should not be called'); | ||
| 27 | + }).on('clientError', common.mustCall((err, c) => { | ||
| 28 | + assert(/SSL_use_certificate:passed a null parameter/i.test(err.message)); | ||
| 29 | + server.close(); | ||
| 30 | + })).listen(common.PORT, common.mustCall(() => { | ||
| 31 | + const c = tls.connect({ | ||
| 32 | + port: common.PORT, | ||
| 33 | + rejectUnauthorized: false, | ||
| 34 | + servername: 'any.name' | ||
| 35 | + }, () => { | ||
| 36 | + common.fail('Should not be called'); | ||
| 37 | + }); | ||
| 38 | + | ||
| 39 | + c.on('error', common.mustCall((err) => { | ||
| 40 | + assert(/socket hang up/.test(err.message)); | ||
| 41 | + })); | ||
| 42 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments