gitoria
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
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
Latest commits
- 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
- 16a3530fMerge branch 'heap-revert' into mainGitoria
- 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
- 13f0c342Merge branch 'hl25-records' into mainGitoria
- a002ecb7|||PR records: HL25 report, heap helper, logmre
- 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
- fefaedd2log: tracker PR-only, HL25 startedmre
- 21aa57calog: parkmre
- e9f950a8reports: G25c soakmre
- a7783686log: deploy 9f41ffcmre
- 9f41ffc1log: W30b mergedmre
- bef635c1Merge branch 'w30b'mre
- 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
- c4f6d9e3reports: G25c growth huntmre
- b88e39f1log: privacy cleanup donemre
- bfd7826ddocs: neutral example organisation namemre
- 01b71c2edocs: neutral wording in missions, reports and logmre
- 3eeea733log: 2026-11-09 PR flow plan and membersmre
- e7c2ff1fdocs: neutral name for the apps-api reviewmre
- 120b7abdlog: step 3 queuedmre