tls: initialize session and SNI before connecting - #65624
Open
styfle wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
styfle
force-pushed
the
styfle/tls-sync-lookup
branch
from
August 28, 2026 17:30
5f0fe2b to
737a73d
Compare
A synchronous custom lookup can abort the socket before tls.connect() applies the session and SNI, leaving the TLS handle unavailable. Initialize both before starting the connection so the original socket error is emitted normally. Assisted-by: Codex Signed-off-by: Steven <steven@ceriously.com>
styfle
force-pushed
the
styfle/tls-sync-lookup
branch
from
August 28, 2026 17:31
737a73d to
24774cc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65624 +/- ##
==========================================
- Coverage 90.07% 90.04% -0.04%
==========================================
Files 751 751
Lines 254921 254920 -1
Branches 48129 48124 -5
==========================================
- Hits 229627 229545 -82
- Misses 16479 16544 +65
- Partials 8815 8831 +16
🚀 New features to boost your workflow:
|
Collaborator
aduh95
approved these changes
Aug 28, 2026
pimterry
approved these changes
Aug 28, 2026
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.
A synchronous custom lookup callback can cause the connection to fail or abort before
tls.connect()applies the TLS session and SNI. The failure clears the TLS handle, causingsetServername()to throw a synchronousTypeError.The original failure surfaced through an HTTP client as:
Initialize the session and SNI before starting the underlying TCP connection so the original connection error is emitted normally.