Skip to content

Handle oversized HEAD response metadata - #951

Merged
ChristianPavilonis merged 5 commits into
mainfrom
fix/head-content-length-limit
Jul 30, 2026
Merged

Handle oversized HEAD response metadata#951
ChristianPavilonis merged 5 commits into
mainfrom
fix/head-content-length-limit

Conversation

@ChristianPavilonis

Copy link
Copy Markdown
Collaborator

Summary

  • Allow HEAD responses to preserve oversized Content-Length metadata without triggering the buffered-body safety limit.
  • Keep the existing 10 MiB limit intact for buffered responses that can allocate origin body bytes in WASM memory.

Changes

FileChange
crates/trusted-server-adapter-fastly/src/platform.rsTrack whether the request expects a response body, return an empty body for HEAD responses, and add oversized HEAD/GET regression coverage.

Closes

Closes#950

Test plan

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: cargo test-fastly; cargo clippy-fastly

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

HEAD Content-Length describes the corresponding GET representation, not
a body that will be buffered. Applying the buffered-response limit to
that metadata prevents valid S3 Image Optimizer preflights from
reaching their streamed GET request.
Resolves: #950
Comment threadcrates/trusted-server-adapter-fastly/src/platform.rs Outdated
Comment threadcrates/trusted-server-adapter-fastly/src/platform.rs
Comment threadcrates/trusted-server-adapter-fastly/src/platform.rs Outdated
@ChristianPavilonis
ChristianPavilonis merged commit fc27a5d into mainJul 30, 2026
16 checks passed
aram356 added a commit that referenced this pull request Jul 30, 2026
Both branches fixed oversized HEAD response metadata independently with
mirrored parameter designs. Adopt main's implementation wholesale — the
request_is_head parameter plus response_carries_body(), which also covers
1xx/204/205/304 bodiless statuses — and keep the RC's cache-bypass
feature intact: send() retains its bypass_cache read alongside the new
request_is_head, and the RC's apply_fastly_cache_bypass tests are
restored next to main's bodiless-metadata tests.
@aram356
aram356 deleted the fix/head-content-length-limit branch August 1, 2026 05:05
@aram356aram356 added this to the 202607 milestone Aug 13, 2026
Sign up for freeto 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.

Oversized S3 assets fail Image Optimizer HEAD preflight

2 participants

@ChristianPavilonis@aram356