aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Reiter2017-08-11 13:29:08 +0200
committerGitHub2017-08-11 13:29:08 +0200
commitd6d681ca01f8acf6b8d5e66cc1ca67310e9b8913 (patch)
treea522066312363f6ff5fe90c2fea99a91937084d6
parent67b20d97d80d8bf550e62a92af4aba025dd806a7 (diff)
parentd9587a8b5e15e75bc71ee19c90770688d361e1e1 (diff)
downloadbrew-d6d681ca01f8acf6b8d5e66cc1ca67310e9b8913.tar.bz2
Merge pull request #3039 from reitermarkus/curl-args
`curl_download`: Retry once on error `33`.
-rw-r--r--Library/Homebrew/utils/curl.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb
index 9f0d8f75d..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"]
@@ -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)