Skip to content

Document content length check is applied to outoing-body output-stream #809

Open

Description

@guybedford

In the current WIT definitions, outgoing-body finish defines that the content length must be validated against the actual length.

But, in addition to this, the Wasmtime implementation also throws a stream error from the output-stream for the outgoing-body as soon as a write is made that exceeds the expected content length. Thus this check is not only performed at finish but also dynamically with each write operation to the stream.

If this is the defined behaviour, it should be documented in the WIT.

Activity

  1. pchickey commented on Nov 27, 2023

    @pchickey
    Contributor

    Agreed we should document this on outgoing-body.write!

    One way to implement this is for check-write to refuse readiness once the content-length has been reached, but this is difficult to debug because blocking-write would loop forever, or have to trap.

    Instead we should specify that check-write may allow writes beyond the content-length, but if those writes are performed, write (or blocking-write or blocking-write-and-flush) will throw a last-operation-failed that will downcast to a HTTP-{request,response}-body-size.

  2. added
    S-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-httpProposal: wasi-httpS-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions