mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 21:55:56 +03:00
[PR #803] [MERGED] Handle offset-from-end ranges and make range handling more robust #932
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#932
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fsouza/fake-gcs-server/pull/803
Author: @dnerdy
Created: 6/1/2022
Status: ✅ Merged
Merged: 6/4/2022
Merged by: @fsouza
Base:
main← Head:range-updates📝 Commits (6)
0aeec46Handle offset-from-end ranges and make range handling more robust5f79e4fRemove underscore prefix from parseRange function7aa1e43Reformat commente3fd350Fix off by one error and add corresponding test1f4877dRemove unused length variable in test7f36ceeApply one nit from code review📊 Changes
2 files changed (+156 additions, -40 deletions)
View changed files
📝
fakestorage/object.go(+111 -27)📝
fakestorage/object_test.go(+45 -13)📄 Description
This PR adds support for offset-from-end ranges. An offset-from-end
range header looks like "Range: bytes=-10". This returns content
starting 10 bytes from the end of the content to the end of the content.
The PR also updates other range responses to align with the real GCS
server. Specifically, the range handling code now detects when the start
of range is beyond the content bounds and returns a 416 response. Most
other invalid ranges are ignored, except for a few cases where bounds
are automatically adjusted.
All of the cases were verified against the GCS server using requests
like:
Fixes #536.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.