Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/parallel/test-http2-https-fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ function onSession(session, next) {
// Incompatible ALPN TLS client
tls(Object.assign({ port, ALPNProtocols: ['fake'] }, clientOptions))
.on('error', common.mustCall((err) => {
strictEqual(err.code, 'ECONNRESET');
const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`);
cleanup();
testNoALPN();
}));
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-http2-server-unknown-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ server.listen(0, function() {
rejectUnauthorized: false,
ALPNProtocols: ['bogus']
}).on('error', common.mustCall((err) => {
assert.strictEqual(err.code, 'ECONNRESET');
const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
assert.ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`);
}));
});
12 changes: 8 additions & 4 deletions test/parallel/test-tls-alpn-server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,17 @@ function TestFatalAlert() {
server.listen(0, serverIP, common.mustCall(() => {
const { port } = server.address();

// The Node.js client will just report ECONNRESET because the connection
// The Node.js client will just report ECONNRESET (older OpenSSL) or
// ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL because the connection
// is severed before the TLS handshake completes.
tls.connect({
host: serverIP,
port,
rejectUnauthorized: false,
ALPNProtocols: ['bar']
}, common.mustNotCall()).on('error', common.mustCall((err) => {
assert.strictEqual(err.code, 'ECONNRESET');
const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
assert.ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`);

// OpenSSL's s_client should output the TLS alert number, which is 120
// for the 'no_application_protocol' alert.
Expand Down Expand Up @@ -240,7 +242,8 @@ function TestALPNCallback() {

// Callback picks 2nd preference => undefined => ALPN rejected:
assert.strictEqual(results[1].server, undefined);
assert.strictEqual(results[1].client.error.code, 'ECONNRESET');
const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
assert.ok(allowedErrors.includes(results[1].client.error.code), `'${results[1].client.error.code}' was not one of ${allowedErrors}.`);

TestBadALPNCallback();
});
Expand All @@ -263,7 +266,8 @@ function TestBadALPNCallback() {
runTest(clientsOptions, serverOptions, function(results) {
// Callback returns 'http/5' => doesn't match client ALPN => error & reset
assert.strictEqual(results[0].server, undefined);
assert.strictEqual(results[0].client.error.code, 'ECONNRESET');
const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
assert.ok(allowedErrors.includes(results[0].client.error.code), `'${results[0].client.error.code}' was not one of ${allowedErrors}.`);

TestALPNOptionsCallback();
});
Expand Down