allowing rescue https redirect error

It can be useful when implementing custom https mirror strategy such as Homebrew/homebrew#42955.

Closes Homebrew/homebrew#43020.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-08-17 18:50:00 +08:00
parent 8ba0fb9fcf
commit 4d84ff3b03

View File

@ -276,7 +276,8 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
ohai "Downloading from #{urls.last}" ohai "Downloading from #{urls.last}"
if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") &&
urls.any? { |u| !u.start_with? "https://" } urls.any? { |u| !u.start_with? "https://" }
raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
raise CurlDownloadStrategyError.new(@url)
end end
@url = urls.last @url = urls.last
end end