Skip to content
Closed
Prev Previous commit
Next Next commit
XXX remove workaround for close_notify before NewSessionTicket
Code passes with the work-around, but it's a bug.  Not sure how to fix.

Calling SSL_read after after a close_notify is a bit dicy, but might
have to do that, but make sure that only 'session' events occur (ie.,
discard data and anything else). Seems subtly wrong.

Have asked openssl list how this is supposed to work.

This only happens with servers that .end() sync with no data in the
secureConnection event, and maybe those servers don't deserve ticket
support? Not sure.
  • Loading branch information
sam-github committed Feb 15, 2019
commit 928e0eb4e89db94dc9d7cd260ebe41086ce8fd8a
7 changes: 6 additions & 1 deletion test/parallel/test-tls-client-resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ const tls = require('tls');
const fixtures = require('../common/fixtures');

const options = {
enableTrace: true,
key: fixtures.readKey('agent2-key.pem'),
cert: fixtures.readKey('agent2-cert.pem')
};

// create server
const server = tls.Server(options, common.mustCall((socket) => {
socket.end('Goodbye');
// XXX a data-less end is needed to trigger the close_notify, followed
// by the NewSessionTicket records (which don't get read).
// socket.end('Goodbye');
socket.end();
}, 2));

// start listening
Expand All @@ -61,6 +65,7 @@ server.listen(0, common.mustCall(function() {
if (session1)
reconnect();
}));
client1.enableTrace();

client1.on('data', (d) => {
console.log('data1', d.toString());
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-tls-ticket.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function createServer() {
}, function(c) {
serverLog.push(id);
// XXX triggers close_notify before NewSessionTicket bug
// c.end();
c.end('x');
c.end();
// c.end('x');

counter++;

Expand Down Expand Up @@ -137,7 +137,7 @@ function start(callback) {
});
s.on('data', () => {
console.log('client %d: on data, do .end()', s.localPort);
s.end();
//s.end();
});
s.on('close', function() {
console.log('client %d: on close', localPort);
Expand Down