bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.21k stars 1.28k forks source link

wasi-http: Consider unhiding `add_only_http_to_linker` functions #8832

Closed lann closed 3 months ago

lann commented 3 months ago

These functions allow linking just the types and outbound-handler interfaces without the rest of the proxy world. I'm not sure why they are currently hidden; this seems like a generally useful feature.

They could probably use better names as well since they only add 2 out of 3 of the http interfaces.

landonxjames commented 3 months ago

Just to give my use-case for this. I work on the AWS Rust SDK and I maintain our aws-smithy-wasm crate. This includes a WasiHttpClient for sending outbound HTTP calls to AWS services. So the full proxy world is overkill for my needs and I would prefer to link in the minimal set of interfaces that I need.

That seems possible today with the add_to_linker_get_host functions, but I haven't had time to go through and figure out what I actually need to implement for the host_getter yet.

lann commented 3 months ago

As another use-case, Spin just uses the hidden function anyway :slightly_smiling_face: https://github.com/fermyon/spin/blob/bc86ff322cf3e1aee19e3001094a5231bcbcd9df/crates/trigger/src/lib.rs#L146