Skip to content

Commit 313287e

Browse files
committed
did not work, fixed
1 parent 8ddae58 commit 313287e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: proxy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri
9191
if t := proxyURL.User; t != nil {
9292
u := t.Username()
9393
p, _ := t.Password()
94-
req.Header.Add(proxyAuthHeaderKey, basicAuth(u, p))
94+
req.Header.Add(proxyAuthHeaderKey, "Basic "+basicAuth(u, p))
9595
}
9696

9797
if err := sendHTTPRequest(ctx, req, conn); err != nil {

Diff for: proxy_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func TestHTTPConnectBasicAuth(t *testing.T) {
199199
if req.UserAgent() != grpcUA {
200200
return fmt.Errorf("unexpect user agent %q, want %q", req.UserAgent(), grpcUA)
201201
}
202-
wantProxyAuthStr := base64.StdEncoding.EncodeToString([]byte(user + ":" + password))
202+
wantProxyAuthStr := "Basic " + base64.StdEncoding.EncodeToString([]byte(user+":"+password))
203203
if got := req.Header.Get(proxyAuthHeaderKey); got != wantProxyAuthStr {
204204
gotDecoded, _ := base64.StdEncoding.DecodeString(got)
205205
wantDecoded, _ := base64.StdEncoding.DecodeString(wantProxyAuthStr)

0 commit comments

Comments
 (0)