This commit is contained in:
AJ ONeal 2016-10-20 12:39:05 -06:00
parent f9e269bfc2
commit 7a93c3d793
2 changed files with 53 additions and 1 deletions

View File

@ -4090,7 +4090,8 @@ var originalCas = [
"m+kXQ99b21/+jh5Xos1AnX5iItreGCc=\n" +
"-----END CERTIFICATE-----\n"
];
module.exports.rootCas = module.exports = originalCas.slice(0);
module.exports = originalCas.slice(0);
module.exports.rootCas = module.exports;
module.exports.rootCas.inject = function (/*context*/) {
var rootCas = this || module.exports.rootCas;
var opts = /*context ||*/ require('https').globalAgent.options;

51
test.js Normal file
View File

@ -0,0 +1,51 @@
'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;
request.get('https://daplie.com/404.html', function (err, resp, body) {
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;
request.get('https://daplie.com/404.html', function (err, resp, body) {
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;
request.get('https://daplie.com/404.html', function (err, resp, body) {
if (err) {
throw err;
}
console.log(body);
});
}
// TODO test with a company certificate