Skip to content
Snippets Groups Projects
Commit ea32b516 authored by Jack Nagel's avatar Jack Nagel
Browse files

ApacheDownloadStrategy: fall back to specified mirrors

Fixes Homebrew/homebrew#24157.
parent 45844074
No related branches found
No related tags found
No related merge requests found
......@@ -236,13 +236,16 @@ class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
end
def _fetch
return super if @tried_apache_mirror
@tried_apache_mirror = true
mirrors = Utils::JSON.load(apache_mirrors)
url = mirrors.fetch('preferred') + mirrors.fetch('path_info')
@url = mirrors.fetch('preferred') + mirrors.fetch('path_info')
ohai "Best Mirror #{url}"
curl url, '-C', downloaded_size, '-o', temporary_path
ohai "Best Mirror #{@url}"
super
rescue IndexError, Utils::JSON::Error
raise "Couldn't determine mirror. Try again later."
raise CurlDownloadStrategyError, "Couldn't determine mirror, try again later."
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment