aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils
diff options
context:
space:
mode:
authorMarkus Reiter2017-09-10 21:47:36 +0200
committerGitHub2017-09-10 21:47:36 +0200
commit455ec4c9b02930c091d260a0141270440321e4b8 (patch)
tree3d11fb460bef629c897eb109b060726a38031008 /Library/Homebrew/utils
parente108cf8cf57835a99a19dc84d26aea3b3cd8917f (diff)
parent1f66c9c9e0b678cc8f7b72d12f29ab6d25bd8eb8 (diff)
downloadbrew-455ec4c9b02930c091d260a0141270440321e4b8.tar.bz2
Merge pull request #3142 from reitermarkus/curl-full-download
Let `curl_download` handle HTTP 416 error.
Diffstat (limited to 'Library/Homebrew/utils')
-rw-r--r--Library/Homebrew/utils/curl.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb
index bc7055c0c..7807d2034 100644
--- a/Library/Homebrew/utils/curl.rb
+++ b/Library/Homebrew/utils/curl.rb
@@ -38,11 +38,14 @@ def curl(*args)
end
def curl_download(*args, to: nil, continue_at: "-", **options)
+ had_incomplete_download ||= File.exist?(to)
curl("--location", "--remote-time", "--continue-at", continue_at.to_s, "--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 == "-"
+ # HTTP status 416: Requested range not satisfiable
+ if ($CHILD_STATUS.exitstatus == 33 || had_incomplete_download) && continue_at == "-"
continue_at = 0
+ had_incomplete_download = false
retry
end