fix(s3): route virtual-hosted PUT object through streaming dispatch#788
Merged
vieiralucas merged 1 commit intomainfrom Apr 26, 2026
Merged
fix(s3): route virtual-hosted PUT object through streaming dispatch#788vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
Buffered fallback in S3 PutObject was removed in #785. The streaming dispatch only matched path-style PUT (path containing `/`); virtual- hosted PUT `/<key>` (bucket in the Host header) fell through to the buffered branch and the service then errored with `MalformedRequestBody: PutObject requires a streaming request body`. Fix: in streaming_route, accept any non-empty path when the Host header parses as a virtual-hosted-style S3 bucket. Path-style still requires a slash so `PUT /bucket` (CreateBucket) is unaffected. Restores host_routing::s3_virtual_hosted_put_get_delete and the sibling virtual-hosted PUT/GET tests. Verified with the full host_routing suite (14 tests pass) and the existing fakecloud-core + fakecloud-s3 unit tests.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
3 tasks
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.
Summary
Fixes the regression introduced when the buffered S3 PutObject fallback was removed in #785. Virtual-hosted-style PUT (path
/<key>, bucket in Host header) was falling through to the buffered branch becausestreaming_routeonly accepted path-style PUTs. The service then rejected the request with400 MalformedRequestBody: PutObject requires a streaming request body.streaming_routenow also matches when the Host header parses as a virtual-hosted-style S3 bucket, with any non-empty path. Path-style still requires a slash soPUT /bucket(CreateBucket) is unaffected.What was broken
E2E
host_routing::s3_virtual_hosted_put_get_deletefailing on every main run since #785 merged. Same root cause for the sibling virtual-hosted PUT/GET tests across modern AWS, legacy global, and dash-separated host shapes.Test plan
cargo test -p fakecloud-e2e --test host_routing- 14/14 passcargo test -p fakecloud-core --lib- 170 passcargo test -p fakecloud-s3 --lib- 280 passSummary by cubic
Fixes virtual-hosted S3 PutObject requests that were rejected after the buffered fallback was removed.
PUT /<key>(bucket in Host) is now routed through streaming dispatch to avoidMalformedRequestBody.streaming_routenow matches virtual-hosted-style PUT when the Host parses as S3 with a bucket and the path is non-empty; request bodies are streamed.PUT /bucket(CreateBucket) remains unaffected.Written for commit 0ce58a3. Summary will update on new commits.