Files
scriptc/tests/corpus/2690-https-server-timeout-option.ts
Chris TateandEli Sterling acf0a2b905 Support static HTTP server timeout properties (#127)
* Support static HTTP server timeout properties

- Lower typed timeout property reads and writes through both native backends.
- Store Node-compatible defaults independently on each HTTP/HTTPS server.
- Cover defaults and assignments with differential corpus tests.

Co-authored-by: Eli Sterling <240321107+eli-sterling@users.noreply.github.com>

* Support keep-alive timeout buffer property

* Fix HTTP server timeout property lowering

* fix: scope HTTP server timeout handling

* fix: preserve HTTP server timeout semantics

---------

Co-authored-by: Eli Sterling <240321107+eli-sterling@users.noreply.github.com>
2026-08-11 08:33:38 -05:00

24 lines
967 B
TypeScript

// HTTPS ServerOptions extends the HTTP option surface: literal and bound
// option records initialize keepAliveTimeoutBuffer with the same validation
// as http.createServer. No listen is needed to observe the server property.
import { readFileSync } from "node:fs";
import { createServer } from "node:https";
const cert = readFileSync("tests/fixtures/server/certs/localhost.pem");
const key = readFileSync("tests/fixtures/server/certs/localhost-key.pem");
const literal = createServer({ cert, key, keepAliveTimeoutBuffer: 4321 }, () => {});
console.log("literal", literal.keepAliveTimeoutBuffer);
const options = { cert, key, keepAliveTimeoutBuffer: 5432 };
const bound = createServer(options, () => {});
console.log("bound", bound.keepAliveTimeoutBuffer);
try {
createServer({ cert, key, keepAliveTimeoutBuffer: -1 }, () => {});
} catch (err) {
if (err instanceof Error) {
console.log(err.name, (err as NodeJS.ErrnoException).code, err.message);
}
}