Skip to content

Commit

Permalink
feat(wasmtime-cli): restore support for wasi http module (#6878) (#6974)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
eduardomourar and eduardomourar authored Sep 11, 2023
1 parent f10d665 commit 2ecbf48
Show file tree
Hide file tree
Showing 24 changed files with 2,360 additions and 267 deletions.
17 changes: 1 addition & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ wasmtime-cranelift = { workspace = true }
wasmtime-environ = { workspace = true }
wasmtime-explorer = { workspace = true }
wasmtime-wast = { workspace = true }
wasmtime-wasi = { workspace = true, features = ["exit"] }
wasmtime-wasi = { workspace = true, default-features = true, features = [
"exit",
] }
wasmtime-wasi-nn = { workspace = true, optional = true }
wasmtime-wasi-threads = { workspace = true, optional = true }
wasmtime-wasi-http = { workspace = true, optional = true }
Expand Down Expand Up @@ -143,8 +145,8 @@ wasmtime-jit = { path = "crates/jit", version = "=13.0.0" }
wasmtime-jit-debug = { path = "crates/jit-debug", version = "=13.0.0" }
wasmtime-runtime = { path = "crates/runtime", version = "=13.0.0" }
wasmtime-wast = { path = "crates/wast", version = "=13.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "13.0.0" }
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=13.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "13.0.0", default-features = false }
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=13.0.0", default-features = false }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "13.0.0" }
wasmtime-wasi-threads = { path = "crates/wasi-threads", version = "13.0.0" }
wasmtime-component-util = { path = "crates/component-util", version = "=13.0.0" }
Expand Down Expand Up @@ -272,7 +274,7 @@ jitdump = ["wasmtime/jitdump"]
vtune = ["wasmtime/vtune"]
wasi-nn = ["dep:wasmtime-wasi-nn"]
wasi-threads = ["dep:wasmtime-wasi-threads"]
wasi-http = ["dep:wasmtime-wasi-http"]
wasi-http = ["dep:wasmtime-wasi-http", "wasmtime-wasi-http?/sync"]
pooling-allocator = ["wasmtime/pooling-allocator", "wasmtime-cli-flags/pooling-allocator"]
all-arch = ["wasmtime/all-arch"]
component-model = [
Expand Down
2 changes: 1 addition & 1 deletion crates/bench-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ shuffling-allocator = { version = "1.1.1", optional = true }
target-lexicon = { workspace = true }
wasmtime = { workspace = true }
wasmtime-cli-flags = { workspace = true, default-features = true }
wasmtime-wasi = { workspace = true }
wasmtime-wasi = { workspace = true, default-features = true }
wasmtime-wasi-nn = { workspace = true, optional = true }
wasi-cap-std-sync = { workspace = true }
cap-std = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ wat = { workspace = true, optional = true }

# Optional dependencies for the `wasi` feature
wasi-cap-std-sync = { workspace = true, optional = true }
wasmtime-wasi = { workspace = true, optional = true }
wasmtime-wasi = { workspace = true, default-features = true, optional = true }
cap-std = { workspace = true, optional = true }
wasi-common = { workspace = true, optional = true }

Expand Down
7 changes: 5 additions & 2 deletions crates/test-programs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ http-body-util = "0.1.0-rc.2"
hyper = { version = "1.0.0-rc.3", features = ["full"] }
is-terminal = { workspace = true }
tokio = { workspace = true, features = ["net", "rt-multi-thread", "macros"] }
tracing = { workspace = true }

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

wasi-common = { workspace = true }
wasi-cap-std-sync = { workspace = true }
wasmtime-wasi = { workspace = true, features = ["tokio"] }
wasmtime-wasi = { workspace = true, default-features = true, features = [
"tokio",
] }
cap-std = { workspace = true }
cap-rand = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

wasmtime-wasi-http = { workspace = true }
wasmtime-wasi-http = { workspace = true, features = ["sync"] }

[features]
test_programs = []
Loading

0 comments on commit 2ecbf48

Please sign in to comment.