Commit 3ec37cc
refactor(ext/node): wire up native TLSWrap from JS (#33184)
Replace the `kStreamBaseField`-based TLS implementation with a native
`TLSWrap` cppgc object backed by rustls. This eliminates the async
stream-swap pattern where TLS upgrades worked by swapping
`handle[kStreamBaseField]` from a `TcpConn` to a `TlsConn`.
Key changes:
- Rewrite `_tls_wrap.js`: `TLSSocket` uses `tls_wrap.wrap()` to create
a Rust-backed TLS interceptor between JS and the underlying TCP stream
- TLS server rewritten to use `net.Server` (matching Node.js) instead of
`Deno.listenTls()` directly
- Add `JSStreamSocket` for TLS over arbitrary Duplex streams
- Certificate errors now use Node-style codes
(`UNABLE_TO_VERIFY_LEAF_SIGNATURE`) instead of Deno-style
(`InvalidData: invalid peer certificate: UnknownIssuer`)
- Explicit `ca` in SecureContext takes precedence over global
`setDefaultCACertificates()`, matching Node.js behavior
- Strip trailing dot from servername before passing to rustls
- Remove all `Deno.*` API usage from `_tls_wrap.js`
Based on #32819 by @nathanwhit, adapted for incremental landing.
---------
Co-authored-by: Nathan Whitaker <user@example.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b8ec861 commit 3ec37cc
12 files changed
Lines changed: 1516 additions & 643 deletions
File tree
- ext/node
- ops
- polyfills
- internal_binding
- internal
- tests
- specs/npm/ws_compat
- unit_node
- tools/lint_plugins
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
447 | 448 | | |
448 | 449 | | |
449 | 450 | | |
| |||
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
| 501 | + | |
500 | 502 | | |
501 | 503 | | |
502 | 504 | | |
| |||
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
| 532 | + | |
530 | 533 | | |
531 | 534 | | |
532 | 535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
301 | 300 | | |
302 | 301 | | |
303 | 302 | | |
| |||
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
| |||
343 | 346 | | |
344 | 347 | | |
345 | 348 | | |
346 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
| |||
0 commit comments