tickets
All repositories: gitoria
3.4 KB
// tls-on-plain-port.mjs — a TLS ClientHello sent to a plain hl:http1 port must be// closed at once, not held open until the client times out (routger, 2026-09-27:// Firefox's HTTPS-First tries https:// first on any non-localhost name, so the// page "loaded forever" instead of falling back to http). Drives the built// libhttp1.so through the interpreter (tls_on_plain_port.hl), then talks to it// with raw sockets — this is protocol-shape testing, below what an .hl fixture// can reach.import { spawn } from 'node:child_process';import { connect } from 'node:net';import { fileURLToPath } from 'node:url';import { dirname, resolve } from 'node:path';const HERE = dirname(fileURLToPath(import.meta.url));const ROOT = resolve(HERE, '../../..');const BIN = resolve(ROOT, 'native/zig-out/bin/hybriel');const FIXTURE = resolve(HERE, 'tls_on_plain_port.hl');const PORT = Number(process.env.HL_TEST_PORT || 14980);const sleep = (ms) => new Promise((r) => setTimeout(r, ms));let failed = false;const fail = (msg) => { console.log('FAIL ' + msg); failed = true; };const server = spawn(BIN, [FIXTURE], {env: { ...process.env, HL_TEST_PORT: String(PORT) },stdio: ['ignore', 'pipe', 'pipe'],});let log = '';server.stdout.on('data', (d) => { log += d; });server.stderr.on('data', (d) => { log += d; });let up = false;for (let i = 0; i < 80; i++) {try {const r = await fetch(`http://127.0.0.1:${PORT}/`);if (r.status === 200) { up = true; break; }} catch {}await sleep(250);}if (!up) {console.log('FAIL server did not come up\n' + log.slice(0, 4000));server.kill('SIGKILL');process.exit(1);}// A TLS 1.2-shaped ClientHello record header: content type 0x16 (handshake),// version 0x03 0x03, followed by a plausible length and a few handshake bytes.// The fix only looks at the first two bytes, but this is what a real client// sends, so the fixture proves it against a realistic prefix.const clientHello = Buffer.from([0x16, 0x03, 0x03, 0x00, 0x2f, // TLS record: handshake, TLS 1.2, length 0x2f0x01, 0x00, 0x00, 0x2b, // handshake: ClientHello, length 0x2b0x03, 0x03, // client_version 1.2...Array(32).fill(0x42), // "random"]);const closedInTime = await new Promise((resolvePromise) => {const sock = connect(PORT, '127.0.0.1');const start = Date.now();let settled = false;sock.on('connect', () => sock.write(clientHello));sock.on('close', () => {if (settled) return;settled = true;resolvePromise(Date.now() - start);});sock.on('error', () => {}); // ECONNRESET counts as closedsetTimeout(() => {if (settled) return;settled = true;sock.destroy();resolvePromise(-1); // never closed within the budget}, 1000);});if (closedInTime < 0) {fail(`TLS ClientHello prefix was NOT closed within 1000ms`);} else {console.log(`ClientHello prefix closed in ${closedInTime}ms`);}// Plain HTTP on the same port must still answer — the fix must not have// turned the port TLS-only or broken ordinary requests.try {const r = await fetch(`http://127.0.0.1:${PORT}/`);const body = await r.text();if (r.status === 200 && body === 'ok') {console.log('plain HTTP still answers: 200 ok');} else {fail(`plain HTTP answered ${r.status} ${JSON.stringify(body)}`);}} catch (e) {fail(`plain HTTP request threw: ${e}`);}server.kill('SIGTERM');await sleep(300);if (!server.killed) server.kill('SIGKILL');console.log(failed ? 'FAIL' : 'PASS');process.exit(failed ? 1 : 0);
Branches
- mainmain branch
Latest commits
- e9d5c618mission 010 (code order) 2/4: one lib/ file per topic — store.hl split into projects / tickets (+ relations) / events / tickets-helpers, util.hl shared helpers (env, storage dir, URLs, sorts, Vienna time), the function routes out of project.hl into lib/api.hl (thin; auth/filters/Accept in api-helpers.hl), invite + member-removal logic out of the faces/routes into invites.hl / tickets.hl; project.hl is the map. /login/callback gets req + the session store by reference. gate 249/0, connect 60/0, real-data reads identicalmre
- 97e269b5mission 010 (code order) 1/4: .hl files out of the root — lib/ (store, users, connections, invites, migrate, markdown, mdview, import = ticketfile, util = localtime, jsoncheck, api-helpers = api), tools/import.hl, components/styles.hl; import paths only. gate 249/0, connect 60/0, real-data reads identicalmre
- 38f9d10ftickets: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gate 249/0, connect 60/0mre
- d3db6139tickets: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gate 249/0, connect 60/0mre
- bce182e3tickets: Hybriel master 7eea0d32 (#126 memory, #48 lambda copies its argument); migrate.hl lambdas take &logmre
- 4137be0fantcolony#40: mission references point to the moved missionsmre
- 9bfba36aantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
- c7bd2645tickets: Hybriel master 73267707 (#122 fixed); compactNow workaround removed (#110 covered)mre
- 2ab91ee9tickets: gate checks rows appear once (session sync); re-vendor to ff51cf46 stopped on hybriel#122, stays 837fe120mre
- e01c2b1dtickets#24: installable app (manifest, service worker, offline list), own icon; gate waits for the hello's pongmre
- 752fbb7fdeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
- 38bdd5e4deploy.sh: never send .git or .gitignore to Byrodinmre
- f12fa1bcState of 2026-09-27, before the move to gitoriamre