tracker
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
- 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
- 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
- 47a3cae6STATUS: mission 053 merge commit idsmre
- dcc5eecaMerge branch 't14-search'mre
- 03edc783Merge branch 't15-tvmaze'mre
- 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
- 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
- b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
- 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
- 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre
- cbdc4ea7tracker#12: link icons TMDB/IMDb/TVDB/TVmaze; sync fills missing ids (TVmaze lookup); movies fetched via /movie/mre
- b105bcd8tracker#11: Hybriel master ff51cf46 (checks no longer vanish), mobile-first styles, carets, follow button, sign-in modal, inverted check, orange castmre
- 31b758aatracker#10: installable app (manifest, service worker, offline shell), own icon + faviconmre
- 2fa9d997tracker#9: TMDB sync (followed shows: seasons, episodes, posters), tools/sync-tmdb.hl + daily run 04:00 UTC, fake TMDB in gatemre
- 49e1f61edeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
- 54070a4etracker#8: /my/unwatched + /my/schedule (301 from old), S01E01, title (year), 1 episode, watched-set lookup (unwatched 15s -> 1s)mre
- 3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre
- 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
- 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
- a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre