diff options
Diffstat (limited to 'plumbing/transport/http')
-rw-r--r-- | plumbing/transport/http/common.go | 12 | ||||
-rw-r--r-- | plumbing/transport/http/upload_pack.go | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/plumbing/transport/http/common.go b/plumbing/transport/http/common.go index 930e8eb..04b6121 100644 --- a/plumbing/transport/http/common.go +++ b/plumbing/transport/http/common.go @@ -73,18 +73,12 @@ type AuthMethod interface { } func basicAuthFromEndpoint(ep transport.Endpoint) *BasicAuth { - info := ep.User - if info == nil { + u := ep.User() + if u == "" { return nil } - p, ok := info.Password() - if !ok { - return nil - } - - u := info.Username() - return NewBasicAuth(u, p) + return NewBasicAuth(u, ep.Password()) } // BasicAuth represent a HTTP basic auth diff --git a/plumbing/transport/http/upload_pack.go b/plumbing/transport/http/upload_pack.go index 8f73789..2d1ea45 100644 --- a/plumbing/transport/http/upload_pack.go +++ b/plumbing/transport/http/upload_pack.go @@ -150,7 +150,7 @@ func (s *upSession) doRequest(method, url string, content *bytes.Buffer) (*http. // it requires a bytes.Buffer, because we need to know the length func (s *upSession) applyHeadersToRequest(req *http.Request, content *bytes.Buffer) { req.Header.Add("User-Agent", "git/1.0") - req.Header.Add("Host", s.endpoint.Host) + req.Header.Add("Host", s.endpoint.Host()) // host:port if content == nil { req.Header.Add("Accept", "*/*") |