From fd477365b51fbb129d9ec6aeadd8a7694a64f403 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Aug 2017 18:53:23 +0200 Subject: [PATCH 1/2] `curl_download`: Retry once on error `33`. --- Library/Homebrew/utils/curl.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 9f0d8f75d6..c330762435 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -38,7 +38,16 @@ def curl(*args) end def curl_download(*args, to: nil, **options) - curl("--location", "--remote-time", "--continue-at", "-", "--output", to, *args, **options) + continue_at ||= "-" + curl("--location", "--remote-time", "--continue-at", continue_at, "--output", to, *args, **options) +rescue ErrorDuringExecution + # `curl` error 33: HTTP server doesn't seem to support byte ranges. Cannot resume. + if $CHILD_STATUS.exitstatus == 33 && continue_at == "-" + continue_at = "0" + retry + end + + raise end def curl_output(*args, **options) From d9587a8b5e15e75bc71ee19c90770688d361e1e1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Aug 2017 12:28:58 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Don=E2=80=99t=20pass=20`--fail`=20for=20`cu?= =?UTF-8?q?rl=5Foutput`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/utils/curl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index c330762435..52d03c93e9 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -11,7 +11,6 @@ end def curl_args(*extra_args, show_output: false, user_agent: :default) args = [ curl_executable.to_s, - "--fail", "--show-error", ] @@ -25,6 +24,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) end unless show_output + args << "--fail" args << "--progress-bar" unless ARGV.verbose? args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] args << "--silent" if !$stdout.tty? || ENV["TRAVIS"]