Skip to content

Commit

Permalink
test: remove workaround for unsupported OpenSSLs
Browse files Browse the repository at this point in the history
Workaround added in d9b9229 is no longer needed, since OpenSSL
versions lower than 1.1.1 are unsupported.

PR-URL: #28085
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
sam-github authored and BridgeAR committed Jun 17, 2019
1 parent 8984b73 commit 14bd26c
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions test/parallel/test-https-agent-session-eviction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ const { readKey } = require('../common/fixtures');
if (!common.hasCrypto)
common.skip('missing crypto');

const assert = require('assert');
const https = require('https');
const { OPENSSL_VERSION_NUMBER, SSL_OP_NO_TICKET } =
require('crypto').constants;
const { SSL_OP_NO_TICKET } = require('crypto').constants;

const options = {
key: readKey('agent1-key.pem'),
Expand Down Expand Up @@ -60,38 +58,12 @@ function second(server, session) {
res.resume();
});

if (OPENSSL_VERSION_NUMBER >= 0x10100000) {
// Although we have a TLS 1.2 session to offer to the TLS 1.0 server,
// connection to the TLS 1.0 server should work.
req.on('response', common.mustCall(function(res) {
// The test is now complete for OpenSSL 1.1.0.
server.close();
}));
} else {
// OpenSSL 1.0.x mistakenly locked versions based on the session it was
// offering. This causes this sequent request to fail. Let it fail, but
// test that this is mitigated on the next try by invalidating the session.
req.on('error', common.mustCall(function(err) {
assert(/wrong version number/.test(err.message));

req.on('close', function() {
third(server);
});
}));
}
req.end();
}

// Try one more time - session should be evicted!
function third(server) {
const req = https.request({
port: server.address().port,
rejectUnauthorized: false
}, function(res) {
res.resume();
assert(!req.socket.isSessionReused());
// Although we have a TLS 1.2 session to offer to the TLS 1.0 server,
// connection to the TLS 1.0 server should work.
req.on('response', common.mustCall(function(res) {
// The test is now complete for OpenSSL 1.1.0.
server.close();
});
req.on('error', common.mustNotCall());
}));

req.end();
}

0 comments on commit 14bd26c

Please sign in to comment.