-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
tls: catch certCbDone exceptions
#6887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| 'use strict'; | ||
|
|
||
| if (!process.features.tls_sni) { | ||
| console.log('1..0 # Skipped: node compiled without OpenSSL or ' + | ||
| 'with old OpenSSL version.'); | ||
| return; | ||
| } | ||
|
|
||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
|
|
||
| if (!common.hasCrypto) { | ||
| console.log('1..0 # Skipped: missing crypto'); | ||
| return; | ||
| } | ||
|
|
||
| const tls = require('tls'); | ||
|
|
||
| const options = { | ||
| SNICallback: (name, callback) => { | ||
| callback(null, tls.createSecureContext()); | ||
| } | ||
| }; | ||
|
|
||
| const server = tls.createServer(options, (c) => { | ||
| assert(false, 'Should not be called'); | ||
| }).on('tlsClientError', common.mustCall((err, c) => { | ||
| assert(/SSL_use_certificate:passed a null parameter/i.test(err.message)); | ||
| server.close(); | ||
| })).listen(common.PORT, common.mustCall(() => { | ||
| const c = tls.connect({ | ||
| port: common.PORT, | ||
| rejectUnauthorized: false, | ||
| servername: 'any.name' | ||
| }, () => { | ||
| assert(false, 'Should not be called'); | ||
|
||
| }); | ||
|
|
||
| c.on('error', common.mustCall((err) => { | ||
| assert(err); | ||
|
||
| })); | ||
| })); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.