Skip to content

Commit

Permalink
Do not overwrite valid Authorization headers just because a username …
Browse files Browse the repository at this point in the history
…is in the URL

See golang#11399
  • Loading branch information
sinbad committed Jun 25, 2015
1 parent 883bc6e commit 94e9c56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/net/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func send(req *Request, t RoundTripper) (resp *Response, err error) {
req.Header = make(Header)
}

if u := req.URL.User; u != nil {
if u := req.URL.User; u != nil && req.Header.Get("Authorization") == "" {
username := u.Username()
password, _ := u.Password()
req.Header.Set("Authorization", "Basic "+basicAuth(username, password))
Expand Down

0 comments on commit 94e9c56

Please sign in to comment.