in lib/binaries/config_source.ts [72:104]
private requestXml(): Promise<string> {
return new Promise<string>((resolve, reject) => {
let options = HttpUtils.initOptions(this.xmlUrl);
let curl = this.getFileName() + ' ' + options.url;
if (HttpUtils.requestOpts.proxy) {
let pathUrl = url.parse(options.url.toString()).path;
let host = url.parse(options.url.toString()).host;
let newFileUrl = url.resolve(HttpUtils.requestOpts.proxy, pathUrl);
curl = this.getFileName() + ' \'' + newFileUrl + '\' -H \'host:' + host + '\'';
}
if (HttpUtils.requestOpts.ignoreSSL) {
curl = 'k ' + curl;
}
logger.info('curl -o' + curl);
let req = request(options);
req.on('response', response => {
if (response.statusCode === 200) {
let output = '';
response.on('data', (data) => {
output += data;
});
response.on('end', () => {
resolve(output);
});
} else {
reject(new Error('response status code is not 200'));
}
});
});
}