feat(grpc): Add resolver wrapper to handle HTTP CONNECT proxy configuration#2679
Open
arjan-bal wants to merge 11 commits into
Open
feat(grpc): Add resolver wrapper to handle HTTP CONNECT proxy configuration#2679arjan-bal wants to merge 11 commits into
arjan-bal wants to merge 11 commits into
Conversation
Contributor
Author
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the gRPC client to support arbitrary byte-based addresses (via ByteStr) instead of requiring valid UTF-8 strings, enabling support for non-UTF-8 unix socket paths. It also introduces an HTTP CONNECT proxy resolver that intercepts DNS resolution and applies proxy configurations based on environment variables. The review feedback suggests bypassing proxy resolution entirely for non-DNS schemes (like unix or inmemory), safely handling empty NO_PROXY environment variables, and updating tests to verify that unix paths correctly bypass the proxy.
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.
This PR includes changes from grpc/grpc-rust#2677.
It implements a resolver wrapper that determines proxy routing by checking the
HTTPS_PROXYandNO_PROXYenvironment variables. By default,hyper-utilmatches cURL's behavior by falling back toALL_PROXYwhenHTTPS_PROXYis unset. However, because Go'sFromEnvironmentand gRPC C++ ignoreALL_PROXY, gRPC Rust manually configures theMatcherto bypass it, ensuring cross-language consistency.Resolution Flow
When
HttpsProxyResolver::Builderbuilds a resolver for a target URI, it useshyper_util::client::proxy::Matcherto evaluate the environment variables:HttpsProxyResolver, which uses the child DNS resolver to resolve the proxy server's hostname instead of the target.HttpsProxyResolverintercepts resolution updates from the child resolver. It attaches the necessary proxy configuration (the original target authority and basic auth credentials) as attributes to each resolved proxy address.In follow-up PRs, the subchannel will read these address attributes to wrap the channel credentials and carry out the HTTP
CONNECThandshake prior to the standard credential handshake.Internal design doc: go/grpc-rust-http-connect