ludic/changes/http-namespace.md
Orkuncakilkaya 3df6640fa5
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 19s
ci / build-and-test (push) Successful in 1m26s
commit-lint / conventional-commits (push) Successful in 5s
docs / build-and-deploy (push) Successful in 21s
feat(http): Http.* poll-based HTTP/HTTPS client over a native NSURLConnection backend (#6)
Adds the Http.* namespace and its transport, the HTTP client from #6. The JSON
companion the proposal called for already shipped as Json.* (#44).

- runtime/native/http.ll: the macOS transport — NSURLConnection driven through
  the objc runtime C ABI (no ObjC/C source), run on a detached pthread so the
  frame never blocks; TLS is the system's, on by default. A fixed slot pool holds
  each in-flight request; the worker publishes status/body/response behind an
  atomic done flag (release/acquire). Spliced + Foundation linked only when a
  program uses Http.*.
- runtime/native/http.ludic: the Http.* runtime — get/post/request, the
  open/set/body/send builder, poll/status/ok/text/body_len/header/free, plus a
  pure-Ludic response parser (Http.parse + case-insensitive header lookup) that
  is transport-independent and portable.
- compiler: Http.* dispatch, g_uses_http splice, hs_* transport intrinsics +
  declarations, the conditional Foundation link, and a new \r string/char escape
  the protocol needs.
- docs: a full docs/language/http section (16 pages); check-impl/check-docs green.
- test: examples/library/http.ludic self-asserts the parser offline (Darwin-gated
  build via the canonical path, since it links Foundation).

Verified end to end against real endpoints: HTTPS GET (200 + headers + body) and
POST (body + custom header). HTTP is out-of-band and never feeds the
deterministic sim. Reseeded; suites green (81 + 29).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-31 18:10:53 +03:00

1.3 KiB

bump: minor type: feat HTTP client standard library (#6). Http.* — a poll-based HTTP/HTTPS client for out-of-band data (leaderboards, cloud saves, remote config, telemetry, downloads). Http.get / Http.post / Http.request start a request (or Http.open + Http.set headers + Http.body + Http.send to build one up); Http.poll returns -1 while pending, 0 on error, else the status code, so the frame never blocks; Http.status / ok / text / body_len / header read the reply, and Http.free releases it. TLS is the system's, on by default with certificate verification — an https:// URL just works. Pairs with the Json.* companion (already shipped in #44): Json.parse(Http.text(h)).

The transport (runtime/native/http.ll) drives NSURLConnection through the objc runtime's C ABI on a detached pthread — same hand-written-IR, no-ObjC/no-C style as cocoa.ll — and is spliced with Foundation only when a program uses Http.* (macOS for now). The response parser (Http.parse, header lookup) is pure Ludic and portable, so the suite exercises it offline with no network. HTTP depends on the network and wall clock and is explicitly out-of-band: it must never feed the deterministic lockstep/replay simulation, like Net.* and Time.now. Also adds the \r string/char escape the protocol needs.