Repository navigation
fix: tunnel HTTP/2 Run sessions through HTTPS_PROXY CONNECT - #27
Merged
Merged
Conversation
Unary fetch already honored proxy env; node:http2 did not. Open a CONNECT tunnel on a native socket, then TLS+ALPN h2, so Runs work behind HTTP proxies without the Bun Duplex segfault path.
Build proxy auth before dialing and keep undecodable userinfo verbatim, close the tunnel when TLS setup throws, ignore non-http proxy URLs and HTTP_PROXY for HTTPS, match port-qualified NO_PROXY against the dialed port, accept any 2xx CONNECT reply, stop retrying 403/407, and dial IPv6 proxy literals without brackets.
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.
Summary
HTTPS_PROXY/https_proxyapplies.net.connect→CONNECT→tls.connecton the native socket, ALPNh2) withNO_PROXYmatching and Basic auth support.Test plan
bun test test/https-proxy.test.ts test/connect-origin.test.tsbun run typecheckHTTPS_PROXY=http://…, direct 443 blocked): confirmGetServerConfig/ models still work and a realcursor/*Run completes instead of the 15shttp2.connecttimeout. A note with OpenCode/provider versions and whether auth/NO_PROXYbehave as expected would help a lot — thanks again for the clear repro and Bun-safe CONNECT recipe.