I/O HTTP

HTTP client library for Rust
This library is composed of 3 feature-gated layers:
- Low-level I/O-free coroutines: no_std-compatible state machines containing the whole HTTP logic, usable anywhere
- Mid-level light client: a standard, blocking client wrapping a stream you opened yourself
- High-level full client: the light client plus TCP connections and TLS negotiations handled for you
Table of contents
Features
- I/O-free coroutines: no_std state machines with no sockets and no async runtime, resumable from any blocking, async or in-memory test harness.
- HTTP/1.0 and HTTP/1.1: send a request and receive its response, with fixed-length, chunked and read-to-EOF body strategies; redirects are surfaced to the caller, never followed silently.
- Streaming: decode a long-lived chunked response one chunk at a time and consume server-sent events as they arrive.
- Authentication helpers: build and parse basic and bearer authorization values, with credentials redacted from debug output and logs.
- Well-known discovery: probe the reserved well-known location of a service and surface where it redirects.
- Light standard, blocking client wrapping a stream you opened yourself
- Full standard, blocking client with TLS support:
- Rustls with ring crypto (requires
rustls-ringfeature, enabled by default) - Rustls with aws crypto (requires
rustls-awsfeature) - Native TLS (requires
native-tlsfeature)
- Rustls with ring crypto (requires
[!TIP] I/O HTTP is written in Rust and uses cargo features to gate backend support. The default feature set is declared in Cargo.toml or on docs.rs.
RFC coverage
| RFC | What is covered |
|---|---|
| 1945 | HTTP/1.0: send a request and receive its response, connections closing after each exchange by default |
| 6750 | Bearer authentication: carry an OAuth 2.0 access token in the authorization header |
| 7617 | Basic authentication: carry a base64-encoded username and password pair in the authorization header |
| 8615 | Well-known discovery: probe the reserved well-known path of an origin and surface the redirect target |
| 9110 | HTTP semantics: the version-agnostic request, response, status code and authentication challenge model shared by every wire format |
| 9112 | HTTP/1.1: send a request and receive its response, including chunked bodies, both whole and streamed |
| SSE | Server-sent events (WHATWG HTML Living Standard): decode an event stream one event at a time |
Usage
The whole API is documented on docs.rs, including runnable snippets for every coroutine and client.
Examples
Complete runnable programs live in ./examples; the tests also demonstrate real usage.
License
This project is licensed under either of:
Social
- Chat on Matrix
- News on Mastodon or RSS
- Mail at pimalaya.org@posteo.net
Sponsoring
Special thanks to the NLnet foundation and the European Commission that have been financially supporting the project for years:
- 2022 → 2023: NGI Assure
- 2023 → 2024: NGI Zero Entrust
- 2024 → 2026: NGI Zero Core
- 2026 → 2027: NGI Zero Commons Fund
This program is part of Pimalaya, free software funded entirely by grants and donations. If you find it useful, consider sponsoring its development:
