geoip-country 4.2.72 → 4.2.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geoip-country",
3
- "version": "4.2.72",
3
+ "version": "4.2.74",
4
4
  "description": "Less memory usage version of geoip-lite, by supporting only country lookup.",
5
5
  "keywords": [
6
6
  "geo",
@@ -145,8 +145,8 @@ function fetch(database, cb) {
145
145
 
146
146
  console.log('Fetching edition ' + database.edition + ' from ' + download_server);
147
147
 
148
- function getOptions() {
149
- var options = url.parse(downloadUrl);
148
+ function getOptions(redirectUrl) {
149
+ var options = url.parse(redirectUrl || downloadUrl);
150
150
  options.headers = {
151
151
  'User-Agent': user_agent
152
152
  };
@@ -168,7 +168,9 @@ function fetch(database, cb) {
168
168
  function onResponse(response) {
169
169
  var status = response.statusCode;
170
170
 
171
- if (status !== 200) {
171
+ if (status === 301 || status === 302 || status === 303 || status === 307 || status === 308) {
172
+ return https.get(getOptions(response.headers.location), onResponse);
173
+ } else if (status !== 200) {
172
174
  if (status === 401) {
173
175
  console.log('ERROR' + ': Download Not Allowed — Is Your License Key Valid? [HTTP %d]', status);
174
176
  } else {