download_strategy: don't check url if already downloaded

Closes Homebrew/homebrew#40859.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-06-18 21:46:47 +08:00
parent 7c83e3ffe3
commit 05d9622c02

View File

@ -270,16 +270,16 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
def fetch
ohai "Downloading #{@url}"
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://" }
raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
end
end
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://" }
raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
end
end
had_incomplete_download = temporary_path.exist?
begin
_fetch