download_strategy: make sure the inspected url is used

Closes Homebrew/homebrew#40940.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-06-21 16:21:39 +08:00
parent b363175401
commit 0276c3c70c

View File

@ -274,6 +274,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
urls = actual_urls urls = actual_urls
unless urls.empty? unless urls.empty?
ohai "Downloading from #{urls.last}" ohai "Downloading from #{urls.last}"
@url = 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." raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."