Skip to content

v0.2.0

Choose a tag to compare

@ehsanmok ehsanmok released this 17 Apr 08:47
· 1297 commits to main since this release

Minor release with major improvements to the HTTP server, full IPv6 support, cookies, hardened WebSocket, and extensive testing and fuzzing.

Highlights

HTTP server (rewrite)

  • Buffered 8KB chunk reads (no more 1-byte loops).
  • HTTP/1.1 keep-alive with max_keepalive_requests and idle_timeout_ms controls; HTTP/1.0 aware.
  • Recv/send timeouts via SO_RCVTIMEO / SO_SNDTIMEO.
  • Configurable max_uri_length, max_header_bytes, max_body_bytes.
  • RFC 7230 token validation for methods and header names.
  • Response helpers: ok, ok_json, not_found, bad_request, internal_error, etc.
  • Accurate Connection: close semantics and Content-Length handling.

IPv6

  • Full IPv6 wire support (AF_INET6 listeners, connects, sockaddr_in6 packing).
  • Dual-stack DNS with automatic fallback: resolve() returns both A and AAAA records and _connect_with_fallback() iterates through them with per-address timeouts.
  • IPv6 loopback probes in tests to skip gracefully on environments without IPv6 loopback.

Cookies (new module)

  • Cookie, CookieJar, SameSite enum.
  • parse_cookie_header and parse_set_cookie_header with attribute support (Path, Domain, Max-Age, Expires, Secure, HttpOnly, SameSite).
  • Fuzz-tested (200k runs per harness).

WebSocket hardening

  • CSPRNG nonce from /dev/urandom (no PRNG guessable).
  • Text-frame UTF-8 validation per RFC 6455 — invalid sequences raise WsProtocolError.

Performance

  • Zero-copy header line parsing.
  • Eliminated _lower_keys and replaced with inline case-insensitive comparison (_eq_icase).
  • Faster HeaderMap with set_unchecked and encode_to.

Bug fixes

  • NUL byte crash in HTTP response parser.
  • Various compiler warning cleanups across tests and source.

Testing and fuzzing

  • 260+ unit tests covering TCP, UDP, TLS, HTTP, WebSocket, DNS, net, ergonomics, server, and cookies.
  • Fuzz harnesses: 200k runs each for headers, HTTP response, HTTP server, URL, WebSocket client, WebSocket server, cookies.
  • Format check step added to CI.

Benchmarking

  • Microbenchmarks for header encode/parse.
  • wrk-compatible HTTP server benchmark with a driver script.
  • Benchmarks now run with idle_timeout_ms=0 and write_timeout_ms=0 for maximum throughput.

Dependencies

  • mojo pinned to ==0.26.3.0.dev2026041520 (pixi dep and rattler recipe).
  • json pinned to tag v0.1.1 (pixi dep and rattler source).

Installation

[dependencies]
flare = { git = "https://github.com/ehsanmok/flare.git", tag = "v0.2.0" }

Upgrade notes

No breaking public API changes vs v0.1.0, but the HTTP server config has new fields with sensible defaults. If you construct ServerConfig manually, review the new knobs (idle_timeout_ms, write_timeout_ms, max_keepalive_requests, max_uri_length).