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