WebAssembly / WebAssembly/WASI

Adding headers with multiple casings of the same field name

Open
#787 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

WhatWG fetch specifies that if there is an existing header Foo: 42, and you go to append foo: 69, the lower-case header name is first corrected to the casing of the existing Foo: https://fetch.spec.whatwg.org/#concept-header-list-append

I understand that one goal of wasi-http is to be implementable in terms of whatwg fetch. This constrains us, in that we can't support both the contract of append and copy-all:

   /// Append a value for a name. Does not change or delete any existing
    /// values for that name.
    ///
    /// Fails with `header-error.immutable` if the `fields` are immutable.
    append: func(name: field-name, value: field-value) -> result<_, header-error>;
    /// Retrieve the full set of names and values in the Fields. Like the
    /// constructor, the list represents each name-value pair.
    ///
    /// The outer list represents each name-value pair in the Fields. Names
    /// which have multiple values are represented by multiple entries in this
    /// list with the same name.
    ///
    /// The names and values are always returned in the original casing and in
    /// the order in which they will be serialized for transport.
    copy-all: func() -> list<tuple<field-name, field-value>>;

I suggest that we adopt to make set and append operations first adapt the case of the field-name to any existing field-name.

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 wasi-http header append, set, and copy-all definitions quoted in the issue, then compare their casing behavior with the linked WHATWG Fetch header-list append specification. Determine whether the interface can preserve both contracts; done means the specification and operations have an agreed, consistent casing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api, networking
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.