fix(ext/node): support TLS for unix sockets (#30169)

This commit adds initial support for connecting Unix socket over
TLS in `node:tls.connect()` API

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
This commit is contained in:
Bartek Iwańczuk 2025-08-01 12:00:14 +02:00 committed by GitHub
parent 56f2055c3f
commit b05e8b20ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 412 additions and 70 deletions

View file

@ -41,6 +41,7 @@ import {
newAsyncId,
ownerSymbol,
} from "ext:deno_node/internal/async_hooks.ts";
import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts";
import {
ERR_INVALID_ADDRESS_FAMILY,
ERR_INVALID_ARG_TYPE,
@ -380,7 +381,9 @@ function _afterConnect(
// Deno specific: run tls handshake if it's from a tls socket
// This swaps the handle[kStreamBaseField] from TcpConn to TlsConn
if (typeof handle.afterConnectTls === "function") {
if (
typeof handle.afterConnectTls === "function" && handle[kStreamBaseField]
) {
handle.afterConnectTls();
}
@ -1287,7 +1290,6 @@ export class Socket extends Duplex {
}
this.on("end", _onReadableStreamEnd);
_initSocketHandle(this);
// If we have a handle, then start the flow of data into the