Skip to content

Commit

Permalink
https://github.com/geoip-lite/node-geoip/commit/89a2e0255081ba2387612…
Browse files Browse the repository at this point in the history
…2314db3251457f63f20
  • Loading branch information
sefinek24 committed Feb 11, 2024
1 parent 8085f3d commit 1e7cb42
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils-unminified/updatedb.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ function check(database, cb) {

function onResponse(response) {
const status = response.statusCode;
if (status !== 200) {
if ([301, 302, 303, 307, 308].includes(status)) {
return https.get(getHTTPOptions(response.headers.location), onResponse);
} else if (status !== 200) {
console.error(kleur.red('ERROR') + response.data);
console.error(kleur.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]);
client.end();
Expand Down Expand Up @@ -214,8 +216,9 @@ function fetch(database, cb) {

function onResponse(response) {
const status = response.statusCode;

if (status !== 200) {
if ([301, 302, 303, 307, 308].includes(status)) {
return https.get(getHTTPOptions(response.headers.location), onResponse);
} else if (status !== 200) {
console.error(kleur.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]);
client.end();
process.exit(1);
Expand Down

0 comments on commit 1e7cb42

Please sign in to comment.