Debian Codegraph @

lfshttp/client.go

raw symbols SCIP
1 package lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.25.0 context/"
5 "crypto/tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/"
6 goerrorsscip-go gomod github.com/golang/go/src go1.25.0 errors/ "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
7 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
8 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
9 "netscip-go gomod github.com/golang/go/src go1.25.0 net/"
10 "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/"
11 "net/textprotoscip-go gomod github.com/golang/go/src go1.25.0 `net/textproto`/"
12 "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/"
13 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
14 "regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/"
15 "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/"
16 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
17 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
18 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
19 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
20
21 spnegoscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/ "github.com/dpotapov/go-spnegoscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/"
22 "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/"
23 "github.com/git-lfs/git-lfs/v3/credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/"
24 "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
25 "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/"
26 "github.com/rubyist/tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/"
27 "golang.org/x/net/http2scip-go gomod golang.org/x/net v0.57.0 `golang.org/x/net/http2`/"
28 )
29
30 const MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType. = "application/vnd.git-lfs+json"
31 const RequestContentTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/RequestContentType. = MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType. + "; charset=utf-8"
32
33 const (
34 defaultConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/defaultConcurrentTransfers. = 8
35 )
36
37 // At present, we return a fixed default value of 8 concurrent transfers,
38 // which is less than ideal for HTTP-based transfers when many objects
39 // are transferred by a single "git lfs filter-process" command.
40 //
41 // However, the "lfs.concurrentTransfers" setting also controls the number
42 // of processes we spawn for SSH-based or custom transfers, and we want
43 // to avoid spawning large numbers of separate processes.
44 func DefaultConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/DefaultConcurrentTransfers().() int {
45 return defaultConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/defaultConcurrentTransfers.
46 }
47
48 var (
49 UserAgentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/UserAgent. = "git-lfs"
50 httpREscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/httpRE. = regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25.0 regexp/MustCompile().(`\Ahttps?://`)
51 )
52
53 type hostDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData# struct {
54 hostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#host. string
55 modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#mode. credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#
56 }
57
58 type Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client# struct {
59 SSHscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SSH. SSHResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/SSHResolver#
60
61 DialTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DialTimeout. int
62 KeepaliveTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#KeepaliveTimeout. int
63 TLSTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#TLSTimeout. int
64 ConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ConcurrentTransfers. int
65 SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify. bool
66
67 Verbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Verbose. bool
68 DebuggingVerbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DebuggingVerbose. bool
69 VerboseOutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#VerboseOut. ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Writerscip-go gomod github.com/golang/go/src go1.25.0 io/Writer#
70
71 hostClientsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#hostClients. map[hostDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#]*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#
72 clientMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#clientMu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#
73
74 httpLoggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#httpLogger. *syncLoggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/syncLogger#
75
76 gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv. configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#
77 osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#osEnv. configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#
78 ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc. *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.URLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#
79
80 credHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#credHelperContext. *credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#
81
82 sshTriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshTries. int
83 }
84
85 func NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(ctx Contextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#) *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client# {
86 if ctx == nil {
87 ctx = NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, nil)
88 }
89
90 gitEnv := ctx.GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#GitEnv.()
91 osEnv := ctx.OSEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Context#OSEnv.()
92
93 cacheCreds := gitEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("lfs.cachecredentials", true)
94
95 // SSHResolver resolves LFS endpoint authentication by running
96 // git-lfs-authenticate over SSH. The returned credentials (URL
97 // and headers) are then used for subsequent HTTPS API requests.
98 var sshResolver SSHResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/SSHResolver# = &sshAuthClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthClient#{osscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthClient#os.: osEnv, gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthClient#git.: gitEnv}
99 if cacheCreds {
100 sshResolver = withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(sshResolver)
101 }
102
103 return &Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#{
104 SSHscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SSH.: sshResolver,
105 DialTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DialTimeout.: gitEnv.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.("lfs.dialtimeout", 0),
106 KeepaliveTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#KeepaliveTimeout.: gitEnv.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.("lfs.keepalive", 0),
107 TLSTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#TLSTimeout.: gitEnv.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.("lfs.tlstimeout", 0),
108 ConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ConcurrentTransfers.: gitEnv.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.("lfs.concurrenttransfers", DefaultConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/DefaultConcurrentTransfers().()),
109 SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.: !gitEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("http.sslverify", true) || osEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("GIT_SSL_NO_VERIFY", false),
110 Verbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Verbose.: osEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("GIT_CURL_VERBOSE", false),
111 DebuggingVerbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DebuggingVerbose.: osEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("LFS_DEBUG_HTTP", false),
112 gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv.: gitEnv,
113 osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#osEnv.: osEnv,
114 ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc.: configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewURLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewURLConfig().(gitEnv),
115 sshTriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshTries.: gitEnv.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Int.("lfs.ssh.retries", 5),
116 credHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#credHelperContext.: credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NewCredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelperContext().(gitEnv, osEnv),
117 }
118 }
119
120 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#GitEnv().() configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment# {
121 return c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv.
122 }
123
124 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) OSEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#OSEnv().() configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment# {
125 return c.osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#osEnv.
126 }
127
128 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) URLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#URLConfig().() *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.URLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig# {
129 return c.ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc.
130 }
131
132 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) NewRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#NewRequest().(method string, e Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#, suffix string, body interface{}) (*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) {
133 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(e.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url., "file://") {
134 // Initial `\n` to avoid overprinting `Downloading LFS...`.
135 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprint().(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr., "\n", trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().(`hint: The remote resolves to a file:// URL, which can only work with a
136 hint: standalone transfer agent. See section "Using a Custom Transfer Type
137 hint: without the API server" in custom-transfers.md for details.`), "\n")
138 }
139
140 sshRes, err := c.sshResolveWithRetriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshResolveWithRetries().(e, method)
141 if err != nil {
142 return nil, err
143 }
144
145 prefix := e.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.
146 if len(sshRes.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.) > 0 {
147 prefix = sshRes.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.
148 }
149
150 if !httpREscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/httpRE..MatchStringscip-go gomod github.com/golang/go/src go1.25.0 regexp/Regexp#MatchString().(prefix) {
151 urlfragment := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(prefix, "?", 2)[0]
152 return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("missing protocol: %q", urlfragment))
153 }
154
155 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().(method, joinURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/joinURL().(prefix, suffix), nil)
156 if err != nil {
157 return req, err
158 }
159
160 for key, value := range sshRes.Headerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Header. {
161 req.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().(key, value)
162 }
163 req.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", MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType.)
164
165 if body != nil {
166 if merr := MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, body); merr != nil {
167 return req, merr
168 }
169 req.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", RequestContentTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/RequestContentType.)
170 }
171
172 return req, err
173 }
174
175 const slashscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/slash. = "/"
176
177 func joinURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/joinURL().(prefix, suffix string) string {
178 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasSuffix().(prefix, slashscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/slash.) {
179 return prefix + suffix
180 }
181 return prefix + slashscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/slash. + suffix
182 }
183
184 // Do sends an HTTP request to get an HTTP response. It wraps net/http, adding
185 // extra headers, redirection handling, and error reporting.
186 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req *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#) (*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#, error) {
187 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. = c.ExtraHeadersForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ExtraHeadersFor().(req)
188
189 return c.doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#do().(req, "", nil, credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NoneAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NoneAccess.)
190 }
191
192 // DoWithAccess sends an HTTP request to get an HTTP response using the
193 // specified access mode. It wraps net/http, adding extra headers, redirection
194 // handling, and error reporting.
195 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) DoWithAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DoWithAccess().(req *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#, mode credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#) (*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#, error) {
196 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. = c.ExtraHeadersForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ExtraHeadersFor().(req)
197
198 return c.doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#do().(req, "", nil, mode)
199 }
200
201 // do performs an *http.Request respecting redirects, and handles the response
202 // as defined in c.handleResponse. Notably, it does not alter the headers for
203 // the request argument in any way.
204 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#do().(req *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#, remote string, via []*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#, mode credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#) (*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#, error) {
205 req.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", UserAgentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/UserAgent.)
206
207 client, err := c.HttpClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#HttpClient().(req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL., mode)
208 if err != nil {
209 return nil, err
210 }
211
212 res, err := c.doWithRedirectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#doWithRedirects().(client, req, remote, via)
213 if err != nil {
214 return res, err
215 }
216
217 return res, c.handleResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#handleResponse().(res)
218 }
219
220 // Close closes any resources that this client opened.
221 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Close().() error {
222 return c.httpLoggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#httpLogger..Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/syncLogger#Close().()
223 }
224
225 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) sshResolveWithRetriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshResolveWithRetries().(e Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#, method string) (*sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#, error) {
226 var sshRes sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#
227 var err error
228
229 uc := configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewURLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewURLConfig().(c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv.)
230 if val, ok := uc.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Get().("lfs", e.OriginalUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#OriginalUrl., "sshtransfer"); ok && val != "negotiate" && val != "never" {
231 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("skipping SSH-HTTPS hybrid protocol connection by request")
232 return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("git-lfs-authenticate has been disabled by request")
233 }
234
235 requests := max(0, c.sshTriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshTries.) + 1
236 for i := 0; i < requests; i++ {
237 sshRes, err = c.SSHscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SSH..Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/SSHResolver#Resolve.(e, method)
238 if err == nil {
239 return &sshRes, nil
240 }
241
242 // If the git-lfs-authenticate command is unavailable on the
243 // server, fall back to the guessed LFS endpoint (per the server
244 // discovery spec) by returning an empty response with no error.
245 // Retrying would not help, so stop immediately.
246 var unavailable *sshAuthenticateUnavailableErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthenticateUnavailableError#
247 if goerrorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Asscip-go gomod github.com/golang/go/src go1.25.0 errors/As().(err, &unavailable) {
248 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().(
249 "ssh: %s does not provide git-lfs-authenticate, falling back to guessed LFS endpoint",
250 e.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata..UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.,
251 )
252 return &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{}, nil
253 }
254
255 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().(
256 "ssh: %s failed, error: %s, message: %s (try: %d/%d)",
257 e.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata..UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost., err.Error(), sshRes.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message., i,
258 requests,
259 )
260 }
261
262 if len(sshRes.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message.) > 0 {
263 return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, sshRes.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message.)
264 }
265 return nil, err
266 }
267
268 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) ExtraHeadersForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ExtraHeadersFor().(req *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#) httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header# {
269 extraHeaders := c.extraHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#extraHeaders().(req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL.)
270 if len(extraHeaders) == 0 {
271 return req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.
272 }
273
274 copy := make(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#, len(req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.))
275 for k, vs := range req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. {
276 copy[k] = vs
277 }
278
279 for k, vs := range extraHeaders {
280 for _, v := range vs {
281 if !slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Containsscip-go gomod github.com/golang/go/src go1.25.0 slices/Contains().(copy[k], v) {
282 copy[k] = append(copy[k], v)
283 }
284 }
285 }
286 return copy
287 }
288
289 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) extraHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#extraHeaders().(u *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#) map[string][]string {
290 hdrs := c.ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc..GetAllscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#GetAll().("http", u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "extraHeader")
291 m := make(map[string][]string, len(hdrs))
292
293 for _, hdr := range hdrs {
294 parts := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(hdr, ":", 2)
295 if len(parts) < 2 {
296 continue
297 }
298
299 k, v := parts[0], stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(parts[1])
300 // If header keys are given in non-canonicalized form (e.g.,
301 // "AUTHORIZATION" as opposed to "Authorization") they will not
302 // be returned in calls to net/http.Header.Get().
303 //
304 // So, we avoid this problem by first canonicalizing header keys
305 // for extra headers.
306 k = textprotoscip-go gomod github.com/golang/go/src go1.25.0 `net/textproto`/.CanonicalMIMEHeaderKeyscip-go gomod github.com/golang/go/src go1.25.0 `net/textproto`/CanonicalMIMEHeaderKey().(k)
307
308 m[k] = append(m[k], v)
309 }
310 return m
311 }
312
313 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) DoWithRedirectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DoWithRedirect().(cli *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#, req *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#, remote string, via []*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#) (*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#, *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#, error) {
314 tracedReq, err := c.traceRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#traceRequest().(req)
315 if err != nil {
316 return nil, nil, err
317 }
318
319 var retries int
320 if n, ok := Retriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Retries().(req); ok {
321 retries = n
322 } else {
323 retries = defaultRequestRetriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/defaultRequestRetries.
324 }
325
326 var res *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#
327
328 requests := max(0, retries) + 1
329 for i := 0; i < requests; i++ {
330 res, err = cli.Doscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#Do().(req)
331 if err == nil {
332 break
333 }
334
335 if seek, ok := req.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body..(ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Seekerscip-go gomod github.com/golang/go/src go1.25.0 io/Seeker#); ok {
336 seek.Seekscip-go gomod github.com/golang/go/src go1.25.0 io/Seeker#Seek().(0, ioscip-go gomod github.com/golang/go/src go1.25.0 io/.SeekStartscip-go gomod github.com/golang/go/src go1.25.0 io/SeekStart.)
337 }
338
339 c.traceResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#traceResponse().(req, tracedReq, nil)
340 }
341
342 if err != nil {
343 c.traceResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#traceResponse().(req, tracedReq, nil)
344 // SPNEGO (Negotiate) errors are authentication errors.
345 var spnegoErr *spnegoscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/.Errorscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/Error#
346 if goerrorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Asscip-go gomod github.com/golang/go/src go1.25.0 errors/As().(err, &spnegoErr) {
347 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("http: got Negotiate error: %s", spnegoErr.Errorscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/Error#Error().())
348 return nil, nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.NewAuthErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/NewAuthError().(err)
349 }
350 return nil, nil, err
351 }
352
353 if res == nil {
354 return nil, nil, nil
355 }
356
357 if res.Uncompressedscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#Uncompressed. {
358 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("http: decompressed gzipped response")
359 }
360
361 c.traceResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#traceResponse().(req, tracedReq, res)
362
363 if res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != 301 &&
364 res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != 302 &&
365 res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != 303 &&
366 res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != 307 &&
367 res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode. != 308 {
368
369 // Above are the list of 3xx status codes that we know
370 // how to handle below. If the status code contained in
371 // the HTTP response was none of them, return the (res,
372 // err) tuple as-is, otherwise handle the redirect.
373 return nil, res, c.handleResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#handleResponse().(res)
374 }
375
376 redirectTo := res.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().("Location")
377 locurl, err := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.Parsescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Parse().(redirectTo)
378 if err == nil && !locurl.IsAbsscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#IsAbs().() {
379 locurl = req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..ResolveReferencescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#ResolveReference().(locurl)
380 redirectTo = locurl.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().()
381 }
382
383 via = append(via, req)
384 if len(via) >= 3 {
385 return nil, res, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("too many redirects"))
386 }
387
388 redirectedReq, err := newRequestForRetryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newRequestForRetry().(req, redirectTo)
389 if err != nil {
390 return nil, res, err
391 }
392
393 res.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().()
394
395 return redirectedReq, nil, nil
396 }
397
398 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) doWithRedirectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#doWithRedirects().(cli *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#, req *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#, remote string, via []*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#) (*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#, error) {
399 redirectedReq, res, err := c.DoWithRedirectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DoWithRedirect().(cli, req, remote, via)
400 if err != nil || res != nil {
401 return res, err
402 }
403
404 if redirectedReq == nil {
405 return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to redirect request"))
406 }
407
408 return c.doWithRedirectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#doWithRedirects().(cli, redirectedReq, remote, via)
409 }
410
411 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) configureProtocolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#configureProtocols().(u *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#, transport *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#) error {
412 version, _ := c.ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Get().("http", u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "version")
413 switch version {
414 case "HTTP/1.1":
415 // This disables HTTP/2, according to the documentation.
416 transport.TLSNextProtoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSNextProto. = make(map[string]func(authority string, c *tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.Connscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Conn#) httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.RoundTripperscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/RoundTripper#)
417 case "HTTP/2":
418 if u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. != "https" {
419 return errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("HTTP/2 cannot be used except with TLS"))
420 }
421 http2scip-go gomod golang.org/x/net v0.57.0 `golang.org/x/net/http2`/.ConfigureTransportscip-go gomod golang.org/x/net v0.57.0 `golang.org/x/net/http2`/ConfigureTransport().(transport)
422 delete(transport.TLSNextProtoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSNextProto., "http/1.1")
423 case "":
424 http2scip-go gomod golang.org/x/net v0.57.0 `golang.org/x/net/http2`/.ConfigureTransportscip-go gomod golang.org/x/net v0.57.0 `golang.org/x/net/http2`/ConfigureTransport().(transport)
425 default:
426 return errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Unknown HTTP version %q", version))
427 }
428 return nil
429 }
430
431 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) Transportscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Transport().(u *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#, access credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#) (httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.RoundTripperscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/RoundTripper#, error) {
432 host := u.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host.
433
434 if c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv. == nil {
435 c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv. = make(testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#)
436 }
437
438 if c.osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#osEnv. == nil {
439 c.osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#osEnv. = make(testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#)
440 }
441
442 concurrentTransfers := c.ConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ConcurrentTransfers.
443 if concurrentTransfers < 1 {
444 concurrentTransfers = DefaultConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/DefaultConcurrentTransfers().()
445 }
446
447 dialtime := c.DialTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DialTimeout.
448 if dialtime < 1 {
449 dialtime = 30
450 }
451
452 keepalivetime := c.KeepaliveTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#KeepaliveTimeout.
453 if keepalivetime < 1 {
454 keepalivetime = 1800
455 }
456
457 tlstime := c.TLSTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#TLSTimeout.
458 if tlstime < 1 {
459 tlstime = 30
460 }
461 tr := &httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#{
462 Proxyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#Proxy.: proxyFromClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/proxyFromClient().(c),
463 TLSHandshakeTimeoutscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSHandshakeTimeout.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(tlstime) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Secondscip-go gomod github.com/golang/go/src go1.25.0 time/Second.,
464 MaxIdleConnsPerHostscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#MaxIdleConnsPerHost.: concurrentTransfers,
465 }
466
467 activityTimeout := 30
468 if v, ok := c.ucscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#uc..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Get().("lfs", u.Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "activitytimeout"); ok {
469 if i, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.0 strconv/Atoi().(v); err == nil {
470 activityTimeout = i
471 } else {
472 activityTimeout = 0
473 }
474 }
475
476 dialer := &netscip-go gomod github.com/golang/go/src go1.25.0 net/.Dialerscip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#{
477 Timeoutscip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#Timeout.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(dialtime) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Secondscip-go gomod github.com/golang/go/src go1.25.0 time/Second.,
478 KeepAlivescip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#KeepAlive.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(keepalivetime) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Secondscip-go gomod github.com/golang/go/src go1.25.0 time/Second.,
479 DualStackscip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#DualStack.: true,
480 }
481
482 if activityTimeout > 0 {
483 activityDuration := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(activityTimeout) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Secondscip-go gomod github.com/golang/go/src go1.25.0 time/Second.
484 tr.DialContextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#DialContext. = func(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#, network, addr string) (netscip-go gomod github.com/golang/go/src go1.25.0 net/.Connscip-go gomod github.com/golang/go/src go1.25.0 net/Conn#, error) {
485 c, err := dialer.DialContextscip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#DialContext().(ctx, network, addr)
486 if c == nil {
487 return c, err
488 }
489 if tc, ok := c.(*netscip-go gomod github.com/golang/go/src go1.25.0 net/.TCPConnscip-go gomod github.com/golang/go/src go1.25.0 net/TCPConn#); ok {
490 tc.SetKeepAlivescip-go gomod github.com/golang/go/src go1.25.0 net/TCPConn#SetKeepAlive().(true)
491 tc.SetKeepAlivePeriodscip-go gomod github.com/golang/go/src go1.25.0 net/TCPConn#SetKeepAlivePeriod().(dialer.KeepAlivescip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#KeepAlive.)
492 }
493 return &deadlineConnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#{Timeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Timeout.: activityDuration, Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn.: c}, err
494 }
495 } else {
496 tr.DialContextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#DialContext. = dialer.DialContextscip-go gomod github.com/golang/go/src go1.25.0 net/Dialer#DialContext().
497 }
498
499 tr.TLSClientConfigscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSClientConfig. = &tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#{
500 Renegotiationscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#Renegotiation.: tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.RenegotiateFreelyAsClientscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/RenegotiateFreelyAsClient.,
501 }
502
503 if isClientCertEnabledForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/isClientCertEnabledForHost().(c, host) {
504 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("http: client cert for %s", host)
505 cert, err := getClientCertForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getClientCertForHost().(c, host)
506 if err != nil {
507 return nil, err
508 }
509 if cert != nil {
510 tr.TLSClientConfigscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSClientConfig..Certificatesscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#Certificates. = []tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.Certificatescip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Certificate#{*cert}
511 tr.TLSClientConfigscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSClientConfig..BuildNameToCertificatescip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#BuildNameToCertificate().()
512 }
513 }
514
515 if isCertVerificationDisabledForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/isCertVerificationDisabledForHost().(c, host) {
516 tr.TLSClientConfigscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSClientConfig..InsecureSkipVerifyscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#InsecureSkipVerify. = true
517 } else {
518 tr.TLSClientConfigscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Transport#TLSClientConfig..RootCAsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#RootCAs. = getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, host)
519 }
520
521 if err := c.configureProtocolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#configureProtocols().(u, tr); err != nil {
522 return nil, err
523 }
524
525 if access == credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.NegotiateAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NegotiateAccess. {
526 // This technically copies a mutex, but we know since we've just created
527 // the object that this mutex is unlocked.
528 return &spnegoscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/.Transportscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/Transport#{Transportscip-go gomod github.com/dpotapov/go-spnego 298b63a54430 `github.com/dpotapov/go-spnego`/Transport#Transport.: *tr}, nil
529 }
530 return tr, nil
531 }
532
533 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) HttpClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#HttpClient().(u *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#, access credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.AccessModescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AccessMode#) (*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#, error) {
534 c.clientMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#clientMu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().()
535 defer c.clientMuscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#clientMu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().()
536
537 host := u.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host.
538
539 if c.hostClientsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#hostClients. == nil {
540 c.hostClientsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#hostClients. = make(map[hostDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#]*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#)
541 }
542
543 hd := hostDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#{hostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#host.: host, modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/hostData#mode.: access}
544
545 if client, ok := c.hostClientsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#hostClients.[hd]; ok {
546 return client, nil
547 }
548
549 tr, err := c.Transportscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Transport().(u, access)
550 if err != nil {
551 return nil, err
552 }
553
554 httpClient := &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#{
555 Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#Transport.: tr,
556 CheckRedirectscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#CheckRedirect.: 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#, []*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 {
557 return httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ErrUseLastResponsescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ErrUseLastResponse.
558 },
559 }
560
561 if isCookieJarEnabledForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/isCookieJarEnabledForHost().(c, host) {
562 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("http: cookieFile for %s", host)
563 if cookieJar, err := getCookieJarForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getCookieJarForHost().(c, host); err == nil {
564 httpClient.Jarscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#Jar. = cookieJar
565 } else {
566 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("http: error while reading cookieFile: %s", err.Error())
567 }
568 }
569
570 c.hostClientsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#hostClients.[hd] = httpClient
571 if c.VerboseOutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#VerboseOut. == nil {
572 c.VerboseOutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#VerboseOut. = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr.
573 }
574
575 return httpClient, nil
576 }
577
578 func (c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#) CurrentUserscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#CurrentUser().() (string, string) {
579 userName, _ := c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("user.name")
580 userEmail, _ := c.gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#gitEnv..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("user.email")
581 return userName, userEmail
582 }
583
584 func newRequestForRetryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newRequestForRetry().(req *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#, location string) (*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) {
585 newReq, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().(req.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method., location, nil)
586 if err != nil {
587 return nil, err
588 }
589
590 if req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. == "https" && newReq.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. == "http" {
591 return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("refusing insecure redirect: HTTPS to HTTP"))
592 }
593
594 sameHost := req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host. == newReq.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host.
595 for key := range req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. {
596 if key == "Authorization" {
597 if !sameHost {
598 continue
599 }
600 }
601 newReq.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().(key, req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().(key))
602 }
603
604 oldestURL := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "?", 2)[0]
605 newURL := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(newReq.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), "?", 2)[0]
606 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("api: redirect %s %s to %s", req.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method., oldestURL, newURL)
607
608 // This body will have already been rewound from a call to
609 // lfsapi.Client.traceRequest().
610 newReq.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body. = req.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.
611 newReq.ContentLengthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#ContentLength. = req.ContentLengthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#ContentLength.
612
613 // Copy the request's context.Context, if any.
614 newReq = newReq.WithContextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#WithContext().(req.Contextscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Context().())
615
616 return newReq, nil
617 }
618
619 type deadlineConnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn# struct {
620 Timeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Timeout. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#
621 netscip-go gomod github.com/golang/go/src go1.25.0 net/.Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn.
622 }
623
624 func (c *deadlineConnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#) Readscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Read().(b []byte) (int, error) {
625 if err := c.Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn..SetDeadlinescip-go gomod github.com/golang/go/src go1.25.0 net/Conn#SetDeadline().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(c.Timeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Timeout.)); err != nil {
626 return 0, err
627 }
628 return c.Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn..Readscip-go gomod github.com/golang/go/src go1.25.0 net/Conn#Read().(b)
629 }
630
631 func (c *deadlineConnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#) Writescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Write().(b []byte) (int, error) {
632 if err := c.Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn..SetDeadlinescip-go gomod github.com/golang/go/src go1.25.0 net/Conn#SetDeadline().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(c.Timeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Timeout.)); err != nil {
633 return 0, err
634 }
635
636 return c.Connscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/deadlineConn#Conn..Writescip-go gomod github.com/golang/go/src go1.25.0 net/Conn#Write().(b)
637 }
638
639 func initscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/init().() {
640 UserAgentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/UserAgent. = configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.VersionDescscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/VersionDesc.
641 }
642
643 type testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv# map[string]string
644
645 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Get().(key string) (v string, ok bool) {
646 v, ok = e[key]
647 return
648 }
649
650 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) GetAllscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#GetAll().(key string) []string {
651 if v, ok := e.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Get().(key); ok {
652 return []string{v}
653 }
654 return make([]string, 0)
655 }
656
657 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Int().(key string, def int) int {
658 s, _ := e.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Get().(key)
659 return configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Intscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Int().(s, def)
660 }
661
662 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) Int64scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Int64().(key string, def int64) int64 {
663 s, _ := e.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Get().(key)
664 return configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Int64scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Int64().(s, def)
665 }
666
667 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Bool().(key string, def bool) bool {
668 s, _ := e.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#Get().(key)
669 return configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Bool().(s, def)
670 }
671
672 func (e testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#) Allscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#All().() map[string][]string {
673 m := make(map[string][]string)
674 for k, _ := range e {
675 m[k] = e.GetAllscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#GetAll().(k)
676 }
677 return m
678 }