-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
tls: do not crash on STARTTLS when OCSP requested #10706
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 2 commits
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,49 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack |
||
| if (!common.hasCrypto) { | ||
| common.skip('missing crypto'); | ||
| return; | ||
| } | ||
|
|
||
| const assert = require('assert'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sort requires
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack |
||
| const net = require('net'); | ||
| const tls = require('tls'); | ||
| const fs = require('fs'); | ||
|
|
||
| const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); | ||
| const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); | ||
|
|
||
| const server = net.createServer(common.mustCall((s) => { | ||
| const tlsSocket = new tls.TLSSocket(s, { | ||
| isServer: true, | ||
| server: server, | ||
|
|
||
| secureContext: tls.createSecureContext({ | ||
| key: key, | ||
| cert: cert | ||
| }), | ||
|
|
||
| SNICallback: common.mustCall((hostname, callback) => { | ||
| assert.deepEqual(hostname, 'test.test'); | ||
|
|
||
| callback(null, null); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is valid and it should be valid. |
||
| }) | ||
| }); | ||
|
|
||
| tlsSocket.on('secure', common.mustCall(() => { | ||
| tlsSocket.end(); | ||
| server.close(); | ||
| })); | ||
| })).listen(0, () => { | ||
| const opts = { | ||
| servername: 'test.test', | ||
| port: server.address().port, | ||
| rejectUnauthorized: false, | ||
| requestOCSP: true | ||
| }; | ||
|
|
||
| const client = tls.connect(opts, function() { | ||
| client.end(); | ||
|
||
| }); | ||
| }); | ||
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.
This comment confused me when I read it, and I only understood when reading the unit test and PR history. Can I suggest:
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.
ping
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.
Agreed this comment is rather cryptic.