test: use common.fixtures in checkServerIdentity
PR-URL: https://github.com/nodejs/node/pull/15951 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
b3a8bf3dca
commit
41b65b9fa3
@ -25,13 +25,12 @@ if (!common.hasCrypto)
|
|||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const fixtures = require('../common/fixtures');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
|
key: fixtures.readKey('agent3-key.pem'),
|
||||||
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
|
cert: fixtures.readKey('agent3-cert.pem')
|
||||||
};
|
};
|
||||||
|
|
||||||
const server = https.createServer(options, common.mustCall(function(req, res) {
|
const server = https.createServer(options, common.mustCall(function(req, res) {
|
||||||
@ -46,7 +45,7 @@ function authorized() {
|
|||||||
const req = https.request({
|
const req = https.request({
|
||||||
port: server.address().port,
|
port: server.address().port,
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
|
ca: [fixtures.readKey('ca2-cert.pem')]
|
||||||
}, common.mustNotCall());
|
}, common.mustNotCall());
|
||||||
req.on('error', function(err) {
|
req.on('error', function(err) {
|
||||||
override();
|
override();
|
||||||
@ -58,7 +57,7 @@ function override() {
|
|||||||
const options = {
|
const options = {
|
||||||
port: server.address().port,
|
port: server.address().port,
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
|
ca: [fixtures.readKey('ca2-cert.pem')],
|
||||||
checkServerIdentity: function(host, cert) {
|
checkServerIdentity: function(host, cert) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user