Skip to content

Commit

Permalink
test: use common.fixtures in checkServerIdentity
Browse files Browse the repository at this point in the history
PR-URL: #15951
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
forivall authored and MylesBorins committed Nov 28, 2017
1 parent 909e587 commit 48a55d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/parallel/test-https-client-checkServerIdentity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ if (!common.hasCrypto)
common.skip('missing crypto');

const assert = require('assert');
const fixtures = require('../common/fixtures');
const https = require('https');
const fs = require('fs');
const path = require('path');

const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
key: fixtures.readKey('agent3-key.pem'),
cert: fixtures.readKey('agent3-cert.pem')
};

const server = https.createServer(options, common.mustCall(function(req, res) {
Expand All @@ -25,7 +24,7 @@ function authorized() {
const req = https.request({
port: server.address().port,
rejectUnauthorized: true,
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
ca: [fixtures.readKey('ca2-cert.pem')]
}, common.mustNotCall());
req.on('error', function(err) {
override();
Expand All @@ -37,7 +36,7 @@ function override() {
const options = {
port: server.address().port,
rejectUnauthorized: true,
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
ca: [fixtures.readKey('ca2-cert.pem')],
checkServerIdentity: function(host, cert) {
return false;
}
Expand Down

0 comments on commit 48a55d1

Please sign in to comment.