Skip to content

Commit 475e5aa

Browse files
committed
feat(http): add a bounded cancellable host client
1 parent 3affd52 commit 475e5aa

15 files changed

Lines changed: 3178 additions & 34 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ name = "vm"
2727
[features]
2828
default = ["runtime", "cli", "cranelift-jit"]
2929
runtime = []
30+
http-client = ["dep:reqwest", "dep:url", "dep:tokio", "dep:futures-util"]
3031
edge-abi = [
3132
"dep:edge_abi",
3233
"edge_abi/console",
@@ -60,6 +61,10 @@ cranelift-jit = { version = "0.129.1", optional = true }
6061
cranelift-module = { version = "0.129.1", optional = true }
6162
cranelift-native = { version = "0.129.1", optional = true }
6263
pd-host-function = { path = "./pd-host-function", version = "0.1.0" }
64+
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream"], optional = true }
65+
url = { version = "2", optional = true }
66+
futures-util = { version = "0.3", optional = true }
67+
tokio = { version = "1", features = ["rt", "net", "time"], optional = true }
6368
edge_abi = { package = "pd-edge-abi", version = "0.1.1", default-features = false, optional = true }
6469
futures-channel = "0.3"
6570
paste = "1"
@@ -85,5 +90,10 @@ name = "host_binding_generation_tests"
8590
path = "tests/host_binding_generation_tests.rs"
8691
required-features = ["cranelift-jit"]
8792

93+
[[test]]
94+
name = "http_host_tests"
95+
path = "tests/vm/http_host_tests.rs"
96+
required-features = ["http-client"]
97+
8898
[build-dependencies]
8999
syn = { version = "2", features = ["full"] }

build.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,18 @@ fn main() {
149149
println!("cargo:rerun-if-changed={}", catalog_path.display());
150150
let catalog = parse_catalog(&catalog_path);
151151

152-
let host_sources = [SourceSpec {
153-
path: "src/builtins/runtime/host.rs".to_string(),
154-
module: "host".to_string(),
155-
category: SourceCategory::DefaultHost,
156-
}];
152+
let host_sources = [
153+
SourceSpec {
154+
path: "src/builtins/runtime/host.rs".to_string(),
155+
module: "host".to_string(),
156+
category: SourceCategory::DefaultHost,
157+
},
158+
SourceSpec {
159+
path: "src/builtins/runtime/http.rs".to_string(),
160+
module: "http".to_string(),
161+
category: SourceCategory::DefaultHost,
162+
},
163+
];
157164
let builtin_sources = builtin_source_specs(&namespaces);
158165
let core_sources = [SourceSpec {
159166
path: "src/builtins/runtime/core.rs".to_string(),

0 commit comments

Comments
 (0)