Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function print_fallback_error(err,opts,package_json) {
var fallback_message = ' (falling back to source compile with node-gyp)';
var full_message = '';
if (err.statusCode !== undefined) {
// If we got a network response it but failed to download
// it means remote binaries are not available, so let's try to help
// the user/developer with the info to debug why
full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version;
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
full_message += fallback_message;
log.error("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball);
log.error(full_message);
log.http(err.message);
} else {
// If we do not have a statusCode that means an unexpected error
// happened and prevented an http response, so we output the exact error
full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version;
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
full_message += fallback_message;
log.error(full_message);
log.error("Hit error " + err.message);
}
}
function download (gyp, env, url) {
log.http('GET', url)
var requestOpts = {
uri: url,
headers: {
'User-Agent': 'node-gyp v' + gyp.version + ' (node ' + process.version + ')'
}
}
var cafile = gyp.opts.cafile
if (cafile) {
requestOpts.ca = readCAFile(cafile)
}
// basic support for a proxy server
var proxyUrl = gyp.opts.proxy ||
env.http_proxy ||
function download(uri,opts,callback) {
log.http('GET', uri);
var req = null;
// Try getting version info from the currently running npm.
var envVersionInfo = process.env.npm_config_user_agent ||
'node ' + process.version;
var requestOpts = {
uri: uri.replace('+','%2B'),
headers: {
'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')'
},
follow_max: 10,
};
if (opts.cafile) {
function print_fallback_error(err,opts,package_json) {
var fallback_message = ' (falling back to source compile with node-gyp)';
var full_message = '';
if (err.statusCode !== undefined) {
// If we got a network response it but failed to download
// it means remote binaries are not available, so let's try to help
// the user/developer with the info to debug why
full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version;
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
full_message += fallback_message;
log.warn("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball);
log.warn(full_message);
log.http(err.message);
} else {
// If we do not have a statusCode that means an unexpected error
// happened and prevented an http response, so we output the exact error
full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version;
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
full_message += fallback_message;
log.warn(full_message);
log.warn("Hit error " + err.message);
}
}
write: message => {
message = (message || '').toString();
if (message) {
log.http(process.pid + '/Express', message.replace('\n', '').trim());
}
}
}
req.on('response', function (res) {
log.http(res.statusCode, uri);
});
}
wowinterface.getDownloadURL = function(addon, version, cb) {
if (version !== null) {
log.warn('wowinterface', 'specific versions of wowinterface addons can\'t be installed (yet, is possible, will come soon).');
}
var addonid = wowinterface.extractID(addon);
var url = wowinterface.craftInfoURL(wowinterface.extractID(addon));
log.http('GET', url);
request.get({
url: url
}, function(err, res, body) {
log.http(res.statusCode, url);
if (err) return cb(err);
var versionresult = wowinterface.versionRegex.exec(body);
var nameresult = wowinterface.nameRegex.exec(body);
var name, version;
if (versionresult[1]) {
version = versionresult[1];
} else {
return cb(new Error('Unable to find version string in webpage. Did wowinterface change something?'));
}
if (nameresult && parseInt(nameresult[1]) === addonid && nameresult[2]) {
name = nameresult[2];
(function _returnFormData(buffer, next) {
fs.unlink(tempFileName);
log.http("BdPhoneGap#downloadApp#_returnFormData()", "streaming down:", fileName);
this.returnFormData([{
name: fileName,
buffer: buffer
}], res, next);
}).bind(this)
], function(err) {
req.on('response', function (res) {
log.http(res.statusCode, url)
})
}
req.on('response', function (res) {
log.http(res.statusCode, url)
})
}