summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-async-cb-after-socket-end.js
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-01-30 12:18:04 -0800
committerSam Roberts <vieuxtech@gmail.com>2019-02-01 19:06:58 -0800
commit0f8e8f7c6b9e7a8bdae53c831f37b2034d1c9fa7 (patch)
tree2b7d72ab24c8b9538e4e1da9a3fa5c71482fdb01 /test/parallel/test-tls-async-cb-after-socket-end.js
parente1aa9438ead2093a536e5981da7097c9196e7113 (diff)
downloadandroid-node-v8-0f8e8f7c6b9e7a8bdae53c831f37b2034d1c9fa7.tar.gz
android-node-v8-0f8e8f7c6b9e7a8bdae53c831f37b2034d1c9fa7.tar.bz2
android-node-v8-0f8e8f7c6b9e7a8bdae53c831f37b2034d1c9fa7.zip
tls: introduce client 'session' event
OpenSSL has supported async notification of sessions and tickets since 1.1.0 using SSL_CTX_sess_set_new_cb(), for all versions of TLS. Using the async API is optional for TLS1.2 and below, but for TLS1.3 it will be mandatory. Future-proof applications should start to use async notification immediately. In the future, for TLS1.3, applications that don't use the async API will silently, but gracefully, fail to resume sessions and instead do a full handshake. See: https://wiki.openssl.org/index.php/TLS1.3#Sessions PR-URL: https://github.com/nodejs/node/pull/25831 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-async-cb-after-socket-end.js')
-rw-r--r--test/parallel/test-tls-async-cb-after-socket-end.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/parallel/test-tls-async-cb-after-socket-end.js b/test/parallel/test-tls-async-cb-after-socket-end.js
index 6ca38461fd..5c812c8f04 100644
--- a/test/parallel/test-tls-async-cb-after-socket-end.js
+++ b/test/parallel/test-tls-async-cb-after-socket-end.js
@@ -6,9 +6,15 @@ const fixtures = require('../common/fixtures');
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
const tls = require('tls');
-// Check tls async callback after socket ends
+// Check that TLS1.2 session resumption callbacks don't explode when made after
+// the tls socket is destroyed. Disable TLS ticket support to force the legacy
+// session resumption mechanism to be used.
+
+// TLS1.2 is the last protocol version to support TLS sessions, after that the
+// new and resume session events will never be emitted on the server.
const options = {
+ maxVersion: 'TLSv1.2',
secureOptions: SSL_OP_NO_TICKET,
key: fixtures.readSync('test_key.pem'),
cert: fixtures.readSync('test_cert.pem')
@@ -25,6 +31,8 @@ server.on('newSession', common.mustCall((key, session, done) => {
server.on('resumeSession', common.mustCall((id, cb) => {
sessionCb = cb;
+ // Destroy the client and then call the session cb, to check that the cb
+ // doesn't explode when called after the handle has been destroyed.
next();
}));