~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zttp

mirror of https://tangled.org/zat.dev/zttp

0
0
main
169 lines · 9.3 KB Raw History
# changelog

## 0.4.1

- **fix**: idle pooled connections the peer has closed are destroyed before
  the next request, whichever origin it goes to. They used to stay in
  CLOSE_WAIT until a request to their own origin picked them up, so a client
  talking to origins that reap idle connections (the Bluesky AppView does)
  held dozens of dead sockets.

## 0.4.0

- **breaking**: `extra_headers` has no count limit, and `error.TooManyHeaders`
  is gone. Before, `accept` plus `extra_headers` had to fit in eight slots, so a
  proxy forwarding a client's headers failed before sending anything. Outgoing
  headers are now bounded only by what the caller passes, as in undici and
  hyper; the merged list is allocated only when `accept` and `extra_headers`
  are both set, and redirect scoping copies it only on a cross-origin hop.

## 0.3.0

- **breaking**: zttp no longer links libc, so consumers that relied on it
  for their own C calls must set `link_libc` themselves. zttp and its
  examples build for `x86_64-linux-none` as static binaries.
- **breaking**: head and total deadlines are absolute across redirects and
  retries, and every configured guard needs `Io.concurrent`. A request with a
  deadline on an `Io` that cannot run concurrent tasks fails with
  `error.ConcurrencyUnavailable` instead of being sent without its deadline.
  Cancellation joins the operation before returning.
- **feat**: `Client.shutdown(timeout_ns)` stops new requests (`ClientClosed`),
  waits for owned requests and responses, and closes idle TLS connections
  with `close_notify` within one budget. `deinit` attempts it with
  `shutdown_deadline_ns`.
- **fix**: a body cut short of its Content-Length fails with
  `ResponseTruncated` instead of returning a short body with a 200.
- **fix**: response framing is validated before a connection is reused.
- **security**: a redirect to another origin drops `Authorization`,
  `Cookie` and `Proxy-Authorization` from the caller's extra headers, as it
  already did for the request's own authorization.
- **tests**: `just conformance` runs an isolated real-socket HTTP gate; see
  `tests/conformance/README.md`.

## 0.2.0

First stable release of the Zig 0.17 line. Everything since 0.2.0-alpha.5 is
tooling and docs; the client is unchanged.

- **docs**: `scripts/MACOS_TRUST.md` describes an optional, reversible patch
  that applies the same compromised-key exclusions to Zig 0.17.0's own macOS
  keychain loader, so `zig fetch` gets the protection too. It defaults to a
  dry run and requires an exact source checksum.
- **tools**: `scripts/std_http_trust_probe.zig` makes the direct `std.http`
  trust check reproducible.
- **docs**: `AGENTS.md` names the checks to run; `just check` and `just fmt`
  cover `scripts` and `examples`.

## 0.2.0-alpha.5

- **feat**: `zttp.distrustCompromisedKeys(bundle)` exposes the CA distrust
  pass for callers that build their own `std.http` client and bundle.

## 0.2.0-alpha.4

- **fix**: remove the four roots and eight compromised intermediate public keys
  from the October 2026 eMudhra incident from every loaded CA bundle, including
  caller-supplied bundles. Keys are blocked by SubjectPublicKeyInfo digest, so
  cross-signing cannot restore them. Chains anchored only at those roots fail.
  The original certificates are kept as offline fixtures under
  `src/trust-fixtures/`; `zig build trust-probe` checks the public bad-chain
  hosts and a control through the real client.

## 0.2.0-alpha.3

- **fix**: refresh TLS certificate validation time before each HTTPS connection,
  including redirects and explicitly resolved addresses. Long-lived clients
  could reject newly rotated certificates using the time of their first request.
- **fix**: initialize trust before the first explicitly resolved TLS connection.
- TLS connection setup is serialized per client to protect std.http's shared
  validation timestamp; response heads and bodies still progress concurrently.
- A real local TLS regression covers stale timestamps, hostname rejection,
  and overlapping requests on a shared client.

## 0.2.0-alpha.2

- built and tested against the zig 0.17.0 release; `minimum_zig_version` is
  now `0.17.0`.
- **fix**: `Response.stream` delivers body bytes that are already buffered
  before it reads the network again. a server that sends one event and then
  waits for the client (SSE, request/response over one body) stalled until its
  own timeout.
- **fix**: a canceled `fetch` or `open` returns `error.Canceled` while waiting
  for the response head. the head watcher swallowed the cancel and then waited
  on the head with no bound, so a cancel against a silent peer never returned.
- **fix**: the head deadline, request deadline and stall guard now hold when
  the `Io` runs `async` work inline, which `Io.Threaded` does once it is at its
  async limit (always on a 1-vCPU machine). the watchers start their work with
  `io.concurrent`; if the `Io` answers `ConcurrencyUnavailable` the request
  runs without guards and logs one warning per process.
- **fix**: a pooled keep-alive connection that the peer resets instead of
  answering is replayed for idempotent requests. std reports the reset as
  `error.ReadFailed`, which was surfaced to the caller; a clean close was
  already replayed. head read failures now carry the socket's own error
  (`error.ConnectionResetByPeer` and friends) instead of `error.ReadFailed`.

## 0.2.0-alpha.1

- **breaking**: requires zig 0.17. Built and tested against
  `0.17.0-dev.2384+ac77c23af`; 0.16 users stay on 0.1.x.
- port to 0.17: `Uri.getHost` -> `Io.net.HostName.fromUri`, `a ** b` -> `@splat`,
  `ascii.indexOfIgnoreCase` -> `findIgnoreCase`, `b.args` -> `addPassthruArgs`.

## 0.1.2

- preserve signed `RateLimit-Reset` values for protocol-specific retry policies.
  `RateLimitHeaders.reset` is now `?i64`; explicitly typed unsigned callers
  must update. Generic delay selection retains Retry-After priority and treats
  negative reset values as expired.

## 0.1.1

- **fix**: accept RFC 850 and asctime HTTP dates in `Retry-After`, alongside
  IMF-fixdate. Reject impossible calendar dates and out-of-range times.

## 0.1.0

- initial release: `zttp.Client` with a response-head deadline, a body stall
  guard (idle and minimum-rate), dead-connection replay for idempotent
  requests, redirect handling that never replays a body, transparent gzip,
  rate-limit header parsing, caller-selected response header capture, a
  checked-address dial path, and a real default `User-Agent`.
- **feat**: `FetchOptions.accept_encoding` replaces std's default `gzip, deflate` for one
  request. an `accept-encoding` in `extra_headers` would have been sent alongside std's, as a
  second header.
- **feat**: `Client.open` returns a `Response` once the head is in; `Response.stream` drains
  the body into any `std.Io.Writer` under the stall guard, an optional byte cap, progress
  counters, and what the request deadline has left. `fetch` is now `open` plus a stream into
  memory, so both paths share every guard. for bodies that belong on disk, or sinks that
  depend on the status.
- **fix**: `authorization` no longer follows a redirect to another origin. zig 0.16's
  `std.http.Client` strips `privileged_headers` on a domain change but never writes them to
  the wire, so the only way to protect the token was for `fetch` to run the redirect loop
  itself. it now does, with loop detection, a hop limit (`Client.redirects.max_hops`), no
  https to http downgrade by default, RFC-shaped method rewrites (303 and 301/302-on-POST
  become a bodiless GET, 307/308 resend the body), and `authorization` dropped whenever a
  hop changes scheme, host, or port.
- **change**: `FetchOptions.redirect_behavior` (a std type) is replaced by
  `on_redirect: .follow | .surface | .refuse`. a `resolved_connection` request is never
  redirected away from the vetted address; its 3xx is surfaced.
- **change**: a payload without `content_type` is `error.MissingContentType` instead of a
  silent request with no content-type header.
- **feat**: `zttp.Error` names every failure the client adds over std's.
- **fix**: `StallGuard.min_bytes_per_s` is measured over a trailing `window_ns` (default
  10s) instead of a lifetime average. a body that arrived at megabytes per second and then
  trickles was never caught: the average stayed high for as long as the burst was large.
- **fix**: the guard watchers poll every 10ms instead of sleeping a full 100ms (body) or
  50ms (head) before their first check. every fetch paid up to 100ms of floor even when the
  body landed at once.
- **feat**: `FetchOptions.deadline_ns` bounds the whole request; `head_deadline_ns` and
  `stall` can be overridden per request, and `Client.max_response_size` sets a default cap.
  callers no longer mutate shared client fields to get a per-call budget.
- **fix**: `max_response_size` is enforced while the body streams. it used to allocate the
  whole cap up front and then copy the body out of it.
- **fix**: a URL containing a control character, or a header containing CR/LF, is refused
  (`error.InvalidUrl`, `error.InvalidHeader`). std writes the request line verbatim and
  only asserts on headers, so outside input could inject headers or crash a safe build.
- **feat**: `Retry-After` in http-date form is parsed (`retry_after_at`), and
  `RateLimitHeaders.delaySeconds(now)` ranks `Retry-After` over `RateLimit-Reset` and reads
  a reset at or past 1e9 as an absolute time.
- **feat**: `FetchResult.final_url` reports where a followed redirect ended up.