From fd477365b51fbb129d9ec6aeadd8a7694a64f403 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Aug 2017 18:53:23 +0200 Subject: [PATCH] `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)