Merge pull request #5421 from smammy/5420-curl-use-GET-on-range-check

Allow incomplete downloads to be resumed even when server rejects HEAD requests
This commit is contained in:
Mike McQuaid 2018-12-23 12:03:05 +00:00 committed by GitHub
commit 537fe2d0f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ def curl_download(*args, to: nil, **options)
destination.dirname.mkpath destination.dirname.mkpath
continue_at = if destination.exist? && continue_at = if destination.exist? &&
curl_output("--location", "--head", "--range", "0-1", curl_output("--location", "--range", "0-1",
"--write-out", "%{http_code}", "--write-out", "%{http_code}",
"--output", "/dev/null", *args, **options).stdout.to_i == 206 # Partial Content "--output", "/dev/null", *args, **options).stdout.to_i == 206 # Partial Content
"-" "-"