Repository navigation
cli 0.8.1: fall back across addresses until TLS completes - #33
Merged
Merged
Conversation
…cks TLS per address An address that accepts TCP but never completes TLS made every request wait for UND_ERR_CONNECT_TIMEOUT: Node's fetch keeps the first address that connects, so IPv4/IPv6 fallback does not help. Requests now use an address only once its TLS handshake has completed (certificate and host name verified), start the next address after a second, alternating families, and remember the family that worked per host. NODE_USE_ENV_PROXY keeps Node's fetch so the proxy is used. doctor also completes a TLS handshake with each address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Background
On some networks a site's address accepts the TCP connection but never completes the TLS handshake, while the site's addresses of the other family work. Node's fetch keeps the first address that connects and waits for TLS until
UND_ERR_CONNECT_TIMEOUT. IPv4/IPv6 fallback (autoSelectFamily, added in 0.8.0) only covers TCP failures, so the only workaround was--dns-result-order=ipv6first.doctorchecked TCP only, so it reported such addresses as reachable.Changes
cli/src/transport.ts: HTTPS requests use an address only after its TLS handshake has completed. Certificate and host name are verified as usual.TLS_HANDSHAKE_TIMEOUT, and the request counts as unsent.NODE_USE_ENV_PROXY=1or--use-env-proxy), requests keep going through fetch.doctornow completes a TLS handshake with each address. When one family connects without TLS, it advises--dns-result-order=ipv6first(oripv4first) for MCP clients.Risks
node:https. Redirects are still not followed, matching the previousredirect: manual. Certificate checks are unchanged.routesfield; older CLIs ignore it.Backward compatibility
gh release create v0.8.1.Testing
bun test: 22 pass. Newsrc/transport.test.tsruns the bundled client under real Node, with 127.0.0.1 accepting TCP but never speaking TLS and::1serving HTTPS. It covers:doctoron https://context4ai.org/sourcegraph shows TCP and TLS per address.tsc: no new errors;sync-deployment --checkpasses.🤖 Generated with Claude Code