Debian Codegraph @

crates/wit-component/tests/interfaces/wasi-http/proxy.wit

raw
1 package wasi:[email protected];
2
3 /// The `wasi:http/proxy` world captures a widely-implementable intersection of
4 /// hosts that includes HTTP forward and reverse proxies. Components targeting
5 /// this world may concurrently stream in and out any number of incoming and
6 /// outgoing HTTP requests.
7 world proxy {
8 /// HTTP proxies have access to time and randomness.
9 include wasi:clocks/[email protected];
10 import wasi:random/[email protected];
11
12 /// Proxies have standard output and error streams which are expected to
13 /// terminate in a developer-facing console provided by the host.
14 import wasi:cli/[email protected];
15 import wasi:cli/[email protected];
16
17 /// TODO: this is a temporary workaround until component tooling is able to
18 /// gracefully handle the absence of stdin. Hosts must return an eof stream
19 /// for this import, which is what wasi-libc + tooling will do automatically
20 /// when this import is properly removed.
21 import wasi:cli/[email protected];
22
23 /// This is the default handler to use when user code simply wants to make an
24 /// HTTP request (e.g., via `fetch()`).
25 import outgoing-handler;
26
27 /// The host delivers incoming HTTP requests to a component by calling the
28 /// `handle` function of this exported interface. A host may arbitrarily reuse
29 /// or not reuse component instance when delivering incoming HTTP requests and
30 /// thus a component must be able to handle 0..N calls to `handle`.
31 export incoming-handler;
32 }