FIX: ensure we can download maxmind without redis or db config

This also corrects FileHelper.download so it supports "follow_redirect"
correctly (it used to always follow 1 redirect) and adds a `validate_url`
param that will bypass all uri validation if set to false (default is true)
This commit is contained in:
Sam Saffron
2019-05-28 10:28:57 +10:00
parent e4e2acf148
commit 7429700389
7 changed files with 55 additions and 15 deletions

View File

@@ -28,6 +28,7 @@ class FileHelper
read_timeout: 5,
skip_rate_limit: false,
verbose: false,
validate_uri: true,
retain_on_max_file_size_exceeded: false)
url = "https:" + url if url.start_with?("//")
@@ -37,9 +38,10 @@ class FileHelper
fd = FinalDestination.new(
url,
max_redirects: follow_redirect ? 5 : 1,
max_redirects: follow_redirect ? 5 : 0,
skip_rate_limit: skip_rate_limit,
verbose: verbose
verbose: verbose,
validate_uri: validate_uri
)
fd.get do |response, chunk, uri|