Skip to main content

Module wasi_http

Module wasi_http 

Source
Expand description

HTTP server plugin for handling incoming HTTP requests.

This plugin implements the wasi:http/incoming-handler interface, allowing WebAssembly components to handle HTTP requests. It provides a complete HTTP server implementation with support for:

  • Virtual hosting based on Host headers
  • TLS/HTTPS connections
  • Component isolation per request
  • Graceful shutdown capabilities

§Architecture

The HTTP server plugin works by:

  1. Binding to a TCP socket and listening for connections
  2. Routing requests to components based on the Host header
  3. Creating isolated component instances for each request
  4. Managing the request/response lifecycle through WASI-HTTP

Structs§

HttpServer
HTTP server plugin that handles incoming HTTP requests for WebAssembly components.

Functions§

handle_component_request
Handle a component request using WASI HTTP (copied from wash/crates/src/cli/dev.rs)

Type Aliases§

WorkloadHandles
A map from host header to resolved workload handles and their associated component id