Skip to content

OutgoingBody finish content length errors #810

Open

Description

@guybedford

When the written body is less than the content length, the only error code that fits is internal-error.

But when the written body is more than the content length, perhaps it would make sense to use the existing HTTP-request-body-size(option<u64>) error code which is meant to be for when the body is too long? Alternatively should this also be internal-error?

Then, for both of these, it would be nice to have a proper error code instead of making it an internal error. Perhaps a dedicated HTTP-request-body-content-length-invalid(option<u64>)?

Activity

  1. pchickey commented on Nov 27, 2023

    @pchickey
    Contributor

    When the written size is less than the content length, HTTP-{request,response}-body-size(option<u64>) is the correct variant to return throw from outgoing-body.finish. The outgoing-body will have to return the correct request/response variant of the error there based on what it was created from.

    We need to add documentation to the error-code cases, and this information should be there, and made more explicit in the docs for outgoing-body.finish.

  2. guybedford commented on Nov 27, 2023

    @guybedford
    ContributorAuthor

    When the written size is less than the content length, HTTP-{request,response}-body-size(option) is the correct variant to return throw from outgoing-body.finish.

    Note this is not the case for Wasmtime currently - which throws an internal-error here instead.

  3. pchickey commented on Nov 27, 2023

    @pchickey
    Contributor

    Thanks - @elliottt can you work on fixing that?

  4. guybedford commented on Nov 30, 2023

    @guybedford
    ContributorAuthor

    This was landed in Wasmtime in bytecodealliance/wasmtime#7591, so is only pending as a documentation update at this point that the error has been extended to apply to sizes less than the expected content length.

  5. 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