test: refactor parallel/test-tls-0-dns-altname

PR-URL: https://github.com/nodejs/node/pull/18803
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
pull/18803/merge
juggernaut451 2018-02-16 01:45:50 +05:30 committed by James M Snell
parent 1fd69872e6
commit 760f86c75b
1 changed files with 6 additions and 6 deletions

View File

@ -33,15 +33,15 @@ const fixtures = require('../common/fixtures');
const server = tls.createServer({
key: fixtures.readSync(['0-dns', '0-dns-key.pem']),
cert: fixtures.readSync(['0-dns', '0-dns-cert.pem'])
}, function(c) {
c.once('data', function() {
}, common.mustCall((c) => {
c.once('data', common.mustCall(() => {
c.destroy();
server.close();
});
}).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, {
}));
})).listen(0, common.mustCall(() => {
const c = tls.connect(server.address().port, {
rejectUnauthorized: false
}, common.mustCall(function() {
}, common.mustCall(() => {
const cert = c.getPeerCertificate();
assert.strictEqual(cert.subjectaltname,
'DNS:good.example.org\0.evil.example.com, ' +