Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow incomplete downloads to be resumed even when server rejects HEAD requests #5421

merged 1 commit into from
Dec 23, 2018

Allow incomplete downloads to be resumed even when server rejects HEAD requests #5421

merged 1 commit into from
Dec 23, 2018


Copy link

@smammy smammy commented Dec 18, 2018

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example. In order to write a test for this I'd have to refactor curl_download or (I guess) mock curl_output and curl and I don't know how to do that. Old behavior wasn't unit-tested either so I don't think it's a huge deal.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

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

Copy link

CC @reitermarkus for thoughts.

Copy link
Contributor Author

smammy commented Dec 18, 2018

Although, honestly I don't understand what was wrong with the behavior before 0721271 where curl_download always tried --continue-at - and recovered from the error if the server didn't support partial content. (Most servers seem to these days, so the old pre-0721271 behavior would save us an HTTP request in the common case.) #4847 doesn't explain why the upfront check was added, but I assume there was some reason for it.


   * 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 #5420.
Copy link

I think the reason for the upfront check was that some servers which don't support ranges wouldn't actually fail with the appropriate error code.

Copy link

Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @smammy!

@MikeMcQuaid MikeMcQuaid merged commit 537fe2d into Homebrew:master Dec 23, 2018
@smammy smammy deleted the 5420-curl-use-GET-on-range-check branch December 23, 2018 18:16
@lock lock bot added the outdated PR was locked due to age label Jan 22, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
outdated PR was locked due to age
None yet

Successfully merging this pull request may close these issues.

Downloads don't resume if server doesn't support HEAD requests
3 participants