Skip to content

Commit

Permalink
Have needle follow redirects
Browse files Browse the repository at this point in the history
Redirect following for binary installations was broken with the switch
to needle (in 9a9089b). This replaces the functionality.
  • Loading branch information
Allen Luce committed Mar 28, 2018
1 parent cf55967 commit a922516
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function download(uri,opts,callback) {
uri: uri.replace('+','%2B'),
headers: {
'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')'
}
},
follow_max: 10,
};

if (opts.cafile) {
Expand Down Expand Up @@ -105,7 +106,10 @@ function place_binary(from,to,opts,callback) {
});

req.on('response', function(res) {
if (res.statusCode !== 200) {
if (res.statusCode === 302) {
return
}
if (res.statusCode !== 200) {
badDownload = true;
var err = new Error(res.statusCode + ' status code downloading tarball ' + from);
err.statusCode = res.statusCode;
Expand Down

0 comments on commit a922516

Please sign in to comment.