50 releases (29 breaking)

0.31.0 Nov 7, 2024
0.29.0 Oct 2, 2024
0.25.2 Jul 11, 2024
0.19.0 Mar 27, 2024

#65 in WebAssembly

Download history 2165/week @ 2024-07-28 1321/week @ 2024-08-04 1272/week @ 2024-08-11 2400/week @ 2024-08-18 1611/week @ 2024-08-25 1597/week @ 2024-09-01 1628/week @ 2024-09-08 2171/week @ 2024-09-15 3451/week @ 2024-09-22 3587/week @ 2024-09-29 3822/week @ 2024-10-06 3531/week @ 2024-10-13 7820/week @ 2024-10-20 7687/week @ 2024-10-27 5450/week @ 2024-11-03 2752/week @ 2024-11-10

23,845 downloads per month
Used in 7 crates (4 directly)

Apache-2.0 WITH LLVM-exception

2MB
1K SLoC

Contains (rust library, 1.5MB) libwasi-6168f1cb72d46588.rlib, (Mach-o exe, 470KB) build-script-build, (Mach-o exe, 470KB) build_script_build-d7c6207486c06b2d, (rust library, 210KB) libbitflags-f79be0607977e26a.rlib, (rust library, 28KB) libincoming.rlib, (rust library, 28KB) libincoming.rlib and 2 more.

WASI HTTP

A proposed WebAssembly System Interface API.

Current Phase

wasi-http is currently in Phase 3

Champions

  • Piotr Sikora
  • Jiaxiao Zhou
  • Dan Chiarlone
  • David Justice
  • Luke Wagner

Portability Criteria

WASI-http must have at least two complete independent implementations demonstrating embeddability in a production HTTP server context.

Introduction

The WASI-http proposal defines a collection of interfaces for sending and receiving HTTP requests and responses. WASI-http additionally defines a world, wasi:http/proxy, that circumscribes a minimal execution environment for wasm HTTP proxies.

Goals

The proposal intends to abstract over HTTP version and transport protocol choices (such as HTTP/1.1, HTTP/2 or HTTP/3) by mapping directly to the abstract HTTP Semantics, allowing hosts to (mostly) transparently use any of these.

The wasi:http/proxy world is meant to be implementable by a wide variety of hosts including Web service workers, forward- and reverse-proxies and origin servers by requiring a minimal set of additional runtime support.

The wasi:http/proxy world is meant to support flexible auto-scaling ("serverless") execution by moving the core accept() loop into the host and allowing the host to dynamically spin up wasm instances in response to arriving requests.

The wasi:http/proxy world is meant to allow the chaining of HTTP intermediaries to be implemented directly in terms of Component Model linking. (Fully realizing this goal will require additional features only available in the Preview 3 timeframe.)

Non-goals

WASI-http does not intend to define a more fully-featured cloud execution environment (for this, see the wasi-cloud-core proposal).

API walk-through

The proposal can be understood by first reading the comments of proxy.wit, then handler.wit and finally types.wit.

Working with the WIT

Bindings can be generated from the wit directory via:

wit-bindgen c wit/ --world proxy

and can be validated and otherwise manipulated via:

wasm-tools component wit wit/ ...

The wit/deps directory contains a live snapshot of the contents of several other WASI proposals upon which this proposal depends. It is automatically updated by running wit-deps update in the root directory, which fetches the live contents of the main branch of each proposal. As things stablize, wit/deps.toml will be updated to refer to versioned releases.

References & acknowledgements

  • This proposal was seeded by and developed in consultation with proxy-wasm.

Dependencies

~6–22MB
~352K SLoC