MCPcopy Create free account
hub / github.com/libgit2/git2go / httpSmartSubtransportFactory

Function httpSmartSubtransportFactory

http.go:39–67  ·  view source on GitHub ↗
(remote *Remote, transport *Transport)

Source from the content-addressed store, hash-verified

37}
38
39func httpSmartSubtransportFactory(remote *Remote, transport *Transport) (SmartSubtransport, error) {
40 var proxyFn func(*http.Request) (*url.URL, error)
41 remoteConnectOpts, err := transport.SmartRemoteConnectOptions()
42 if err != nil {
43 return nil, err
44 }
45 switch remoteConnectOpts.ProxyOptions.Type {
46 case ProxyTypeNone:
47 proxyFn = nil
48 case ProxyTypeAuto:
49 proxyFn = http.ProxyFromEnvironment
50 case ProxyTypeSpecified:
51 parsedUrl, err := url.Parse(remoteConnectOpts.ProxyOptions.Url)
52 if err != nil {
53 return nil, err
54 }
55
56 proxyFn = http.ProxyURL(parsedUrl)
57 }
58
59 return &httpSmartSubtransport{
60 transport: transport,
61 client: &http.Client{
62 Transport: &http.Transport{
63 Proxy: proxyFn,
64 },
65 },
66 }, nil
67}
68
69type httpSmartSubtransport struct {
70 transport *Transport

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…