aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/download_strategy.rb
diff options
context:
space:
mode:
authorJack Nagel2013-11-26 22:56:03 -0600
committerJack Nagel2013-11-26 22:57:10 -0600
commitea32b5166c9fec791c2503b390d8dc19eb58f425 (patch)
tree953b45e5e61fe4e6e560eea1239c4dbc62c10ce0 /Library/Homebrew/download_strategy.rb
parent45844074252f869b59b504faa5bda11a8cd6c454 (diff)
downloadbrew-ea32b5166c9fec791c2503b390d8dc19eb58f425.tar.bz2
ApacheDownloadStrategy: fall back to specified mirrors
Fixes Homebrew/homebrew#24157.
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
-rw-r--r--Library/Homebrew/download_strategy.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index f6a3c9129..2fe25d159 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -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