Closes the BIF half of Step 8. Native http-request primitive landed
in architecture via the fed-prims merge (the m2 plan's Blocker #2),
so the briefing-allowed-exception wrapper in lib/erlang/runtime.sx
can finally be wired.
Marshalling at the BIF boundary:
Url : Erlang binary -> SX string (byte-list -> integer->char).
Method : Erlang atom upcased ('get -> "GET") for HTTP-wire
convention, or Erlang binary passes through verbatim.
Headers : Erlang proplist -> SX dict via er-proplist-to-dict.
Body : Erlang binary -> SX string.
Result {:status :headers :body} marshalled back to Erlang
{ok, Status::integer,
Headers::proplist (binary-keyed via er-of-sx-deep),
Body::binary (char->integer over the SX string)}.
Bad arg shapes (non-binary URL or body) raise error:badarg; native
DNS / connect / bad-URL failures surface as Erlang error markers
that the caller can catch.
Test: next/tests/httpc_request.sh 10/10
- registration under httpc/request/4
- BIF marked non-pure
- wrong-arity (/1) absent from registry
- badarg on non-binary URL
- badarg on non-binary body
- live GET against `python3 -m http.server` -> Status 200
- body bytes match "hello from python\n"
- headers come back as proplist (is_list/1 = true)
- 404 path -> {ok, 404, ...} (not an error tuple)
- method passed as binary works
URLs spelled out as byte-list <<104,116,116,p,...>> binaries since
the parser truncates <<"..."> string-literal binaries (same
workaround backfill_drain.sh uses for inbox paths).
Plan: 8e ticked; Blocker #2 marked RESOLVED with the merge that
unblocked it referenced. Step 8f (live HTTP dispatch through
delivery_worker) and Step 10c (peer-actor doc fetch) are now
unblocked.
No-regression gates green: Erlang conformance 761/761,
http_multi_actor 44/44, follower_graph 18/18, follow_lifecycle 9/9,
backfill 20/20, backfill_drain 6/6, http_listen_bif 5/5.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>