Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi-http/src/p3/wit/deps/http/proxy.wit
1693 views
package wasi:[email protected];

/// The `wasi:http/imports` world imports all the APIs for HTTP proxies.
/// It is intended to be `include`d in other worlds.
world imports {
  /// HTTP proxies have access to time and randomness.
  include wasi:clocks/[email protected];
  import wasi:random/[email protected];

  /// Proxies have standard output and error streams which are expected to
  /// terminate in a developer-facing console provided by the host.
  import wasi:cli/[email protected];
  import wasi:cli/[email protected];

  /// TODO: this is a temporary workaround until component tooling is able to
  /// gracefully handle the absence of stdin. Hosts must return an eof stream
  /// for this import, which is what wasi-libc + tooling will do automatically
  /// when this import is properly removed.
  import wasi:cli/[email protected];

  /// This is the default handler to use when user code simply wants to make an
  /// HTTP request (e.g., via `fetch()`).
  ///
  /// This may also be used to pass synthesized or forwarded requests to another
  /// component.
  import handler;
}

/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
/// this world may concurrently stream in and out any number of incoming and
/// outgoing HTTP requests.
world proxy {
  include imports;

  /// The host delivers incoming HTTP requests to a component by calling the
  /// `handle` function of this exported interface. A host may arbitrarily reuse
  /// or not reuse component instance when delivering incoming HTTP requests and
  /// thus a component must be able to handle 0..N calls to `handle`.
  ///
  /// This may also be used to receive synthesized or forwarded requests from
  /// another component.
  export handler;
}