mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-12 04:19:53 +08:00
* 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>
24 lines
967 B
TypeScript
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);
|
|
}
|
|
}
|