tickets
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
- fd83ac1fconductor: caramboleyo is the user, not owner/creatorApollo
- 3b858c91Log backup hard-link fixmre
- 7f6b37a0deploy.sh backup: tar --hard-dereference (hard links broke mpackdb sidecars on restore)mre
- e93711d9Log E30 livemre
- 59c02e4dMerge e30: preserve edited state note labels in Markdownmre
- 30970796Log E30 deploy GOmre
- 7c8e6d83Limit edited state note fix to Markdown renderingmre
- 910536d0Log E30 reviewmre
- 36984386Preserve state transitions when their notes are editedmre
- d75cb946Log E30 startmre
- 0bf3fefaMission 030: edited state note labelmre
- 691565c6Log neutral-ticket rule checkmre
- bc3bdecerecords: day38b live, #94 purgedmre
- f6c5aa0dMerge main (records)mre
- e23d42acconnect gate: wait for hydration before clicking Disconnectmre
- a5d45d00records: D38 cause, GOmre
- 19eeb938records: D38 gates, two day38b failuresmre
- f8e42a85Re-vendor tickets to Hybriel set day38b (1e554d7)mre
- 51645016Merge purge-94 (#94, identity rule)mre
- 94d6ca2arecords: D38 startedmre