Skip to content

Commit

Permalink
Ignore setting PerRPCCreds as clientopts (bazelbuild#527)
Browse files Browse the repository at this point in the history
When PerRPCCreds is used, we are already setting it as part of
DialParams, so we don't have to once again include it as part of
clientopts when creating the connection.
When included again as part of clientopts, it results in gRPC adding
duplicate Authorization header to the requests.

Issue: bazelbuild/reclient#27 (thanks to
@MarshallOfSound for debugging this)

Tested: I build with this, ran a sample command and confirmed with
mitmproxy that authorization header wasn't repeated.
  • Loading branch information
gkousik authored Jan 5, 2024
1 parent 042d985 commit 6dd3970
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/pkg/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ func NewClientFromFlags(ctx context.Context, opts ...client.Opt) (*client.Client
opts = append(opts, client.RPCTimeouts(timeouts))
}
var perRPCCreds *client.PerRPCCreds
tOpts := []client.Opt{}
for _, opt := range opts {
switch opt.(type) {
case *client.PerRPCCreds:
perRPCCreds = (opt).(*(client.PerRPCCreds))
default:
tOpts = append(tOpts, opt)
}
}
opts = tOpts

dialOpts := make([]grpc.DialOption, 0)
if *KeepAliveTime > 0*time.Second {
Expand Down

0 comments on commit 6dd3970

Please sign in to comment.