Skip to content

fix(ext/node): preserve raw socket connect when wrapping TLS#34093

Open
bartlomieju wants to merge 2 commits into
denoland:mainfrom
bartlomieju:fix-node-tls-connect-given-socket
Open

fix(ext/node): preserve raw socket connect when wrapping TLS#34093
bartlomieju wants to merge 2 commits into
denoland:mainfrom
bartlomieju:fix-node-tls-connect-given-socket

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Fixes wrapping a still-connecting net.Socket with tls.connect({ socket }).

The TLS wrapper now leaves the raw socket as the TCP handle owner until its pending connect event has fired, then transfers ownership to the TLS socket if it was not destroyed by user code. This lets raw net.connect(..., cb) callbacks run before TLS takes over, matching Node behavior.

Also aligns custom DNS lookup options with Node by not passing port, and ignores test-tls-connect-keepalive-nodelay.js because it requires Node's unimplemented internal/net module.

Tests run before final rebase:

  • ./x build
  • ./x test-compat test-tls-connect-given-socket.js
  • ./x test-compat test-tls-connect-hints-option.js
  • ./x test-compat test-tls-connect-keepalive-nodelay.js

@bartlomieju bartlomieju changed the title fix(node): preserve raw socket connect when wrapping TLS fix(ext/node): preserve raw socket connect when wrapping TLS May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant