Skip to content

Commit 8eefa7c

Browse files
feat(wasmtime-cli): restore support for wasi http module (#6878)
* feat(wasmtime-cli): add async support flag Within the wasmtime CLI, the current default behavior is to only inject the synchronous functions to linkers. This will add a flag called `--async` that will inject the asynchronous one instead. * chore: refactor wasi http crate * feat(wasmtime-wasi): make in_tokio function public * feat(wasi-http): define default feature called sync * Revert "feat(wasmtime-cli): add async support flag" This reverts commit b743ff2. * chore: improve flaky tests for wasi http * feat(wasi-http): expose sync api for components * chore: add tests for sync api of wasi http components * feat(wasmtime-cli): restore support for wasi http module * chore: revert change to outbound http request invalid test * chore: have extra tracing to help debugging * feat(wasi-http): allow modules with sync functions in linker * fix(wasi-http): missing response body in sync api * feat: include blocking for io streams * chore: add tests for wasi http module in cli * chore: disable preview2 flag in wasi http test * chore: use preview2 flag in wasi http test * fix(wasi-http): missing stream output in sync api * chore: fix tests for wasi http * chore: add tracing for poll oneoff call * chore: send exit signal on wasi http test * chore: swap println to tracing debug * chore: set http server timeout to 50 secs by default * chore: add test posting large file * chore: revert formatting in cargo toml * chore: fix wasi-http feature and skip failing tests prtest:full --------- Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com>
1 parent 5f9107a commit 8eefa7c

24 files changed

Lines changed: 2360 additions & 267 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ wasmtime-cranelift = { workspace = true }
2929
wasmtime-environ = { workspace = true }
3030
wasmtime-explorer = { workspace = true }
3131
wasmtime-wast = { workspace = true }
32-
wasmtime-wasi = { workspace = true, features = ["exit"] }
32+
wasmtime-wasi = { workspace = true, default-features = true, features = [
33+
"exit",
34+
] }
3335
wasmtime-wasi-nn = { workspace = true, optional = true }
3436
wasmtime-wasi-threads = { workspace = true, optional = true }
3537
wasmtime-wasi-http = { workspace = true, optional = true }
@@ -143,8 +145,8 @@ wasmtime-jit = { path = "crates/jit", version = "=14.0.0" }
143145
wasmtime-jit-debug = { path = "crates/jit-debug", version = "=14.0.0" }
144146
wasmtime-runtime = { path = "crates/runtime", version = "=14.0.0" }
145147
wasmtime-wast = { path = "crates/wast", version = "=14.0.0" }
146-
wasmtime-wasi = { path = "crates/wasi", version = "14.0.0" }
147-
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=14.0.0" }
148+
wasmtime-wasi = { path = "crates/wasi", version = "14.0.0", default-features = false }
149+
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=14.0.0", default-features = false }
148150
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "14.0.0" }
149151
wasmtime-wasi-threads = { path = "crates/wasi-threads", version = "14.0.0" }
150152
wasmtime-component-util = { path = "crates/component-util", version = "=14.0.0" }
@@ -272,7 +274,7 @@ jitdump = ["wasmtime/jitdump"]
272274
vtune = ["wasmtime/vtune"]
273275
wasi-nn = ["dep:wasmtime-wasi-nn"]
274276
wasi-threads = ["dep:wasmtime-wasi-threads"]
275-
wasi-http = ["dep:wasmtime-wasi-http"]
277+
wasi-http = ["dep:wasmtime-wasi-http", "wasmtime-wasi-http?/sync"]
276278
pooling-allocator = ["wasmtime/pooling-allocator", "wasmtime-cli-flags/pooling-allocator"]
277279
all-arch = ["wasmtime/all-arch"]
278280
component-model = [

crates/bench-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ shuffling-allocator = { version = "1.1.1", optional = true }
2121
target-lexicon = { workspace = true }
2222
wasmtime = { workspace = true }
2323
wasmtime-cli-flags = { workspace = true, default-features = true }
24-
wasmtime-wasi = { workspace = true }
24+
wasmtime-wasi = { workspace = true, default-features = true }
2525
wasmtime-wasi-nn = { workspace = true, optional = true }
2626
wasi-cap-std-sync = { workspace = true }
2727
cap-std = { workspace = true }

crates/c-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ wat = { workspace = true, optional = true }
2828

2929
# Optional dependencies for the `wasi` feature
3030
wasi-cap-std-sync = { workspace = true, optional = true }
31-
wasmtime-wasi = { workspace = true, optional = true }
31+
wasmtime-wasi = { workspace = true, default-features = true, optional = true }
3232
cap-std = { workspace = true, optional = true }
3333
wasi-common = { workspace = true, optional = true }
3434

crates/test-programs/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ http-body-util = "0.1.0-rc.2"
2121
hyper = { version = "1.0.0-rc.3", features = ["full"] }
2222
is-terminal = { workspace = true }
2323
tokio = { workspace = true, features = ["net", "rt-multi-thread", "macros"] }
24+
tracing = { workspace = true }
2425

2526
[dev-dependencies]
2627
anyhow = { workspace = true }
@@ -36,12 +37,14 @@ wasmtime = { workspace = true, features = ['cranelift', 'component-model'] }
3637

3738
wasi-common = { workspace = true }
3839
wasi-cap-std-sync = { workspace = true }
39-
wasmtime-wasi = { workspace = true, features = ["tokio"] }
40+
wasmtime-wasi = { workspace = true, default-features = true, features = [
41+
"tokio",
42+
] }
4043
cap-std = { workspace = true }
4144
cap-rand = { workspace = true }
4245
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
4346

44-
wasmtime-wasi-http = { workspace = true }
47+
wasmtime-wasi-http = { workspace = true, features = ["sync"] }
4548

4649
[features]
4750
test_programs = []

0 commit comments

Comments
 (0)