fix(ext/node): use "localhost" as default tls hostname (#29231)

Fixes https://github.com/denoland/deno/issues/29229
This commit is contained in:
Divy Srivastava 2025-05-10 09:21:49 +05:30 committed by GitHub
parent 7852806c3a
commit b14e104306
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -85,7 +85,8 @@ export class TLSSocket extends net.Socket {
constructor(socket: any, opts: any = kEmptyObject) { constructor(socket: any, opts: any = kEmptyObject) {
const tlsOptions = { ...opts }; const tlsOptions = { ...opts };
const hostname = opts.servername ?? opts.host ?? socket._host; const hostname = opts.servername ?? opts.host ?? socket?._host ??
"localhost";
tlsOptions.hostname = hostname; tlsOptions.hostname = hostname;
const _cert = tlsOptions?.secureContext?.cert; const _cert = tlsOptions?.secureContext?.cert;

View file

@ -71,7 +71,6 @@ Deno.test("tls.connect makes tls connection", async () => {
await delay(200); await delay(200);
const conn = tls.connect({ const conn = tls.connect({
host: "localhost",
port, port,
secureContext: { secureContext: {
ca: rootCaCert, ca: rootCaCert,