an http request handler in thirty-two lines
summary: composing a socket, a parser, and a reaction across subsystem lines, with no boundary to pay for.
Core idea: ThePlatform's technical advantage was not a short HTTP handler; it was that parsing, sockets, error handling, and query reactions shared one runtime boundary.
An HTTP-over-anything query handler in O is thirty-two lines because the parser, the socket, and the response builder all live under the same dispatch and there is no boundary between them.
.http.default.handle: {[sock;headers]
url: "\\?" vs urllib.decode headers[`Url];
.[.ht.proc;(sock;url[0];url[1]);{.ht.catch[sock;url[1];x`message]}];
};
That is the entry point from std/htreq.o. urllib.decode is from a PEG grammar in std/urllib.o. .http.resp.ok lives in std/http.o. The error path uses O's .[fn;args;catch] apply form. None of these pieces are imported across a foreign-function boundary; they are all just O lambdas calling other O lambdas.
The full stack underneath - std/http.o is two hundred lines, std/urllib.o is a hundred and forty - sits in the same runtime as this handler and uses the same primitives. That is the demo I should have written four years ago. It would have saved a lot of explaining.