Add support for HEAD endpoints; add example accepting Range: header#776
Open
jgallagher wants to merge 4 commits intomainfrom
Open
Add support for HEAD endpoints; add example accepting Range: header#776jgallagher wants to merge 4 commits intomainfrom
Range: header#776jgallagher wants to merge 4 commits intomainfrom
Conversation
Collaborator
|
Sorry this one fell off my radar. It looks like HEAD support came in with #755. We could still add the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several examples of running
curlagainst the example with-ito show the headers the server returns are below.Normal request; fetch all data:
Ask for just 20 bytes starting at offset 20:
Ask for all bytes starting from offset 100 (this matches the way curl resumes downloads via
-C -, which also works with this example but I'm not showing explicitly here):Ask for the last 100 bytes:
We can repeat any of the above requests with
-Ito send anHTTP HEAD; we should get back identical headers but no body content; e.g., asking for all bytes starting from offset 100:Asking for too many bytes (e.g., "the last 500 bytes") fails:
as does asking for multiple ranges (which is legal but I think very unusual?):
Interestingly, asking for an explicit range that goes past the end of the file succeeds:
This is because http-range-header clamps the end position. I'm having a hard time finding anything in RFC 7233 to confirm that's the correct behavior, but I imagine it is?