diff options
| author | Xu Cheng | 2016-05-26 20:03:17 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-05-26 22:13:50 +0800 |
| commit | 75ab94c8ea8940f1609e62d23d45d8729dd4a83f (patch) | |
| tree | d18108858f24167e35ee33f2abd2c3335a3a3be3 /Library/Homebrew | |
| parent | 8b61d7899b6798f70509a8d3b2052ddcae0d903f (diff) | |
| download | brew-75ab94c8ea8940f1609e62d23d45d8729dd4a83f.tar.bz2 | |
CurlDownloadStrategy: move no insecure redirect check to _fetch
This mainly fixes the problems for subclasses of CurlDownloadStrategy.
More specifically it fixes two things:
* It allows the no insecure redirect check to be applied to
CurlApacheMirrorDownloadStrategy.
* It fixes previous broken CurlPostDownloadStrategy.
Closes #280.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index ba58f2db8..bd12524fa 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -284,17 +284,6 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy ohai "Downloading #{@url}" unless cached_location.exist? - urls = actual_urls - unless urls.empty? - ohai "Downloading from #{urls.last}" - if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && - urls.any? { |u| !u.start_with? "https://" } - puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." - raise CurlDownloadStrategyError.new(@url) - end - @url = urls.last - end - had_incomplete_download = temporary_path.exist? begin _fetch @@ -334,6 +323,17 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy # Private method, can be overridden if needed. def _fetch + urls = actual_urls + unless urls.empty? + ohai "Downloading from #{urls.last}" + if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && + urls.any? { |u| !u.start_with? "https://" } + puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." + raise CurlDownloadStrategyError.new(@url) + end + @url = urls.last + end + curl @url, "-C", downloaded_size, "-o", temporary_path end |
