History log of /wasmtime-44.0.1/crates/wasi-http/src/p3/host/handler.rs (Results 1 – 13 of 13)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7, v43.0.0
# 511638f5 10-Mar-2026 Alex Crichton <[email protected]>

Refactor `wasi:http` headers' host representation (#12754)

* Refactor `wasi:http` headers' host representation

This commit is a follow-on/extension of #12748 and extends the changes
made for WASIp2

Refactor `wasi:http` headers' host representation (#12754)

* Refactor `wasi:http` headers' host representation

This commit is a follow-on/extension of #12748 and extends the changes
made for WASIp2 headers in #12652 to the WASIp3 implementation as well.
This is done through a number of refactorings to make the WASIp2 and
WASIp3 implementations more similar in terms of how they represent
headers. Changes here are:

* `FieldMap` now has its own dedicated module at the crate root instead
of intermingling with other WASIp2 types.
* `FieldMap` is now internally-`Arc`'d and is cheaply clonable.
`FieldMap` itself now tracks whether it's mutable or immutable (WASI
semantics) and doesn't need different wrappers in WASIp2 and WASIp3.
* Creation of an immutable `FieldMap` can be done without needing a size
limit. Flagging a `FieldMap` as mutable, however, requires a size limit.
* `FieldMap::set` was added to be a bit more efficient w.r.t. clones.
* `FieldMapError` is a new error type that covers all of the possible
error modes of operating with a `FieldMap`. Conversions from this to
WASIp{2,3} `header-error` types are now implemented as well.
* WASIp2 now flags `header-error` as a trappable-error-type, allowing
the use of `?` in implementing header functions (like WASIp3).
* Much of WASIp2's header implementation was refactored with `?`, moving
methods around, shuffling where headers are made vs `FieldMap`, some
minor idioms, etc.
* WASIp3 no longer uses `MaybeMutable` for headers and instead uses
`FieldMap` directly.

cc #12674

* Clippy warnings

show more ...


# 365e2d89 10-Mar-2026 Alex Crichton <[email protected]>

Refactor WASIp2 `wasi:http` implementation (#12748)

* Sequester WASIp2 in `wasmtime-wasi-http` to a module

This mirrors the `wasmtime-wasi` crate's organization where there's a
`p2` module and a `

Refactor WASIp2 `wasi:http` implementation (#12748)

* Sequester WASIp2 in `wasmtime-wasi-http` to a module

This mirrors the `wasmtime-wasi` crate's organization where there's a
`p2` module and a `p3` module at the top level.

* Refactor WASIp2 `wasi:http` implementation

This commit reorganizes and refactors the WASIp2 implementation of
`wasi:http` to look more like other `wasmtime-wasi`-style interfaces.
Specifically the old `WasiHttpImpl<T>` structure is removed in favor of
as `WasiHttpCtxView<'_>` type that is used to implement
bindgen-generated `Host` traits. This necessitated reorganizing the
methods of the previous `WasiHttpView` trait like so:

* The `WasiHttpView` trait is renamed to `WasiHttpHooks` to make space
for a new `WasiHttpView` which behaves like `WasiView`, for example.

* The `ctx` and `table` methods of `WasiHttpHooks` were removed since
they'll be fields in `WasiHttpCtxView`.

* Helper methods for WASIp2 were moved to methods on `WasiHttpCtxView`
instead of default methods on `WasiHttpHooks`.

With these changes in place the WASIp3 organization was also updated
slightly as well. Notably WASIp3 now contains a reference to the crate's
`WasiHttpCtx` structure (which has field limits for example). WASIp3's
previous `WasiHttpCtx` trait is now renamed to `WasiHttpHooks` as well.
This means that there are two `WasiHttpHooks` traits right now, one for
WASIp2 and one for WASIp3. In the future I would like to unify these two
but that will require some more work around the default `send_request`.

A final note here is that the `WasiHttpHooks` trait previously, and
continues to be, optional for embedders to implement. Default functions
are provided as `wasmtime_wasi_http::{p2, p3}::default_hooks`.
Additionally there's a `Default for &mut dyn WasiHttpHooks`
implementation, too.

With all that outlined: the motivation for this change is to bring the
WASIp2 and WASIp3 implementations of `wasi:http` closer together. This
is inspired by refactorings I was doing for #12674 to apply the same
header limitations for WASIp3 as is done for WASIp2. Prior to this
change there were a number of differences such as WASIp3 not having
`crate::WasiHttpCtx` around, WASIp2 having a different organization of
structures/borrows, etc. The goal is to bring the two implementations
closer in line with each other to make refactoring across them more
consistent and easier.

* Make `WasiHttp` in WASIp2 public

* Fix some conditional build

* Fix some doctests

* Fix configured build

* Fixup documentation

show more ...


Revision tags: v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6, v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2
# 1cc0bcff 13-Jan-2026 Bailey Hayes <[email protected]>

feat(p3)!: vendor 0.3.0-rc-2026-01-06 (#12250)

* feat(p3)!: vendor 0.3.0-rc-2026-01-06

Update wasmtime's WASI implementation from version
0.3.0-rc-2025-09-16 to 0.3.0-rc-2026-01-06, using wkg for W

feat(p3)!: vendor 0.3.0-rc-2026-01-06 (#12250)

* feat(p3)!: vendor 0.3.0-rc-2026-01-06

Update wasmtime's WASI implementation from version
0.3.0-rc-2025-09-16 to 0.3.0-rc-2026-01-06, using wkg for WIT vendoring.

This involves API changes in clocks and HTTP.

* Handle some review comments

* Update WASI implementations to avoid `as`

This can have a loss in precision so this shuffles around some types to
ensure that `try_into` and friends are always used instead of `as`. This
changes the source-of-truth for timestamps to be `i64` seconds so WASIp2
is the odd-one-out that can't represent negative timestamps.

* Flag expected WASI failures

* Get wasi:http tests working again

* Rename `proxy` module to `service` to reflect the WIT world.
* Adjust the middleware test to using the `middleware` world.

---------

Co-authored-by: Alex Crichton <[email protected]>

show more ...


# 85d8cc06 08-Jan-2026 Nick Fitzgerald <[email protected]>

Migrate wasi-http to `wasmtime::error` (#12291)

* Migrate wiggle and wiggle generate to `wasmtime::error`

* Fix testing `wiggle` and `wiggle-test` in isolation

When doing plain old `cargo test -p

Migrate wasi-http to `wasmtime::error` (#12291)

* Migrate wiggle and wiggle generate to `wasmtime::error`

* Fix testing `wiggle` and `wiggle-test` in isolation

When doing plain old `cargo test -p wiggle` (or `wiggle-test`) the test would
fail due to linking errors because Wasmtime's `std` cargo feature (and maybe
others) wasn't being enabled. The crate's tests would pass when run as part of
the whole workspace, however, because of cargo feature resolution and other
crates that enabled the necessary features, which is why CI is green.

* Remove direct anyhow dependency in wiggle-test

* Migrate wasi-nn to `wasmtime::error`

* Migrate wasi-keyvalue to `wasmtime::error`

* Migrate wasi-io to `wasmtime::error`

* Migrate wasi-http to `wasmtime::error`

show more ...


Revision tags: v40.0.1, v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5
# 4b7f3df3 03-Nov-2025 Roman Volosatovs <[email protected]>

fix `Request::into_http`, use in `handle` (#11970)

* fix `Request::into_http`, use in `handle`

Signed-off-by: Roman Volosatovs <[email protected]>

* doc: use correct body trait ref

Signed-of

fix `Request::into_http`, use in `handle` (#11970)

* fix `Request::into_http`, use in `handle`

Signed-off-by: Roman Volosatovs <[email protected]>

* doc: use correct body trait ref

Signed-off-by: Roman Volosatovs <[email protected]>

---------

Signed-off-by: Roman Volosatovs <[email protected]>

show more ...


# 8e22ff89 26-Oct-2025 Jelle van den Hooff <[email protected]>

wasi-http: use UnsyncBoxBody to support axum (#11941)

The Body type used by the axum web application framework is not Sync,
and not compatible with http_body_util::combinations::BoxBody. Luckily,
an

wasi-http: use UnsyncBoxBody to support axum (#11941)

The Body type used by the axum web application framework is not Sync,
and not compatible with http_body_util::combinations::BoxBody. Luckily,
an alternative UnsyncBoxBody exists.

Replace all wasi-http p3 usages of BoxBody with UnsyncBoxBody.

Some wasi-http p2 code refers directly to hyper types which use the
sync BoxBody. Do not modify those.

show more ...


Revision tags: v38.0.3, v38.0.2, v38.0.1, v37.0.2
# da633618 30-Sep-2025 Joel Dice <[email protected]>

support continuing host-to-host streams after store is dropped (#11763)

* add `StreamReader::try_into` and use it in `Response::into_http_with_getter`

This allows the embedder to consume a host-cre

support continuing host-to-host streams after store is dropped (#11763)

* add `StreamReader::try_into` and use it in `Response::into_http_with_getter`

This allows the embedder to consume a host-created `StreamReader` and extract
the `StreamProducer` (or an `Unpin` subset of it) used to create it. This
enables "short-circuiting" host-to-host streams, bypassing the guest entirely.

Concretely, it is now possible to dispose of a `wasi:http/[email protected]` guest
and its store before the request and/or response bodies have finished streaming
in the case where both the read and write ends of the body stream are owned by
the host. In this case, the inbound body is reused as the outbound body with no
additional processing or memory overhead.

Signed-off-by: Joel Dice <[email protected]>

* spawn tokio task instead of store task for outbound requests

Previously, `wasmtime-wasi-http`'s outbound request handler used
`Accessor::spawn` to spawn the connection future for a given outbound request,
but that meant the request stopped making progress when the store was dropped.
That's a problem for a proxy scenario where the guest task just wants to make an
outgoing request and return the response (or at least the body of that response)
and then exit. At that point, we should be able to drop the instance and its
store and expect the body stream will continue to flow. Using
`tokio::task::spawn` ensures that will happen.

Fixes #11703

Signed-off-by: Joel Dice <[email protected]>

* test host-to-host streaming in wasi-http p3 tests

In the process of adding these tests, I found that we were leaking subtasks
which had exited but not been dropped by their supertask by the time that
supertask was dropped, so I've fixed that.

Signed-off-by: Joel Dice <[email protected]>

* address review feedback

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v37.0.1, v37.0.0
# 53059995 17-Sep-2025 Roman Volosatovs <[email protected]>

feat(p3-http): implement `consume-body` changes (#11653)

* feat(p3-http): implement `consume-body` changes

Signed-off-by: Roman Volosatovs <[email protected]>

* Update WITs to the latest snap

feat(p3-http): implement `consume-body` changes (#11653)

* feat(p3-http): implement `consume-body` changes

Signed-off-by: Roman Volosatovs <[email protected]>

* Update WITs to the latest snapshot

* Use the 2025-09-16 tag instead of 2025-08-15.
* Pulls in `wasi:http` updates "officially".
* Pulls in minor `wasi:cli` updates, and that's implemented here as
well.

---------

Signed-off-by: Roman Volosatovs <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>

show more ...


# 5a2860ce 10-Sep-2025 Roman Volosatovs <[email protected]>

p3-http: rework `content-length` handling (#11658)

* p3-http: correctly handle `result` future cancellation

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: restructure the `con

p3-http: rework `content-length` handling (#11658)

* p3-http: correctly handle `result` future cancellation

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: restructure the `content-length` test a bit

Signed-off-by: Roman Volosatovs <[email protected]>

* test(http): keep accepting connections after errors

prtest:full

Signed-off-by: Roman Volosatovs <[email protected]>

* test(p3-http): assert `handle` error on exceeding `content-length`

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: perform `content-length` check early

Signed-off-by: Roman Volosatovs <[email protected]>

* test(p3-http): account for `handle` race condition

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(http): reuse `get_content_length`

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: check `content-length` for host bodies

Signed-off-by: Roman Volosatovs <[email protected]>

* doc(p3-http): call out that host bodies are not validated

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: refactor body size error send

Signed-off-by: Roman Volosatovs <[email protected]>

* fix(p3-http): do not rely on `Drop` for host body check

Signed-off-by: Roman Volosatovs <[email protected]>

* doc(p3-http): ensure non-default send request is documented

Signed-off-by: Roman Volosatovs <[email protected]>

* doc(p3-http): correct `send_request` doc

Signed-off-by: Roman Volosatovs <[email protected]>

---------

Signed-off-by: Roman Volosatovs <[email protected]>

show more ...


# d1139ae2 09-Sep-2025 Roman Volosatovs <[email protected]>

p3-http: implementation follow-up (#11649)

* p3: refactor future producers/consumers

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: tie lifetime of the spawned task to the bod

p3-http: implementation follow-up (#11649)

* p3: refactor future producers/consumers

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: tie lifetime of the spawned task to the bodies

Signed-off-by: Roman Volosatovs <[email protected]>

* p3-http: improve docs

Signed-off-by: Roman Volosatovs <[email protected]>

---------

Signed-off-by: Roman Volosatovs <[email protected]>

show more ...


# f3d72564 09-Sep-2025 Roman Volosatovs <[email protected]>

p3-http: finish `wasi:[email protected]` implementation (#11636)

* refactor(p3-http): use trappable errors

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): implement `content-lengt

p3-http: finish `wasi:[email protected]` implementation (#11636)

* refactor(p3-http): use trappable errors

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): implement `content-length` handling

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(p3-http): remove a few resource utilities

Signed-off-by: Roman Volosatovs <[email protected]>

* remove unused test import

Signed-off-by: Roman Volosatovs <[email protected]>

* fix(p3-http): close stream handles on drop

Signed-off-by: Roman Volosatovs <[email protected]>

* test(p3-http): stream responses back

This is something we've been doing in wasip3, but I forgot to port this
over

Signed-off-by: Roman Volosatovs <[email protected]>

* doc(p3-http): add missing docs, internalize more, simplify

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(p3-http): extract `Body::consume`

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(p3-http): clean-up `content-length` error reporting

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(p3-http): drop elided lifetime

Signed-off-by: Roman Volosatovs <[email protected]>

* fix(p3-http): avoid guest body deadlock hazard

Signed-off-by: Roman Volosatovs <[email protected]>

* refactor(p3-http): add more docs, clean-up

Signed-off-by: Roman Volosatovs <[email protected]>

* doc(p3-http): add more docs

Signed-off-by: Roman Volosatovs <[email protected]>

* fix(p3-http): rework result future handling

Most importantly this avoids a race condition between `content-length` error observed by `GuestBody`
and hyper I/O driver

Signed-off-by: Roman Volosatovs <[email protected]>

* add new imports after rebase

Signed-off-by: Roman Volosatovs <[email protected]>

* clean-up `poll_consume`

Signed-off-by: Roman Volosatovs <[email protected]>

* assert content-length `handle` results

Signed-off-by: Roman Volosatovs <[email protected]>

* relax `content_length` test `handle` assert

Signed-off-by: Roman Volosatovs <[email protected]>

---------

Signed-off-by: Roman Volosatovs <[email protected]>

show more ...


# 5674e4b4 07-Sep-2025 Roman Volosatovs <[email protected]>

feat(p3): implement `wasi:http` (#11440)

* feat(p3-http): begin implementation

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): implement incoming HTTP

Signed-off-by: Rom

feat(p3): implement `wasi:http` (#11440)

* feat(p3-http): begin implementation

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): implement incoming HTTP

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): switch to new API

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): begin outgoing implementation

Signed-off-by: Roman Volosatovs <[email protected]>

* test(p3-http): test invalid header

Signed-off-by: Roman Volosatovs <[email protected]>

* fix(p3-http): await I/O if future receiver dropped

Signed-off-by: Roman Volosatovs <[email protected]>

* Re-internalize some fields

Try to keep fields private and use public ctors instead.

* Uncomment `p3_http_outbound_request_content_length` test

It's still semi-failing, but defer that to #11631

* Get tests passing CI again

---------

Signed-off-by: Roman Volosatovs <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>

show more ...


Revision tags: v36.0.2, v36.0.1, v36.0.0
# 6f6a514b 15-Aug-2025 Roman Volosatovs <[email protected]>

feat(p3): begin `wasi:http` implementation (#11439)

* doc: fix typo in p3 filesystem ref

Signed-off-by: Roman Volosatovs <[email protected]>

* build: vendor `wasi:[email protected]` WIT

Signed-off-

feat(p3): begin `wasi:http` implementation (#11439)

* doc: fix typo in p3 filesystem ref

Signed-off-by: Roman Volosatovs <[email protected]>

* build: vendor `wasi:[email protected]` WIT

Signed-off-by: Roman Volosatovs <[email protected]>

* feat(p3-http): scaffold p3 implementation

Signed-off-by: Roman Volosatovs <[email protected]>

* test(p3-http): add tests

Signed-off-by: Roman Volosatovs <[email protected]>

* chore(p3-http): add utils used by p3 tests

Signed-off-by: Roman Volosatovs <[email protected]>

* chore: add `expect` reasons

Signed-off-by: Roman Volosatovs <[email protected]>

* address review comments

Signed-off-by: Roman Volosatovs <[email protected]>

* establish `conn` connections on drop

Signed-off-by: Roman Volosatovs <[email protected]>

---------

Signed-off-by: Roman Volosatovs <[email protected]>

show more ...