★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/849f5c31c8Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
test: make tls test more rigorous
* exit naturally, don't use process.exit()
* ensure callbacks are actually called

PR-URL: #18792
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
bnoordhuis authored and MylesBorins committed Feb 21, 2018
1 parent cf10a94 commit 849f5c31c846fa712fa60a84b5d4e9753ff22510
Showing with 7 additions and 7 deletions.
  1. +7 −7 test/parallel/test-tls-connect-no-host.js
@@ -6,7 +6,6 @@ if (!common.hasCrypto)
common.skip('missing crypto');

const tls = require('tls');

const assert = require('assert');

const cert = fixtures.readSync('test_cert.pem');
@@ -15,19 +14,20 @@ const key = fixtures.readSync('test_key.pem');
// https://github.com/nodejs/node/issues/1489
// tls.connect(options) with no options.host should accept a cert with
// CN:'localhost'
tls.createServer({
const server = tls.createServer({
key,
cert
}).listen(0, function() {
}).listen(0, common.mustCall(function() {
const socket = tls.connect({
port: this.address().port,
ca: cert,
// No host set here. 'localhost' is the default,
// but tls.checkServerIdentity() breaks before the fix with:
// Error: Hostname/IP doesn't match certificate's altnames:
// "Host: undefined. is not cert's CN: localhost"
}, function() {
}, common.mustCall(function() {
assert(socket.authorized);
process.exit();
});
});
socket.destroy();
server.close();
}));
}));

0 comments on commit 849f5c3

Please sign in to comment.