addFile() allows leading '/' in path
This commit is contained in:
parent
07ddece429
commit
cbc33c3578
|
@ -137,8 +137,9 @@ function dumpCerts(certs) {
|
|||
+ "};\n"
|
||||
+ "module.exports.addFile = function (filepath) {\n"
|
||||
+ " var opts = require('https').globalAgent.options;\n"
|
||||
+ " var root = filepath[0] === '/' ? '/' : '';\n"
|
||||
+ " opts.ca = opts.ca || [];\n"
|
||||
+ " opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, filepath.split(/\\//g))));\n"
|
||||
+ " opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, (root + filepath).split(/\\//g))));\n"
|
||||
+ " return module.exports;\n"
|
||||
+ "};\n"
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ssl-root-cas",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "The module you need to solve node's SSL woes when including a custom certificate.",
|
||||
"main": "ssl-root-cas",
|
||||
"scripts": {
|
||||
|
|
|
@ -4094,8 +4094,17 @@ var cas = module.exports = [
|
|||
"3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed\n" +
|
||||
"-----END CERTIFICATE-----\n"
|
||||
];
|
||||
module.exports.rootCas = cas;
|
||||
module.exports.inject = function () {
|
||||
var opts = require('https').globalAgent.options;
|
||||
if (!opts.ca || !opts.ca.__injected) { opts.ca = (opts.ca||[]).concat(cas); }
|
||||
opts.ca.__injected = true;
|
||||
return module.exports;
|
||||
};
|
||||
module.exports.addFile = function (filepath) {
|
||||
var opts = require('https').globalAgent.options;
|
||||
var root = filepath[0] === '/' ? '/' : '';
|
||||
opts.ca = opts.ca || [];
|
||||
opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, (root + filepath).split(/\//g))));
|
||||
return module.exports;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue