PulseHTTP
Async HTTP/1.1 framework for Rust, built on Tokio from raw TCP sockets
Install
[]
= "0.2"
= { = "1", = ["full"] }
Quick start
use ;
async
Ctrl+C triggers graceful shutdown (stop accept → drain connections → grace abort).
Features
- Tokio TCP listener, task-per-connection, admission semaphore
- HTTP/1.1 keep-alive,
Content-Lengthand chunked request bodies - Streaming file responses (
Response::file) without buffering the whole file - Read and write timeouts (slow clients close the connection)
- Trie router (static +
:param), query params - Async middleware (request id, logging, CORS, security headers, panic catch)
- JSON +
application/x-www-form-urlencoded+multipart/form-data - Typed app
State - Per-route token-bucket rate limits
- Configurable max connections, max body size, read/write timeouts
- Graceful shutdown
Examples
From this repo:
# routing, JSON, forms — no database
# per-route rate limiting (429 after burst)
# typed State + Postgres (sqlx)
| Example | Port | Focus |
|---|---|---|
hello_world |
3000 | Basics |
sqlx_postgres |
3001 | State + DB |
rate_limit |
3002 | Route limits |
Builder knobs
bind
.await
.max_connects
.max_body_size
.read_timeout_sec
.write_timeout_sec
.router
.serve
.await;
Benchmarks
Micro-benchmarks via Criterion (release mode). Numbers below are from one run on Apple Silicon (Aug 2026) — treat as relative, not absolute.
| Bench | Median time |
|---|---|
parse_headers |
~471 ns |
parse_urlencoded |
~326 ns |
parse_multipart |
~872 ns |
router_match_param |
~222 ns |
Reproduce:
HTML reports (local): pulse_http/target/criterion/*/report/index.html
License
MIT