diff options
Diffstat (limited to 'plumbing/transport/http/upload_pack.go')
-rw-r--r-- | plumbing/transport/http/upload_pack.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plumbing/transport/http/upload_pack.go b/plumbing/transport/http/upload_pack.go index 26257f5..e828857 100644 --- a/plumbing/transport/http/upload_pack.go +++ b/plumbing/transport/http/upload_pack.go @@ -19,16 +19,22 @@ type upSession struct { *session } -func newUploadPackSession(c *http.Client, - ep transport.Endpoint) transport.UploadPackSession { +func newUploadPackSession(c *http.Client, ep transport.Endpoint, auth transport.AuthMethod) (transport.UploadPackSession, error) { + s := &session{ + auth: basicAuthFromEndpoint(ep), + client: c, + endpoint: ep, + } + if auth != nil { + a, ok := auth.(AuthMethod) + if !ok { + return nil, transport.ErrInvalidAuthMethod + } - return &upSession{ - session: &session{ - auth: basicAuthFromEndpoint(ep), - client: c, - endpoint: ep, - }, + s.auth = a } + + return &upSession{session: s}, nil } func (s *upSession) AdvertisedReferences() (*packp.AdvRefs, error) { |