Debian Codegraph @

plumbing/transport/http/handshake.go

raw symbols SCIP
1 package httpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/
2
3 import (
4 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
5 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
6 "contextscip-go gomod github.com/golang/go/src go1.25.0 context/"
7 "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
8 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
9 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
10 "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/"
11 "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/"
12
13 "github.com/go-git/go-git/v6/plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/"
14 "github.com/go-git/go-git/v6/plumbing/format/pktlinescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/pktline`/"
15 "github.com/go-git/go-git/v6/plumbing/protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/"
16 "github.com/go-git/go-git/v6/plumbing/protocol/capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/"
17 "github.com/go-git/go-git/v6/plumbing/protocol/packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/"
18 transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ "github.com/go-git/go-git/v6/plumbing/transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/"
19 "github.com/go-git/go-git/v6/storagescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/"
20 )
21
22 // Handshake implements transport.Transport. GETs /info/refs to discover
23 // refs and detects smart vs dumb HTTP.
24 func (t *Transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#) Handshakescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#Handshake().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Requestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#) (transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session#, error) {
25 service := req.Commandscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#Command.
26 baseURL := req.URLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#URL.
27 forceDumb := t.optsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#opts..ForceDumbscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Options#ForceDumb.
28
29 infoURL, err := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.JoinPathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/JoinPath().(baseURL.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "info/refs")
30 if err != nil {
31 return nil, err
32 }
33 if !forceDumb {
34 infoURL += "?service=" + service
35 }
36
37 // Mark this as the initial request so checkRedirect allows
38 // the HTTP client to follow redirects for this discovery request.
39 // Subsequent requests (pack POSTs, object GETs) use a plain
40 // context and will not follow redirects.
41 httpReq, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestWithContextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequestWithContext().(withInitialRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/withInitialRequest().(ctx), httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/MethodGet., infoURL, nil)
42 if err != nil {
43 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("http transport: %w", err)
44 }
45
46 httpReq.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("User-Agent", capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.DefaultAgentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/DefaultAgent().())
47 if !forceDumb {
48 if gp := transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.GitProtocolEnvscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/GitProtocolEnv().(req.Protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#Protocol.); gp != "" {
49 httpReq.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Git-Protocol", gp)
50 }
51 }
52 if baseURL.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. != nil {
53 password, _ := baseURL.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Passwordscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Password().()
54 httpReq.SetBasicAuthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#SetBasicAuth().(baseURL.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Usernamescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Username().(), password)
55 }
56 if t.optsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#opts..Authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Options#Authorizer. != nil {
57 if err := t.optsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#opts..Authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Options#Authorizer.(httpReq); err != nil {
58 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("http transport: authorize: %w", err)
59 }
60 }
61
62 client := t.resolveClientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#resolveClient().()
63 resp, err := doRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/doRequest().(client, httpReq)
64 if err != nil {
65 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("http transport: %w", err)
66 }
67
68 if err := checkErrorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/checkError().(resp); err != nil {
69 _ = resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
70 return nil, err
71 }
72
73 // Update base URL from the final redirect target.
74 redirectedURL, err := applyRedirectscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/applyRedirect().(resp, baseURL)
75 if err != nil {
76 _ = resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
77 return nil, err
78 }
79 sessReq := *req
80 sessReq.URLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#URL. = redirectedURL
81 authorizer := t.optsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#opts..Authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Options#Authorizer.
82
83 // Clear credentials when the redirect landed on a different host.
84 // The session stores baseURL and re-applies its User field and the
85 // Authorizer callback on every subsequent POST — without this, the
86 // original host's credentials would be sent to the new host.
87 // Go's http.Client already strips the Authorization header on
88 // cross-host redirects during the initial GET, but User and
89 // Authorizer are carried in the session and applied explicitly by
90 // doPost/applyAuth. In canonical git, credential_from_url()
91 // re-derives credentials from the new URL, effectively wiping the
92 // old ones.
93 if redirectedURL.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host. != baseURL.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host. {
94 sessReq.URLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#URL..Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. = nil
95 authorizer = nil
96 }
97
98 if forceDumb {
99 return handshakeDumbscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/handshakeDumb().(resp, &sessReq, client, authorizer)
100 }
101
102 expected := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("application/x-%s-advertisement", service)
103 isSmart := resp.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Type") == expected
104
105 if isSmart {
106 return handshakeSmartscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/handshakeSmart().(resp, &sessReq, client, authorizer)
107 }
108 return handshakeDumbscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/handshakeDumb().(resp, &sessReq, client, authorizer)
109 }
110
111 func handshakeSmartscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/handshakeSmart().(resp *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Requestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#, client *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#, authorizer func(*httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) error) (transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session#, error) {
112 defer resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().() //nolint:errcheck
113 rd := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewReader().(resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body.)
114
115 _, prefix, err := pktlinescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/pktline`/.PeekLinescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/format/pktline`/PeekLine().(rd)
116 if err != nil {
117 return nil, err
118 }
119 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 bytes/HasPrefix().(prefix, []byte("# service=")) {
120 var reply packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.SmartReplyscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/SmartReply#
121 if err := reply.Decodescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/SmartReply#Decode().(rd); err != nil {
122 return nil, err
123 }
124 if reply.Servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/SmartReply#Service. != req.Commandscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#Command. {
125 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("unexpected service name: %w", transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ErrInvalidResponsescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ErrInvalidResponse.)
126 }
127 }
128
129 ver, err := transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.DiscoverVersionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/DiscoverVersion().(rd)
130 if err != nil {
131 return nil, err
132 }
133 switch ver {
134 case protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/.V2scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/V2.:
135 return nil, transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ErrUnsupportedVersionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ErrUnsupportedVersion.
136 case protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/.V1scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/V1., protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/.V0scip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/V0.:
137 }
138
139 ar := &packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.AdvRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#{}
140 if err := ar.Decodescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#Decode().(rd); err != nil && !errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Isscip-go gomod github.com/golang/go/src go1.25.0 errors/Is().(err, packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.ErrEmptyAdvRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/ErrEmptyAdvRefs.) {
141 return nil, err
142 }
143
144 // Validate capabilities before returning the session.
145 if err := capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.Validatescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/Validate().(&ar.Capabilitiesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#Capabilities.); err != nil {
146 return nil, err
147 }
148
149 return &smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#{
150 clientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#client.: client,
151 baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL.: req.URLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#URL.,
152 servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service.: req.Commandscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#Command.,
153 authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#authorizer.: authorizer,
154 versionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#version.: ver,
155 capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps.: ar.Capabilitiesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#Capabilities.,
156 refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#refs.: ar,
157 }, nil
158 }
159
160 func handshakeDumbscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/handshakeDumb().(resp *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Requestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#, client *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#, authorizer func(*httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) error) (transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session#, error) {
161 defer resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().() //nolint:errcheck
162 rd := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewReader().(resp.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body.)
163
164 var infoRefs packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.InfoRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/InfoRefs#
165 if err := infoRefs.Decodescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/InfoRefs#Decode().(rd); err != nil {
166 return nil, err
167 }
168
169 ar := &packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.AdvRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#{}
170 ar.Referencesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#References. = infoRefs.Referencesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/InfoRefs#References.
171
172 return &dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#{
173 clientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#client.: client,
174 baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#baseURL.: req.URLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#URL.,
175 servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#service.: req.Commandscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Request#Command.,
176 authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#authorizer.: authorizer,
177 refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#refs.: ar,
178 }, nil
179 }
180
181 // --- smart HTTP pack session ---
182
183 var _ transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session# = (*smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#)(nil)
184
185 type smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession# struct {
186 clientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#client. *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#
187 baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL. *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#
188 servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service. string
189 authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#authorizer. func(*httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) error
190 versionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#version. protocolscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/.Versionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol`/Version#
191 capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps. capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.Listscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/List#
192 refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#refs. *packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.AdvRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#
193 }
194
195 func (s *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#) Capabilitiesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#Capabilities().() *capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.Listscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/List# { return &s.capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps. }
196
197 func (s *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#) GetRemoteRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#GetRemoteRefs().(_ contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#) ([]*plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Referencescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Reference#, error) {
198 if s.refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#refs. == nil {
199 return nil, transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ErrEmptyRemoteRepositoryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ErrEmptyRemoteRepository.
200 }
201 forPush := s.servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service. == transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ReceivePackServicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ReceivePackService.
202 if !forPush && s.refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#refs..IsEmptyscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#IsEmpty().() {
203 return nil, transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ErrEmptyRemoteRepositoryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ErrEmptyRemoteRepository.
204 }
205 refs, err := s.refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#refs..ResolvedReferencesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#ResolvedReferences().()
206 if err != nil {
207 return nil, err
208 }
209 return refs, nil
210 }
211
212 func (s *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#) Fetchscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#Fetch().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, st storagescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/.Storerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/Storer#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.FetchRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/FetchRequest#) error {
213 neg := &httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#{sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#session.: s, ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#ctx.: ctx}
214
215 shallows, err := transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.NegotiatePackscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/NegotiatePack().(ctx, st, s.capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps., true, neg, neg, req)
216 if err != nil {
217 // Don't close the response body here — context-wrapper goroutines
218 // inside NegotiatePack may still be reading from it.
219 return err
220 }
221 if neg.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. == nil || neg.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. == nil {
222 neg.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. = &httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#{sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session.: s, ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#ctx.: ctx}
223 if err := neg.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..doPostscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#doPost().(); err != nil {
224 return err
225 }
226 }
227 err = transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.FetchPackscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/FetchPack().(ctx, st, s.capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps., ioscip-go gomod github.com/golang/go/src go1.25.0 io/.NopCloserscip-go gomod github.com/golang/go/src go1.25.0 io/NopCloser().(neg), shallows, req)
228 neg.closeResponsescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#closeResponse().()
229 return err
230 }
231
232 func (s *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#) Pushscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#Push().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, st storagescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/.Storerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/Storer#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.PushRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/PushRequest#) error {
233 rwc := &httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#{sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session.: s, ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#ctx.: ctx}
234 err := transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.SendPackscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/SendPack().(ctx, st, s.capsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#caps., rwc, ioscip-go gomod github.com/golang/go/src go1.25.0 io/.NopCloserscip-go gomod github.com/golang/go/src go1.25.0 io/NopCloser().(rwc), req)
235 // Only close the response body on success. On error (especially context
236 // cancellation), context-wrapper goroutines inside SendPack may still
237 // be reading from it.
238 if err == nil && rwc.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. != nil {
239 _ = rwc.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
240 }
241 return err
242 }
243
244 func (s *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#Close().() error { return nil }
245
246 // httpRequester buffers writes and fires a POST on first Read or Close.
247 type httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester# struct {
248 sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session. *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#
249 ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#ctx. contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#
250 bufscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#buf. bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#
251 respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#
252 }
253
254 func (r *httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#) Writescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Write().(p []byte) (int, error) { return r.bufscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#buf..Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().(p) }
255
256 func (r *httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#) Readscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Read().(p []byte) (int, error) {
257 if r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. == nil {
258 if err := r.doPostscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#doPost().(); err != nil {
259 return 0, err
260 }
261 }
262 return r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Readscip-go gomod github.com/golang/go/src go1.25.0 io/Reader#Read().(p)
263 }
264
265 func (r *httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Close().() error {
266 if r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. == nil {
267 return r.doPostscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#doPost().()
268 }
269 return nil
270 }
271
272 func (r *httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#) doPostscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#doPost().() error {
273 serviceURL, err := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.JoinPathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/JoinPath().(r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL..Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service.)
274 if err != nil {
275 return err
276 }
277 httpReq, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestWithContextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequestWithContext().(r.ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#ctx., httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/MethodPost., serviceURL, &r.bufscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#buf.)
278 if err != nil {
279 return err
280 }
281 httpReq.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Content-Type", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("application/x-%s-request", r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service.))
282 httpReq.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Accept", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("application/x-%s-result", r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#service.))
283 httpReq.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("User-Agent", capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.DefaultAgentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/DefaultAgent().())
284 if r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL..Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. != nil {
285 password, _ := r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL..Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Passwordscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Password().()
286 httpReq.SetBasicAuthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#SetBasicAuth().(r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#baseURL..Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Usernamescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Username().(), password)
287 }
288 if r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#authorizer. != nil {
289 if err := r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#authorizer.(httpReq); err != nil {
290 return err
291 }
292 }
293 r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp., err = doRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/doRequest().(r.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session..clientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#client., httpReq)
294 if err != nil {
295 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("http transport: %w", err)
296 }
297 if r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/StatusOK. {
298 _ = r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
299 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("http transport: POST %s unexpected status %d", serviceURL, r.respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
300 }
301 return nil
302 }
303
304 // httpNegotiator supports multi-round stateless RPC negotiation by
305 // creating a fresh httpRequester for each round. A new round begins
306 // when Write is called after the previous round's response has arrived.
307 type httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator# struct {
308 sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#session. *smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#
309 ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#ctx. contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#
310 currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. *httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#
311 }
312
313 func (n *httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#) Writescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#Write().(p []byte) (int, error) {
314 if n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. != nil && n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. != nil {
315 // Previous round is complete — close its response, start fresh.
316 _, _ = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Copyscip-go gomod github.com/golang/go/src go1.25.0 io/Copy().(ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Discardscip-go gomod github.com/golang/go/src go1.25.0 io/Discard., n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body.)
317 _ = n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
318 n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. = nil
319 }
320 if n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. == nil {
321 n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. = &httpRequesterscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#{sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#session.: n.sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#session., ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#ctx.: n.ctxscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#ctx.}
322 }
323 return n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..Writescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Write().(p)
324 }
325
326 func (n *httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#) Readscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#Read().(p []byte) (int, error) {
327 if n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. == nil {
328 return 0, ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ErrClosedPipescip-go gomod github.com/golang/go/src go1.25.0 io/ErrClosedPipe.
329 }
330 return n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..Readscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Read().(p)
331 }
332
333 func (n *httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#Close().() error {
334 if n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. == nil {
335 return nil
336 }
337 return n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#Close().()
338 }
339
340 // closeResponse closes the current HTTP response body.
341 // The caller (FetchPack) is expected to have already drained the body.
342 func (n *httpNegotiatorscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#) closeResponsescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#closeResponse().() {
343 if n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current. != nil && n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. != nil {
344 _ = n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp..Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().()
345 n.currentscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpNegotiator#current..respscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/httpRequester#resp. = nil
346 }
347 }
348
349 // --- dumb HTTP pack session ---
350
351 var _ transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session# = (*dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#)(nil)
352
353 type dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession# struct {
354 clientscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#client. *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#
355 baseURLscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#baseURL. *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#
356 servicescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#service. string
357 authorizerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#authorizer. func(*httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) error
358 refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#refs. *packpscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/.AdvRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#
359 }
360
361 func (s *dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#) Capabilitiesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#Capabilities().() *capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.Listscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/List# { return &capabilityscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/.Listscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/capability`/List#{} }
362
363 func (s *dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#) GetRemoteRefsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#GetRemoteRefs().(_ contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#) ([]*plumbingscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/.Referencescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing`/Reference#, error) {
364 if s.refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#refs. == nil {
365 return nil, transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.ErrEmptyRemoteRepositoryscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/ErrEmptyRemoteRepository.
366 }
367 refs, err := s.refsscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#refs..ResolvedReferencesscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/protocol/packp`/AdvRefs#ResolvedReferences().()
368 if err != nil {
369 return nil, err
370 }
371 return refs, nil
372 }
373
374 func (s *dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#) Fetchscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#Fetch().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, st storagescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/.Storerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/Storer#, req *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.FetchRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/FetchRequest#) error {
375 return s.fetchDumbscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#fetchDumb().(ctx, st, req)
376 }
377
378 func (s *dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#) Pushscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#Push().(_ contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#, _ storagescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/.Storerscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/storage`/Storer#, _ *transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.PushRequestscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/PushRequest#) error {
379 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("dumb HTTP does not support push")
380 }
381
382 func (s *dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#) Closescip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#Close().() error { return nil }
383
384 var (
385 _ transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session# = (*smartPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/smartPackSession#)(nil)
386 _ transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Sessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Session# = (*dumbPackSessionscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/dumbPackSession#)(nil)
387 _ transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/.Transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport`/Transport# = (*Transportscip-go gomod github.com/go-git/go-git/v6 . `github.com/go-git/go-git/v6/plumbing/transport/http`/Transport#)(nil)
388 )