diff options
author | Santiago M. Mola <santi@mola.io> | 2017-04-26 17:04:59 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-04-27 14:09:41 +0200 |
commit | 45bdbcbe6fdab5a8a4ed4f1b16c191f400a0f6b6 (patch) | |
tree | 5cd0364d068255d361a657963080a78c7ab735d9 /plumbing/transport/http | |
parent | 64cd72debb2a94a49de5ffd3c3a6bfd626df7340 (diff) | |
download | go-git-45bdbcbe6fdab5a8a4ed4f1b16c191f400a0f6b6.tar.gz |
transport: make Endpoint an interface, fixes #362
* add internal *url.URL implementation for regular URLs.
* add internal implementation for SCP-like URLs.
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", "*/*") |