Skip to content

Commit

Permalink
Fix for 'DEPTH_ZERO_SELF_SIGNED_CERT' issue, see: request/request#418
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Beresford committed Jun 6, 2013
1 parent 9f1cddb commit b05ff99
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/fhc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
process.title = "fhc";
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

if (require.main === module) {
console.error(["It looks like you're doing 'node fhc.js'."
Expand Down Expand Up @@ -58,9 +59,9 @@ var commandCache = {}
,'rm' : 'delete'
,'props' : 'read'
}

, aliasNames = Object.keys(aliases)
//
//
// Note: these are filenames in ./lib
//
, cmdList = fhc.cmdList = [
Expand Down Expand Up @@ -156,9 +157,9 @@ fhc.appId = function (appid) {
//if its undefined or 24 chars in length return it back so flow continues as normal
if(!appid || appid.length === 24) return appid;

//look for alias if none just return the passed string
//look for alias if none just return the passed string
var ali = alias.getAlias(appid);
return (appid.length > 23) ? appid : (ali === undefined) ? appid : ali;
return (appid.length > 23) ? appid : (ali === undefined) ? appid : ali;

};

Expand All @@ -173,7 +174,7 @@ var loaded = false
, loading = false
, loadListeners = [];

fhc.load = function (conf, cb_) {
fhc.load = function (conf, cb_) {

if (!cb_ && typeof conf === "function") cb_ = conf , conf = {}
if (!cb_) cb_ = function () {};
Expand All @@ -184,25 +185,25 @@ fhc.load = function (conf, cb_) {
loading = true;
var onload = true;

function handleError (er) {
function handleError (er) {
loadListeners.forEach(function (cb) {
process.nextTick(function () { cb(er, fhc) });
})
}

function cb (er) {
function cb (er) {
if (er) return handleError(er);
loaded = true;
loadListeners.forEach(function (cb) {
loadListeners.forEach(function (cb) {
process.nextTick(function () { cb(er, fhc); });
});
loadListeners.length = 0;
if (onload == onload && fhc.config.get("onload-script")) {
if (onload == onload && fhc.config.get("onload-script")) {
require(onload);
onload = false;
}
};

log.waitForConfig();
which(process.argv[0], function (er, node) {
if (!er && node !== process.execPath) {
Expand All @@ -220,7 +221,7 @@ fhc.load = function (conf, cb_) {
p = fhc.config.get("prefix");
}
// try to guess at a good node_modules location.
findPrefix(p, function (er, p) {
findPrefix(p, function (er, p) {
if (er) return handleError(er);
Object.defineProperty(fhc, "prefix",
{ get : function () { return p; }
Expand Down

0 comments on commit b05ff99

Please sign in to comment.