Skip to content

Conversation

@belveryin
Copy link
Collaborator

@belveryin belveryin commented Dec 17, 2025

  1. Missing HTTP status code propagation - The WASM HTTP client wasn't copying
    the response status from reqwest, causing it to default to 200. This masked
    403/404 errors and led to confusing "missing ETag" errors.

  2. Content-Length header causes signature mismatch - Browser's fetch API
    modifies/strips the Content-Length header on requests with empty bodies.
    When the header was included in AWS signature calculation but then modified
    by fetch, R2/S3 rejected requests with SignatureDoesNotMatch.

Changes:

  • wasm.rs: Propagate response status code; remove Content-Length before sending
  • fs.rs: Remove Content-Length from HEAD, GET (list), DELETE requests
  • s3.rs: Remove Content-Length from GET (range read), HEAD requests
  • head.rs: Remove Content-Length from GET request
  • multipart_upload.rs: Remove Content-Length from POST, PUT (copy) requests
  • pre-commit: Remove broken fusio-manifest std-only checks (requires executor)

Tested with:

  • Cloudflare Workers + R2 (WASM target)
  • Native S3 via tonbo's s3_smoke test (tokio target)

… mismatch

Two bugs fixed that prevented AWS S3-compatible storage from working in WASM environments:

1. Missing HTTP status code propagation - The WASM HTTP client wasn't copying
   the response status from reqwest, causing it to default to 200. This masked
   403/404 errors and led to confusing "missing ETag" errors.

2. Content-Length header causes signature mismatch - Browser's fetch API
   modifies/strips the Content-Length header on requests with empty bodies.
   When the header was included in AWS signature calculation but then modified
   by fetch, R2/S3 rejected requests with SignatureDoesNotMatch.

Changes:
- wasm.rs: Propagate response status code; remove Content-Length before sending
- fs.rs: Remove Content-Length from HEAD, GET (list), DELETE requests
- s3.rs: Remove Content-Length from GET (range read), HEAD requests
- head.rs: Remove Content-Length from GET request
- multipart_upload.rs: Remove Content-Length from POST, PUT (copy) requests
- pre-commit: Remove broken fusio-manifest std-only checks (requires executor)

Tested with:
- Cloudflare Workers + R2 (WASM target)
- Native S3 via tonbo's s3_smoke test (tokio target)
@belveryin belveryin changed the title fix: WASM HTTP client status propagation and Content-Length signature mismatch fix: WASM HTTP client issues and S3Writer flush for small files Dec 17, 2025
@belveryin belveryin changed the title fix: WASM HTTP client issues and S3Writer flush for small files fix: WASM HTTP client status propagation and Content-Length signature mismatch Dec 17, 2025
@ethe
Copy link
Member

ethe commented Dec 19, 2025

Nice catch! Thank you Daniel!

@ethe ethe merged commit 923c825 into main Dec 19, 2025
5 checks passed
@ethe ethe deleted the fix_headers_for_r2 branch December 19, 2025 07:28
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.

3 participants