Repository navigation
0.2.0
0.2.0 is the API review I wanted done before the Node and Python bindings build on Anole. It batches every breaking change of the 0.x API in one release, so there's a migration to do; docs/migrating.md has an old -> new table for each area.
zig fetch --save git+https://github.com/xuckless/anole#v0.2.0Breaking, in short
- Options are flat and typed.
ServerOptions.serveris gone: its settings are flattimeouts,limitsandproxygroups named as in the C ABI. Durations areanole.Duration(.fromSeconds(10)), TLS has one shape everywhere (anole.Cert), and every middleware is built withinit(.{ ... }). - Errors are named sets.
init,listen,listenTls,runandwaitReadyreturnanole.ServerError; misusing a request or response (a secondreq.reader(), ...) is aMisuseError, not an assert. - Safer defaults. The graceful drain waits 10 s (was 30 s), WebSocket messages are capped at 1 MiB (was 16 MiB), and database calls are bounded by 30 s unless a call opts out.
- Databases speak one vocabulary across SQLite, PostgreSQL, MongoDB and Redis (
table/execValues, oneOptionsshape). - C ABI 0.7. Request calls share the
anole_req_prefix, cleanup calls are idempotent,ANOLE_EV_ABORTsays why, request records are 128 bytes, and event types and handle kinds have one frozen allocation table. A library only serves code built against the same ABI version before 1.0, so rebuild against the newanole.h.
New
app.listen("3000")listens on every interface;app.rateLimit(.{ .limit = 100 })is a one-line rate limiter.- WebSocket subprotocols and handshake headers, handshakes decided by the application (also in the C ABI), and in-order publishes per topic.
timeouts.write,req.setDeadline,req.readerLimited,res.headersSent(),EventStream.commentfor heartbeats.- C ABI: database transactions (
anole_db_begin), queries tied to the request they serve,anole_server_open,anole_last_error_name(), andinclude/anole.abi.jsonfor binding generators.
Fixed
Among others: event streams and downloads are no longer cut at the request timeout, setting any http2 option no longer drops the stream limit, C ABI executors no longer spin while a consumer is idle, and a server with many thousands of connections on one core accepts new ones promptly again (p99 at 25,000 connections went from about 6 s to about 0.2 s).
Checked
A 2-hour soak at half capacity across HTTP/1.1, TLS, HTTP/2 and HTTP/3: 75.4 million requests, no errors, memory flat (16.5-19.8 MB). A Debug run reports no leaks. Against 0.1.3 on one CPU: HTTP/1.1 and HTTP/2 within ±2%, HTTP/3 on epoll +14% with its p99 cut by more than half.
Full list in CHANGELOG.md.