Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c29420

Browse filesBrowse files
davidbenevanlucas
authored andcommitted
test: fix test-https-agent-session-eviction for 1.1
This test is testing the workaround for an OpenSSL 1.0.x bug, which was fixed in 1.1.0. With the bug fixed, the test expectations need to change slightly. PR-URL: #16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 3d438f8 commit 8c29420
Copy full SHA for 8c29420

File tree

Expand file treeCollapse file tree

2 files changed

+24
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-8
lines changed
Open diff view settings
Collapse file

‎src/node_constants.cc‎

Copy file name to clipboardExpand all lines: src/node_constants.cc
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ void DefineSignalConstants(Local<Object> target) {
759759
}
760760

761761
void DefineOpenSSLConstants(Local<Object> target) {
762+
#ifdef OPENSSL_VERSION_NUMBER
763+
NODE_DEFINE_CONSTANT(target, OPENSSL_VERSION_NUMBER);
764+
#endif
765+
762766
#ifdef SSL_OP_ALL
763767
NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
764768
#endif
Collapse file

‎test/parallel/test-https-agent-session-eviction.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-agent-session-eviction.js
+20-8Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ if (!common.hasCrypto)
88

99
const assert = require('assert');
1010
const https = require('https');
11-
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
11+
const { OPENSSL_VERSION_NUMBER, SSL_OP_NO_TICKET } =
12+
require('crypto').constants;
1213

1314
const options = {
1415
key: readKey('agent1-key.pem'),
@@ -58,14 +59,25 @@ function second(server, session) {
5859
res.resume();
5960
});
6061

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

65-
req.on('close', function() {
66-
third(server);
67-
});
68-
}));
76+
req.on('close', function() {
77+
third(server);
78+
});
79+
}));
80+
}
6981
req.end();
7082
}
7183

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.