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 Oct 11, 2017
1 parent 145d1db commit d410f74
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 @@ -25,13 +25,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 @@ -46,7 +45,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 @@ -58,7 +57,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 d410f74

Please sign in to comment.