tracker
All repositories: gitoria
3.2 KB
\* hl:http1 — module exports beside the class surface (NativeHttpServer,NativeWebSocketServer, Response, WsClient in their own files). *\\* Bind a plain HTTP/1.1 listener; answers the request event source. *\listen(Number port \\ the port to bind) {return __native("http1.listen", port)}\* The full-featured constructor: interface, TLS pair, worker count. *\create_server(Number port \\ the port to bindString host = '0.0.0.0' \\ the interfaceString cert = null \\ PEM certificate path — with key, serve httpsString key = null \\ PEM key pathNumber threads = 4 \\ I/O worker threadsNumber maxBody = 20971520 \\ largest request body read, bytes; over it: 413Boolean wsCheckOrigin = false \\ 403 a WebSocket upgrade with a foreign OriginString wsOrigins = "" \\ extra allowed origins, comma-separated) {return __native("http1.create_server", port, host, cert, key, threads, maxBody, wsCheckOrigin, wsOrigins)}\* A cookie-grade random token: n lowercase hex characters read from theKERNEL's CSPRNG, never a seeded PRNG — a session id is the only thingbetween a stranger and someone else's session (hl:math's random() is aclock-seeded xoshiro whose state a handful of outputs reveal). Lives herebecause the session cookie is an HTTP artifact. *\randomToken(Number n \\ how many hex characters) {return __native("http1.random_token", n)}\* SERVER-SENT EVENTS (ticket #144) — the push channel, imported by name like anyother export: import { sseStart, sseSend } from 'hl:http1'. A static or a methodcalls them; the browser build of a file that imports them binds each to a refusalthat throws only if the browser CALLS it (hl:http1 ships no browser half).let conn = sseStart(req.respond) \\ the GET is now a text/event-streamsseSend(conn, JSON.stringify(row)) \\ one `data:` frame to that clientA stream lives until its client goes: hl:http1 reaps a closed one at once (FIN) orat the next ":" heartbeat (every 5 s), and a push to it answers false. Plain HTTPonly — on hl:http1's own TLS, sseStart answers null (end TLS in a proxy). *\\* Turn this request into a Server-Sent Events stream: writes the 200text/event-stream head and keeps the socket open. Answers the CONNECTION ID theother sse calls address, or null when the request was already answered (or is TLS). *\sseStart(Hybrid respond \\ the request's respond handle: req.respond) {return respond.call("sse_start")}\* One frame to one stream: `data: <text>` and the blank line. A text withnewlines continues the frame (a line after the first is its own field, e.g.'id: 42'). Answers true when it was written, false when that stream is gone. *\sseSend(Number conn \\ the id sseStart answeredString text \\ the frame's data, usually JSON.stringify(...)) {return __native("http1.sse_send", conn, text) == 1}\* The same frame to every open stream; answers how many got it. *\sseBroadcast(String text \\ the frame's data) {return __native("http1.sse_broadcast", text)}\* Is the stream still open? Asks the registry, pushes nothing. *\sseAlive(Number conn \\ the id sseStart answered) {return __native("http1.sse_alive", conn) == 1}\* How many streams are open now. *\sseCount() {return __native("http1.sse_count")}
Branches
Latest commits
- 10ed9581compose: HL_GC_STATS=1mre
- 955da19bRV39: re-vendor Hybriel set day39 (source 51e921d7, bin 6b481aa7)mre
- 64b8d1dclog: RV39 startedmre
- 1f2df72amission RV39mre
- 6c1936f9log+status: GC planmre
- 2846a840log: m569 result, GC hypothesismre
- b24cd2d5log: Anton on hl:fetch, mission 569mre
- 7d42cac1log+status: SL1 measured, fetch stalls remainmre
- 8e5f2ceflog: SL1 deployedmre
- 29f34212log: SL1 deploy startedmre
- 529dd741Merge sl1-slices: slice details repair and person fill (SL1)mre
- 8a83316blog: SL1 result, session drain slowermre
- 35e93e8dSL1: slice the details repair and person fill: catalog lists changed in place, 40 ms fill steps, people created in steps, writes one table per tickmre
- 72c9119flog+status: SL1 startedmre
- d74620fcmission SL1: slice repair and person fillmre
- 5d542d73log+status: ST1 resultmre
- 3945eb81ST1: stall diagnosis reportmre
- 404733aclog: ST1 startedmre
- 3e3d5a55mission ST1: stall diagnosismre
- 9c3180eblog+status: RV28d measured after deploymre