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)