Repository navigation
Conversation
This branch has not been deployed
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.
Closes #13.
What this changes
Both handlers ran as
void answerRequest(...)andvoid answerConnect(...)with nocatch, and nothing registers anunhandledRejection. So a rejection ended the process — andcli/src/daemon/egress.ts:127starts this server inside the daemon.Running the new tests against
mainshows it rather than argues it:Both are reachable by any local process: the first is a
Proxy-Authorizationcarrying%zz, the second aGET https://host/in absolute form.All five rows from the issue:
catchon each handler. A request that throws gets 400 and an ended response; a CONNECT that throws gets its socket destroyed, since nothing has been written to a tunnel yet.URL.authority.split(':')gave host[2001and portNaNfor[2001:db8::1]:443, whichnet.connectthrew on, and[::1]:443gave host[on port 0.decodeURIComponentis guarded. A mangled percent sequence is a credential this seam does not recognise, not a reason to stop.httpRequestthrows on it. https travels by CONNECT.headersSent, because a partial answer may already be on the wire and writing the head twice throws.An IPv6 hostname also has its brackets taken off before forwarding —
target.hostnamekeeps them, so the lookup failed.How it was verified
Five tests in
packages/interceptors/test/egress-server.test.ts, each against a real local server. Four fail onmain:CONNECT [::1]:<port>tunnels and the body comes backProxy-Authorizationis answered, and the proxy serves the next request normally — which is the half that proves the process is still alivehttps://absolute-form request is refused with403and a reason, and the next request still workshttp://[::1]:<port>/forwards rather than failing to resolveThe fifth pins that a CONNECT authority too broken to read still destroys its socket and leaves the server serving, which was already true and must stay.
prettier,tsc,vitestandknipall clean, on Node 24.Checklist
pnpm format && pnpm typecheck && pnpm test && pnpm deadcodeall passany, no magic values, noconsole.*outsidecli-output.ts