src/net/http/client.go | 3 ++- src/net/http/client_test.go | 3 +++ diff --git a/src/net/http/client.go b/src/net/http/client.go index f8892c2bc2ea1a14c65f3a9c1e34f21072d08a9a..2fe49cb93dd60c80d487218b3df3e76d6052eb5b 100644 --- a/src/net/http/client.go +++ b/src/net/http/client.go @@ -803,7 +803,8 @@ // (at least the safe ones). for k, vv := range ireqhdr { sensitive := false switch CanonicalHeaderKey(k) { - case "Authorization", "Www-Authenticate", "Cookie", "Cookie2": + case "Authorization", "Www-Authenticate", "Cookie", "Cookie2", + "Proxy-Authorization", "Proxy-Authenticate": sensitive = true } if !(sensitive && stripSensitiveHeaders) { diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go index d57096fc2245c10feb1928cbf04d16df99b719b8..1f9eebea57dc87330c58fd66cc307f6ea48f3170 100644 --- a/src/net/http/client_test.go +++ b/src/net/http/client_test.go @@ -1547,6 +1547,8 @@ ts := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) { if r.Host+r.URL.Path != "a.example.com/" { if h := r.Header.Get("Authorization"); h != "" { t.Errorf("on request to %v%v, Authorization=%q, want no header", r.Host, r.URL.Path, h) + } else if h := r.Header.Get("Proxy-Authorization"); h != "" { + t.Errorf("on request to %v%v, Proxy-Authorization=%q, want no header", r.Host, r.URL.Path, h) } } // Follow a chain of redirects from a to b and back to a. @@ -1575,6 +1577,7 @@ req, _ := NewRequest("GET", proto+"://a.example.com/", nil) req.Header.Add("Cookie", "foo=bar") req.Header.Add("Authorization", "secretpassword") + req.Header.Add("Proxy-Authorization", "secretpassword") res, err := c.Do(req) if err != nil { t.Fatal(err)