Use GET rather than HEAD when checking for range support in curl_download.

* Some HTTP servers apparently support ranges but don't support HEAD.
   * This is a more realistic check anyway since the actual download request
     will use GET (not HEAD).
   * This fixes Homebrew/brew#5420.
This commit is contained in:
Sam Hathaway 2018-12-18 11:35:25 -05:00
parent 1a78cc77d4
commit 6e603c2859

View File

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