fix: correctly parse suffix-byte-range in HTTP Range header#51
Open
GXbSUtze2j8b wants to merge 1 commit intowindoze95:mainfrom
Open
fix: correctly parse suffix-byte-range in HTTP Range header#51GXbSUtze2j8b wants to merge 1 commit intowindoze95:mainfrom
GXbSUtze2j8b wants to merge 1 commit intowindoze95:mainfrom
Conversation
When client sends 'bytes=-500' (last 500 bytes), the old code set start=0 and returned the first 501 bytes instead of the last 500. Added explicit check for empty parts[0] with a non-empty parts[1] (suffix-byte-range syntax) and calculate start from end of file. Ref: windoze95#29
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.
Fix: suffix-byte-range parsing in
build_range_responseBug: When client sends
bytes=-500(last 500 bytes), code setstart=0and returned bytes 0-500 instead of the last 500 bytes.Root cause: Suffix-byte-range format
bytes=-500producesparts=['', '500']. The emptyparts[0]was treated as "start from 0".Fix: Added explicit check for empty
parts[0]with non-emptyparts[1]:Ref: #29