Files
scriptc/tests/corpus/2672-http-request-response-callback.ts
Chris Tateandmorler de0e54d776 fix: lower HTTPS request callbacks in LLVM
- Lower the HTTPS options row through the runtime ABI with callback ownership and loop liveness.
- Pin HTTP and HTTPS response callbacks with differential and tier-regression coverage.

Co-authored-by: morler <478444+morler@users.noreply.github.com>
2026-07-30 00:17:47 -05:00

34 lines
1.0 KiB
TypeScript

// The options-object response callback is part of request(), not just the
// URL-string row. Exercise both clients against a released local port: the
// callback must compile even though connection refusal keeps it from firing.
import * as net from "node:net";
import * as http from "node:http";
import * as https from "node:https";
const probe = net.createServer();
probe.listen(0, () => {
const port = probe.address().port;
probe.close(() => {
const plain = http.request(
{ hostname: "127.0.0.1", port, path: "/", method: "GET" },
() => console.log("unexpected http response"),
);
plain.on("error", () => console.log("http refused"));
plain.on("close", () => {
const secure = https.request(
{
hostname: "127.0.0.1",
port,
path: "/",
method: "GET",
rejectUnauthorized: false,
},
() => console.log("unexpected https response"),
);
secure.on("error", () => console.log("https refused"));
secure.end();
});
plain.end();
});
});