Files
bun.sh/test/js/node/tls/renegotiation-feature.js
Ciro Spaciari 14832c5547 fix(CI) update cert in harness (#22440)
### What does this PR do?
update harness.ts
### How did you verify your code works?
CI

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-05 20:42:25 -07:00

30 lines
805 B
JavaScript

const server = require("https").createServer(
{
cert: process.env.SERVER_CERT,
key: process.env.SERVER_KEY,
rejectUnauthorized: false,
hostname: "localhost",
minVersion: "TLSv1.2",
// force maxVersion to be TLSv1.2 so that renegotiation is allowed
maxVersion: "TLSv1.2",
},
(req, res) => {
const client = res.socket;
client.renegotiate({ requestCert: true, rejectUnauthorized: false }, err => {
if (err) {
res.writeHead(500, { "Content-Type": "text/plain" });
res.end("Error");
} else {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("Hello World");
}
});
},
);
server.listen(0, () => {
const { port } = server.address();
const url = `https://localhost:${port}`;
console.log(url);
});