curl_download: Retry once on error 33.

This commit is contained in:
Markus Reiter
2017-08-10 22:51:09 +02:00
parent 67b20d97d8
commit fd477365b5
+10 -1
View File
@@ -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)