Skip to content

Commit

Permalink
fix(gecko): follow redirects for content-length (#133)
Browse files Browse the repository at this point in the history
closes #127
  • Loading branch information
cnishina authored and heathkit committed Nov 8, 2016
1 parent f536a76 commit 35676ee
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/files/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,21 @@ export class Downloader {
}

let options = {
method: 'HEAD',
method: 'GET',
url: fileUrl,
strictSSL: !opt_ignoreSSL,
rejectUnauthorized: !opt_ignoreSSL,
proxy: Downloader.resolveProxy_(fileUrl, opt_proxy)
};

let contentLength = 0;
request(options).on('response', (response) => {
contentLength = response.headers['content-length'];
deferred.resolve(contentLength);
if (response.headers['Location']) {
let urlLocation = response.headers['Location'];
deferred.resolve(Downloader.httpHeadContentLength(urlLocation, opt_proxy, opt_ignoreSSL));
} else if (response.headers['content-length']) {
let contentLength = response.headers['content-length'];
deferred.resolve(contentLength);
}
});
return deferred.promise;
}
Expand Down

0 comments on commit 35676ee

Please sign in to comment.