aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils
diff options
context:
space:
mode:
authorMarkus Reiter2017-08-10 18:53:23 +0200
committerMarkus Reiter2017-08-10 22:51:09 +0200
commitfd477365b51fbb129d9ec6aeadd8a7694a64f403 (patch)
tree3ac45f9a09986b1b856a276d058ae9bad0376908 /Library/Homebrew/utils
parent67b20d97d80d8bf550e62a92af4aba025dd806a7 (diff)
downloadbrew-fd477365b51fbb129d9ec6aeadd8a7694a64f403.tar.bz2
`curl_download`: Retry once on error `33`.
Diffstat (limited to 'Library/Homebrew/utils')
-rw-r--r--Library/Homebrew/utils/curl.rb11
1 files changed, 10 insertions, 1 deletions
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)