download_strategy: fix url reassign

We need reassign url after urls are inspected.
This commit is contained in:
Xu Cheng 2015-06-23 00:23:40 +08:00
parent b18015a7e1
commit 7a75bbd85a

View File

@ -274,11 +274,11 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
urls = actual_urls
unless urls.empty?
ohai "Downloading from #{urls.last}"
@url = urls.last
if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") &&
urls.any? { |u| !u.start_with? "https://" }
raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
end
@url = urls.last
end
had_incomplete_download = temporary_path.exist?