feat: teach Downloader to respect redirects (#1741)
This patch adds support for redirects to downloader. Fixes #1740
This commit is contained in:
parent
d7d9623740
commit
71089b0802
@ -272,7 +272,12 @@ function httpRequest(url, method, response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const driver = options.protocol === 'https:' ? 'https' : 'http';
|
const driver = options.protocol === 'https:' ? 'https' : 'http';
|
||||||
const request = require(driver).request(options, response);
|
const request = require(driver).request(options, res => {
|
||||||
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location)
|
||||||
|
httpRequest(res.headers.location, method, response);
|
||||||
|
else
|
||||||
|
response(res);
|
||||||
|
});
|
||||||
request.end();
|
request.end();
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user