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

Ensure partial put data range not exceed ContentRange declared #810

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Chenjp
Copy link
Contributor

@Chenjp Chenjp commented Jan 22, 2025

Ensure updated content size not exceeds bounds (end-start+1) declared by Content-Range header.

For backwards compatibility, just discard the rest part instead of a sending 400.

Ensure write to bytes max to [end - start + 1], discard remaining part.
@Chenjp
Copy link
Contributor Author

Chenjp commented Jan 23, 2025

As expected:

curl -i http://localhost:1080/uploads/size-1.dat -X PUT -H "Content-Range: Bytes 0-0/1" -d 111111

HTTP/1.1 201 Created

curl -i http://localhost:1080/uploads/size-1.dat

HTTP/1.1 200 OK
Date: Thu, 23 Jan 2025 05:55:51 GMT
Server: Apache/2.4.62 (Unix)
Last-Modified: Thu, 23 Jan 2025 05:55:39 GMT
ETag: "1-62c5942780a39"
Accept-Ranges: bytes
Content-Length: 1

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant