actually fixed addFile to allow leading '/' this time...
This commit is contained in:
parent
cbc33c3578
commit
6a0661d493
|
@ -138,8 +138,10 @@ function dumpCerts(certs) {
|
|||
+ "module.exports.addFile = function (filepath) {\n"
|
||||
+ " var opts = require('https').globalAgent.options;\n"
|
||||
+ " var root = filepath[0] === '/' ? '/' : '';\n"
|
||||
+ " var filepaths = filepath.split(/\\//g);\n"
|
||||
+ " if (root) { filepaths.unshift(root); }\n"
|
||||
+ " opts.ca = opts.ca || [];\n"
|
||||
+ " opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, (root + filepath).split(/\\//g))));\n"
|
||||
+ " opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, filepaths)));\n"
|
||||
+ " return module.exports;\n"
|
||||
+ "};\n"
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ssl-root-cas",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "The module you need to solve node's SSL woes when including a custom certificate.",
|
||||
"main": "ssl-root-cas",
|
||||
"scripts": {
|
||||
|
|
|
@ -4104,7 +4104,9 @@ module.exports.inject = function () {
|
|||
module.exports.addFile = function (filepath) {
|
||||
var opts = require('https').globalAgent.options;
|
||||
var root = filepath[0] === '/' ? '/' : '';
|
||||
var filepaths = filepath.split(/\//g);
|
||||
if (root) { filepaths.unshift(root); }
|
||||
opts.ca = opts.ca || [];
|
||||
opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, (root + filepath).split(/\//g))));
|
||||
opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, filepaths)));
|
||||
return module.exports;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue