feat(core): FILIUS' web server and web browser after Java, measured against Java

The servers share ServerAnwendung's frame (server.ts); the web server serves
/webserver with virtual hosts, the browser loads a page and its images over
one connection to port 80 (web.ts); HTTP in Java's text form (http.ts).
WebRun records eleven stories on the new web-lan network, with the server's
files; webJava.test.ts plays them card by card. A program's close is a
request, as Java's schliessen. Not taken from Java: /../ serving any file of
the host; an unreadable request closing the connection without a word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 16:53:00 +00:00
co-authored by Claude Opus 5.5
parent de3a1d4dfe
commit 4cd5749350
33 changed files with 53601 additions and 216 deletions
+2 -66
View File
@@ -17,8 +17,9 @@ import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { withSnapshot, type EchoServerLogEntry, type LogLine, type NetworkRuntimeEngine, type SendFailure, type SimpleClientLogEntry } from '../src/index.js';
import { withSnapshot, type LogLine, type NetworkRuntimeEngine } from '../src/index.js';
import { expectSameCaptures, GAP_TOLERANCE_MILLISECONDS, watchedEngine, withClientPortText, type JavaFrame, type JavaTables } from './javaRun.js';
import { clientText, CONNECT_FAILURES, isPolled, POLL_MILLISECONDS, serverText } from './programLines.js';
import { snapshotOf, type Scenario } from './scenario.js';
const scenarioDirectory = join(dirname(fileURLToPath(import.meta.url)), 'scenarios');
@@ -26,7 +27,6 @@ const scenarioDirectory = join(dirname(fileURLToPath(import.meta.url)), 'scenari
const SERVER = '00000000-0000-0000-0000-000000000101';
const CLIENT = '00000000-0000-0000-0000-000000000102';
const OTHER_CLIENT = '00000000-0000-0000-0000-000000000103';
const POLL_MILLISECONDS = 100;
type Program = 'server' | 'client' | 'other';
@@ -36,70 +36,6 @@ interface JavaRun extends JavaTables {
events: [number, Program, string][];
}
/** sw_tcpsocket_msg6, msg7, msg8. */
const SEND_FAILURES: Record<SendFailure, string> = {
notConnected: 'Verbindung nicht aufgebaut!',
connectionLost: 'Verbindung wurde unterbrochen',
timedOut: 'Zeitüberschreitung während des Versands einer Nachricht',
};
/** A server's line as Java's window shows it (German message bundle). */
function serverText(entry: EchoServerLogEntry): string {
switch (entry.kind) {
case 'acceptingStarted':
return 'Annahme von Verbindungsanfragen gestartet';
case 'acceptingStopped':
return 'Annahme von Verbindungsanfragen beendet';
case 'serverSocketClosed':
return 'Server-Socket geschlossen';
case 'serverSocketFailed':
return 'Server-Socket konnte nicht geöffnet werden.';
case 'connectionAccepted':
return `Verbindung zu ${entry.address}:${entry.port} hergestellt`;
case 'received':
return `>>${entry.text}`;
case 'sent':
return `<<${entry.text}`;
case 'sendFailed':
return SEND_FAILURES[entry.failure];
case 'connectionClosed':
return `Socket zu ${entry.address}:${entry.port} geschlossen`;
}
}
const CONNECT_FAILURES = {
unresolved: 'Ziel konnte nicht bestimmt werden!',
timedOut: 'Zeitüberschreitung beim Verbindungsaufbau',
failed: 'Aktives Öffnen des Sockets fehlgeschlagen',
};
/** A client's line as Java's window shows it. */
function clientText(entry: SimpleClientLogEntry): string {
switch (entry.kind) {
case 'connected':
return 'Verbindung hergestellt';
case 'connectFailed':
return `Fehler beim Verbindungsaufbau\n${CONNECT_FAILURES[entry.failure]}`;
case 'disconnected':
return 'Verbindung getrennt';
case 'notConnected':
return 'Fehler beim Verbindungsaufbau';
case 'sent':
return `<<${entry.text}`;
case 'received':
return `>>${entry.text}`;
case 'sendFailed':
return SEND_FAILURES[entry.failure];
case 'connectionClosed':
return `Socket zu ${entry.address}:${entry.port} getrennt`;
case 'receiveFailed':
return 'Keine Verbindung hergestellt!';
}
}
/** Lines Java writes after one of its 100 ms looks. */
const POLLED = new Set(['Verbindung hergestellt', 'Server-Socket geschlossen']);
const isPolled = (text: string) => POLLED.has(text) || /^Verbindung zu .* hergestellt$/.test(text);
type Act = (engine: NetworkRuntimeEngine) => void;
const server = (engine: NetworkRuntimeEngine) => engine.echoServer(SERVER)!;