2016-10-20 18:39:05 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
testDefault();
|
|
|
|
|
|
|
|
// backwards compat
|
|
|
|
function testDefault() {
|
|
|
|
require('https').globalAgent.options.ca = null;
|
|
|
|
var rootCas = require('./latest');
|
|
|
|
var request = require('request');
|
|
|
|
|
|
|
|
require('https').globalAgent.options.ca = rootCas;
|
2018-02-13 18:55:22 +00:00
|
|
|
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
|
2016-10-20 18:39:05 +00:00
|
|
|
if (err) {
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
|
|
|
|
testInject();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testInject() {
|
|
|
|
require('https').globalAgent.options.ca = null;
|
|
|
|
var rootCas = require('./latest').inject();
|
|
|
|
var request = require('request');
|
|
|
|
|
|
|
|
require('https').globalAgent.options.ca = rootCas;
|
2018-02-13 18:55:22 +00:00
|
|
|
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
|
2016-10-20 18:39:05 +00:00
|
|
|
if (err) {
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
|
|
|
|
testCreate();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testCreate() {
|
|
|
|
require('https').globalAgent.options.ca = null;
|
|
|
|
var rootCas = require('./latest').create();
|
|
|
|
var request = require('request');
|
|
|
|
|
|
|
|
require('https').globalAgent.options.ca = rootCas;
|
2018-02-13 18:55:22 +00:00
|
|
|
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
|
2016-10-20 18:39:05 +00:00
|
|
|
if (err) {
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(body);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO test with a company certificate
|