Skip to content

fix(s3): route virtual-hosted PUT object through streaming dispatch#788

Merged
vieiralucas merged 1 commit intomainfrom
worktree-fix-s3-vhost-stream
Apr 26, 2026
Merged

fix(s3): route virtual-hosted PUT object through streaming dispatch#788
vieiralucas merged 1 commit intomainfrom
worktree-fix-s3-vhost-stream

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 26, 2026

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 because streaming_route only accepted path-style PUTs. The service then rejected the request with 400 MalformedRequestBody: PutObject requires a streaming request body.

streaming_route now 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 so PUT /bucket (CreateBucket) is unaffected.

What was broken

E2E host_routing::s3_virtual_hosted_put_get_delete failing 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 pass
  • cargo test -p fakecloud-core --lib - 170 pass
  • cargo test -p fakecloud-s3 --lib - 280 pass
  • CI green
  • Cubic clean

Summary 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 avoid MalformedRequestBody.

  • Bug Fixes
    • streaming_route now matches virtual-hosted-style PUT when the Host parses as S3 with a bucket and the path is non-empty; request bodies are streamed.
    • Path-style rules unchanged; PUT /bucket (CreateBucket) remains unaffected.

Written for commit 0ce58a3. Summary will update on new commits.

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.
@vieiralucas vieiralucas merged commit fe3c7d4 into main Apr 26, 2026
15 checks passed
@vieiralucas vieiralucas deleted the worktree-fix-s3-vhost-stream branch April 26, 2026 18:10
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/fakecloud-core/src/dispatch.rs 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

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