~/bend-docscommunity

http.bend fails

raw source on the hub · import 0xd66ee682d4ce8c656782ca9e0e4634cb/http.bend as Http

HTTP lib over the existing TCP kit (no TLS, no DNS).

Reuses Base (String/List/U32/Nat/TCP/Socket/IO) and the two demos: - io_http_fetch's blank-line cut (window word 218762506 = "\r\n\r\n") - io_http_server's per-connection spawn + response shape.

Import as: import ../lib/http.bend as HTTP Then HTTP.read_url, HTTP.get_header, HTTP.fetch, ...

Discipline (user-land Bend has no Base carve-out): - every callee is defined ABOVE its caller; only self-recursion. - match scrutinees are params or pattern-bound vars, never computed. - helpers above drivers are leaves: they never call back down.

Security policy (fail-closed): - show_* rejects CRLF in every field (injection) with Fail 400. - read_* caps the head at 16KB; oversize is Fail 413. - ports must be 1..65535; hosts reject whitespace and controls. - https:// parses but fetch refuses with 501 (no TLS yet). - fetch reads at most 8x8192 bytes (64KB cap), then truncates. - TCP kit has no DNS: use IPs or localhost (see demos/io_http_fetch).

2 imports
import Base
import ./tcp.bend as TCP