fix(https): certless createServer() listens; _http_server.kConnectionsCheckingInterval (#4974)#4991
Merged
Merged
Conversation
…sCheckingInterval (#4974) https.createServer() with no key/cert refused to listen ("tls config unavailable") so the listen callback never fired and test-https-server-async-dispose hung. Node constructs and listens fine without TLS material — the failure is per-connection, at handshake time. - tls.rs: build_certless_server_config() — a rustls ServerConfig whose cert resolver always returns None, so the server binds/listens and each handshake aborts with a fatal alert (Node-equivalent behavior). - https_server.rs: route the no-PEM-material case to the certless config instead of tls_config: None. - Export kConnectionsCheckingInterval from the http module arm (_http_server aliases to http in cjs_wrap) as a sentinel string key; server[k] resolves through the ext-http server handle dispatch to a minimal {_destroyed} Timeout shape, tracked on HttpServer and set by all three close paths (http/https/http2).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4974.
Root cause
test-https-server-async-disposecallshttps.createServer()with no options at all — no key, no cert. Node constructs such a server andlisten()succeeds (the missing credentials only surface per-connection, as a TLS alert during the handshake). Perry storedtls_config: Noneandlisten()bailed with[node:https] tls config unavailable; refusing to listenbefore queueing the deferred'listening'emit — so the listen callback never fired and the test hung. Async-dispose was a red herring; the options were never "torn down", they were never there.The test additionally asserts
server[kConnectionsCheckingInterval]._destroyedviarequire('_http_server'), which Perry didn't export.Fix
tls.rs: newbuild_certless_server_config()— a rustlsServerConfigwith an always-Nonecert resolver. The server binds, listens, and accepts TCP; each TLS handshake aborts with a fatal alert (Node-equivalent failure mode).https_server.rs: the no-PEM-material path (has_pem_material() == false) now registers the certless config instead oftls_config: None. Supplied-but-unparseable key/cert keeps the existing refuse-to-listen behavior.kConnectionsCheckingInterval: exported from thehttpmodule arm (_http_serveraliases tohttpin cjs_wrap) as a sentinel string key, plus an api-manifest entry so the static property read isn't compile-time-lowered toundefined.server[k]resolves through the ext-http server handle dispatch to a minimal{ _destroyed }Timeout shape; the flag lives onHttpServerand is set by all three close paths (http / https / http2).perry.d.ts,reference.md) regenerated viascripts/regen_api_docs.sh.Verification
All compiled with this branch's
perry+ auto-optimized ext crates, against the Node v22 corpus tests staged with thetest-compat/node-core/shimcommon:test-https-server-async-disposemustCalls firetest-http-server-async-disposetest-http2-server-async-disposehttps.getround-trip (regression)body: ok, exit 0Behavior cross-checked against
nodev26 (certless server listens, disposes,_destroyed === true).cargo test -p perry-ext-http-server -p perry-api-manifestgreen (23 + 36),cargo fmt --checkclean, file-size gate OK.No version bump / changelog — maintainer folds metadata at merge.