Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// we try to convert url to short form while ensuring maximum compatibility
// stripe off scheme
index = request.url.indexOf('//');
if(index != -1) {
path = request.url.slice(index+2);
}
// stripe off hostname
index = path.indexOf('/');
if(index != -1) {
urlObj.path = path.slice(index);
}
return urlObj;
}
}
urlObj = url.parse(request.url); //TODO: optimize by writing reg maybe?
url.port = url.port || 80;
return urlObj;
};
(urlObj.scheme === 'https' && urlObj.port === 443)) {
delete urlObj.port;
}
return url.format(urlObj);
}
// scheme, host, port, and base URI
var appInfo = JSON.parse(process.env.VCAP_APPLICATION || "{}");
if (process.env.LDP_BASE) {
// LDP_BASE env var set
exports.ldpBase = addSlash(process.env.LDP_BASE);
var url = url.parse(exports.ldpBase);
exports.scheme = url.scheme;
exports.host = url.host;
exports.port = url.port;
exports.context = url.pathname;
exports.appBase = toURL({
protocol: exports.scheme,
host: exports.host,
port: exports.port
});
} else {
// no LDP_BASE set
exports.scheme = (process.env.VCAP_APP_PORT) ? 'http' :config.scheme;
if (appInfo.application_uris) {
exports.host = appInfo.application_uris[0];
} else {
exports.host = process.env.HOSTNAME || config.host;
}
// public port is the default in a Bluemix environment
var i = 0;
var method = parsed.request.split(" ")[0];
var url = url.parse(parsed.request.split(" ")[1]);
var http_version = parsed.request.split(" ")[2];
parsed[request_labels[i]] = method;
i++;
parsed[request_labels[i]] = url.href;
i++;
parsed[request_labels[i]] = http_version;
i++;
parsed[request_labels[i]] = url.protocol;
i++;
parsed[request_labels[i]] = url.hostname;
i++;
parsed[request_labels[i]] = url.port;
i++;
parsed[request_labels[i]] = url.pathname;
i++;
parsed[request_labels[i]] = url.query;
} else {
request_labels.forEach(function(label) {
parsed[label] = '-';
});
}
return parsed;
};
function Insight(href, opts) {
this.opts = opts || {};
this.url = url.parse(href);
if(!url.port)
url.port = 3000;
}
function Insight(href, opts) {
this.opts = opts || {};
this.url = url.parse(href);
if(!url.port)
url.port = 3000;
}
function Bitcoind(href, opts) {
this.opts = opts || {};
this.url = url.parse(href);
if(!url.port)
url.port = 8332;
};
function Bitcoind(href, opts) {
this.opts = opts || {};
this.url = url.parse(href);
if(!url.port)
url.port = 8332;
};