From fd477365b51fbb129d9ec6aeadd8a7694a64f403 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Aug 2017 18:53:23 +0200 Subject: `curl_download`: Retry once on error `33`. --- Library/Homebrew/utils/curl.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 9f0d8f75d..c33076243 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) -- cgit v1.2.3 From d9587a8b5e15e75bc71ee19c90770688d361e1e1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Aug 2017 12:28:58 +0200 Subject: Don’t pass `--fail` for `curl_output`. --- Library/Homebrew/utils/curl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index c33076243..52d03c93e 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"] -- cgit v1.2.3