Skip to content

Commit 6dd3970

Browse files
authored
Ignore setting PerRPCCreds as clientopts (#527)
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.
1 parent 042d985 commit 6dd3970

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

go/pkg/flags/flags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,16 @@ func NewClientFromFlags(ctx context.Context, opts ...client.Opt) (*client.Client
106106
opts = append(opts, client.RPCTimeouts(timeouts))
107107
}
108108
var perRPCCreds *client.PerRPCCreds
109+
tOpts := []client.Opt{}
109110
for _, opt := range opts {
110111
switch opt.(type) {
111112
case *client.PerRPCCreds:
112113
perRPCCreds = (opt).(*(client.PerRPCCreds))
114+
default:
115+
tOpts = append(tOpts, opt)
113116
}
114117
}
118+
opts = tOpts
115119

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

0 commit comments

Comments
 (0)