WebAssembly / WebAssembly/WASI

[v0.3] Make (potentially all) headers mutable

Open
#803 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-http S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

From this discussion on the v0.3 draft PR @lukewagner said:

https://github.com/WebAssembly/wasi-http/pull/103 is proposes adding a take-headers for extracting headers that become mutable (once they are disconnected from the request/response). Are you taking that addition into account and still it's insufficient? (Alternatively, it seems like we could just make all fields other than Content-Length mutable; the current rules are just trying to be regular, but Content-Length is the only one that really wants the current rules.)

To which @dicej replied:

If I want to pass the original request to the imported wasi:http/handler instead of creating a brand new request and passing that, the only way I can modify headers is if I get mutable access to the headers of the original request (i.e. not a disconnected version), so yes, I think we'd need the mutable-except-for-content-length approach.

Which points to the ability to making headers mutable so that they can changed without having to rebuild request and response objects which could not only be a bit of developer experience issue but also lead to excessive copying.

Additionally, Content-Length is pointed to as the reason for why headers are immutable in the first place. However, in https://github.com/WebAssembly/WASI/issues/805, @lukewagner suggests we want to leave it to guests to set the Content-Length header correctly.

While messing with Content-Length header is an easy way to introduce bugs, I don't understand why we fully trust the guest to set the Content-Length header on request/response construction, but we cannot trust the guest to not mess with the Content-Length header inappropriately down the line?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the v0.3 draft PR discussion and related PR #103, then compare the Content-Length considerations in WASI issue #805. Determine and document the intended mutability rules for request and response headers, including whether Content-Length is the sole exception; done means the behavior and rationale are agreed in the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.