honor entity-tag If-Range in FileResponse range requests - #13480
Draft
arshsmith1 wants to merge 2 commits into
Draft
honor entity-tag If-Range in FileResponse range requests#13480arshsmith1 wants to merge 2 commits into
arshsmith1 wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13480 +/- ##
==========================================
- Coverage 99.00% 99.00% -0.01%
==========================================
Files 132 132
Lines 49626 49655 +29
Branches 2575 2577 +2
==========================================
+ Hits 49132 49160 +28
- Misses 370 371 +1
Partials 124 124
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
Comparing Footnotes
|
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.
What do these changes do?
FileResponseonly looked at the HTTP-date form ofIf-Range.request.if_rangeruns the value throughparse_http_dateand returnsNonefor anything that is not a date, so anIf-Rangecarrying an entity-tag was treated as absent and theRangewas honored unconditionally. A client resuming a download withIf-Range: "<etag>"after the file had changed therefore received a206partial that it stitched onto the stale bytes it already held, producing a corrupt file. :rfc:9110#section-13.1.5wants theRangehonored only when the validator still matches, otherwise the full200. The strong entity-tag comparison now happens inside_prepare_open_file, next to where the date form was already handled, so a stale (or weak) validator falls back to a full200.Are there changes in behavior for the user?
Only for the entity-tag
If-Rangecase. Requests with noIf-Range, and the date form, behave exactly as before; a matching strong ETag still serves the206.Is it a substantial burden for the maintainers to support this?
No. It reads the raw
If-Rangeheader where the date form was already parsed and adds one strong comparison, with two regression tests beside the existingIf-Rangedate tests.Related issue number
None.
Checklist
CONTRIBUTORS.txtCHANGES/folder