| 1 | package lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/" |
| 6 | "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/" |
| 7 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 8 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | |
| 11 | "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`/" |
| 12 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 13 | ) |
| 14 | |
| 15 | var testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert. = `-----BEGIN CERTIFICATE----- |
| 16 | MIIDyjCCArKgAwIBAgIJAMi9TouXnW+ZMA0GCSqGSIb3DQEBBQUAMEwxCzAJBgNV |
| 17 | BAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRAwDgYDVQQKEwdnaXQtbGZzMRYw |
| 18 | FAYDVQQDEw1naXQtbGZzLmxvY2FsMB4XDTE2MDMwOTEwNTk1NFoXDTI2MDMwNzEw |
| 19 | NTk1NFowTDELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxEDAOBgNV |
| 20 | BAoTB2dpdC1sZnMxFjAUBgNVBAMTDWdpdC1sZnMubG9jYWwwggEiMA0GCSqGSIb3 |
| 21 | DQEBAQUAA4IBDwAwggEKAoIBAQCXmsI2w44nOsP7n3kL1Lz04U5FMZRErBSXLOE+ |
| 22 | dpd4tMpgrjOncJPD9NapHabsVIOnuVvMDuBbWYwU9PwbN4tjQzch8DRxBju6fCp/ |
| 23 | Pm+QF6p2Ga+NuSHWoVfNFuF2776aF9gSLC0rFnBekD3HCz+h6I5HFgHBvRjeVyAs |
| 24 | PRw471Y28Je609SoYugxaQNzRvahP0Qf43tE74/WN3FTGXy1+iU+uXpfp8KxnsuB |
| 25 | gfj+Wi6mPt8Q2utcA1j82dJ0K8ZbHSbllzmI+N/UuRLsbTUEdeFWYdZ0AlZNd/Vc |
| 26 | PlOSeoExwvOHIuUasT/cLIrEkdXNud2QLg2GpsB6fJi3NEUhAgMBAAGjga4wgasw |
| 27 | HQYDVR0OBBYEFC8oVPRQbekTwfkntgdL7PADXNDbMHwGA1UdIwR1MHOAFC8oVPRQ |
| 28 | bekTwfkntgdL7PADXNDboVCkTjBMMQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29t |
| 29 | ZS1TdGF0ZTEQMA4GA1UEChMHZ2l0LWxmczEWMBQGA1UEAxMNZ2l0LWxmcy5sb2Nh |
| 30 | bIIJAMi9TouXnW+ZMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACIl |
| 31 | /CBLIhC3drrYme4cGArhWyXIyRpMoy9Z+9Dru8rSuOr/RXR6sbYhlE1iMGg4GsP8 |
| 32 | 4Cj7aIct6Vb9NFv5bGNyFJAmDesm3SZlEcWxU3YBzNPiJXGiUpQHCkp0BH+gvsXc |
| 33 | tb58XoiDZPVqrl0jNfX/nHpHR9c3DaI3Tjx0F/No0ZM6mLQ1cNMikFyEWQ4U0zmW |
| 34 | LvV+vvKuOixRqbcVnB5iTxqMwFG0X3tUql0cftGBgoCoR1+FSBOs0EXLODCck6ql |
| 35 | aW6vZwkA+ccj/pDTx8LBe2lnpatrFeIt6znAUJW3G8r6SFHKVBWHwmESZS4kxhjx |
| 36 | NpW5Hh0w4/5iIetCkJ0= |
| 37 | -----END CERTIFICATE-----` |
| 38 | |
| 39 | var sslCAInfoConfigHostNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoConfigHostNames. = []string{ |
| 40 | "git-lfs.local", |
| 41 | "git-lfs.local/", |
| 42 | } |
| 43 | var sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. = []struct { |
| 44 | hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName. string |
| 45 | shouldMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:shouldMatch. bool |
| 46 | }{ |
| 47 | {"git-lfs.local", true}, |
| 48 | {"git-lfs.local:8443", false}, |
| 49 | {"wronghost.com", false}, |
| 50 | } |
| 51 | |
| 52 | func clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(c *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#, host string) *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# { |
| 53 | u, _ := 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().(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().("https://%v", host)) |
| 54 | client, _ := c.HttpClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#HttpClient().(u, credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/.BasicAccessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/BasicAccess.) |
| 55 | return client |
| 56 | } |
| 57 | |
| 58 | func TestCertFromSSLCAInfoConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAInfoConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 59 | tempfile, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.CreateTempscip-go gomod github.com/golang/go/src go1.25.0 os/CreateTemp().("", "testcert") |
| 60 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating temp cert file") |
| 61 | defer osscip-go gomod github.com/golang/go/src go1.25.0 os/.Removescip-go gomod github.com/golang/go/src go1.25.0 os/Remove().(tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().()) |
| 62 | |
| 63 | _, err = tempfile.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.) |
| 64 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error writing temp cert file") |
| 65 | tempfile.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 66 | |
| 67 | // Test http.<url>.sslcainfo |
| 68 | for _, hostName := range sslCAInfoConfigHostNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoConfigHostNames. { |
| 69 | hostKey := 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().("http.https://%v.sslcainfo", hostName) |
| 70 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 71 | hostKey: tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().(), |
| 72 | })) |
| 73 | |
| 74 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 75 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 76 | |
| 77 | var shouldOrShouldnt string |
| 78 | if matchedHostTest.shouldMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:shouldMatch. { |
| 79 | shouldOrShouldnt = "should" |
| 80 | } else { |
| 81 | shouldOrShouldnt = "should not" |
| 82 | } |
| 83 | |
| 84 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, matchedHostTest.shouldMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:shouldMatch., pool != nil, |
| 85 | "Cert lookup for \"%v\" %v have succeeded with \"%v\"", |
| 86 | matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName., shouldOrShouldnt, hostKey) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // Test http.sslcainfo |
| 91 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 92 | "http.sslcainfo": tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().(), |
| 93 | })) |
| 94 | |
| 95 | // Should match any host at all |
| 96 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 97 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 98 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, pool) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestCertFromSSLCAInfoEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAInfoEnv().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 103 | tempfile, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.CreateTempscip-go gomod github.com/golang/go/src go1.25.0 os/CreateTemp().("", "testcert") |
| 104 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating temp cert file") |
| 105 | defer osscip-go gomod github.com/golang/go/src go1.25.0 os/.Removescip-go gomod github.com/golang/go/src go1.25.0 os/Remove().(tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().()) |
| 106 | |
| 107 | _, err = tempfile.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.) |
| 108 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error writing temp cert file") |
| 109 | tempfile.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 110 | |
| 111 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{ |
| 112 | "GIT_SSL_CAINFO": tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().(), |
| 113 | }, nil)) |
| 114 | |
| 115 | // Should match any host at all |
| 116 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 117 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 118 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, pool) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | func TestCertFromSSLCAInfoEnvIsIgnoredForSchannelBackendscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAInfoEnvIsIgnoredForSchannelBackend().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 123 | tempfile, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.CreateTempscip-go gomod github.com/golang/go/src go1.25.0 os/CreateTemp().("", "testcert") |
| 124 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating temp cert file") |
| 125 | defer osscip-go gomod github.com/golang/go/src go1.25.0 os/.Removescip-go gomod github.com/golang/go/src go1.25.0 os/Remove().(tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().()) |
| 126 | |
| 127 | _, err = tempfile.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.) |
| 128 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error writing temp cert file") |
| 129 | tempfile.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 130 | |
| 131 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{ |
| 132 | "GIT_SSL_CAINFO": tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().(), |
| 133 | }, map[string]string{ |
| 134 | "http.sslbackend": "schannel", |
| 135 | })) |
| 136 | |
| 137 | // Should match any host at all |
| 138 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 139 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 140 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, pool) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func TestCertFromSSLCAInfoEnvWithSchannelBackendscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAInfoEnvWithSchannelBackend().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 145 | tempfile, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.CreateTempscip-go gomod github.com/golang/go/src go1.25.0 os/CreateTemp().("", "testcert") |
| 146 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating temp cert file") |
| 147 | defer osscip-go gomod github.com/golang/go/src go1.25.0 os/.Removescip-go gomod github.com/golang/go/src go1.25.0 os/Remove().(tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().()) |
| 148 | |
| 149 | _, err = tempfile.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.) |
| 150 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error writing temp cert file") |
| 151 | tempfile.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 152 | |
| 153 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{ |
| 154 | "GIT_SSL_CAINFO": tempfile.Namescip-go gomod github.com/golang/go/src go1.25.0 os/File#Name().(), |
| 155 | }, map[string]string{ |
| 156 | "http.sslbackend": "schannel", |
| 157 | "http.schannelusesslcainfo": "1", |
| 158 | })) |
| 159 | |
| 160 | // Should match any host at all |
| 161 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 162 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 163 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, pool) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func TestCertFromSSLCAPathConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAPathConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 168 | tempdir := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 169 | |
| 170 | err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.WriteFilescip-go gomod github.com/golang/go/src go1.25.0 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tempdir, "cert1.pem"), []byte(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.), 0644) |
| 171 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating cert file") |
| 172 | |
| 173 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 174 | "http.sslcapath": tempdir, |
| 175 | })) |
| 176 | |
| 177 | // Should match any host at all |
| 178 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 179 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 180 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, pool) |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | func TestCertFromSSLCAPathEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertFromSSLCAPathEnv().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 185 | tempdir := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 186 | |
| 187 | err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.WriteFilescip-go gomod github.com/golang/go/src go1.25.0 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(tempdir, "cert1.pem"), []byte(testCertscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testCert.), 0644) |
| 188 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "Error creating cert file") |
| 189 | |
| 190 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{ |
| 191 | "GIT_SSL_CAPATH": tempdir, |
| 192 | }, nil)) |
| 193 | |
| 194 | // Should match any host at all |
| 195 | for _, matchedHostTest := range sslCAInfoMatchedHostTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests. { |
| 196 | pool := getRootCAsForHostFromGitconfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/getRootCAsForHostFromGitconfig().(c, matchedHostTest.hostNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sslCAInfoMatchedHostTests:hostName.) |
| 197 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, pool) |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | func TestCertVerifyDisabledGlobalEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertVerifyDisabledGlobalEnv().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 202 | empty := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(nil) |
| 203 | httpClient := clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(empty, "anyhost.com") |
| 204 | tr, ok := httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 205 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 206 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, 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.) |
| 207 | } |
| 208 | |
| 209 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{ |
| 210 | "GIT_SSL_NO_VERIFY": "1", |
| 211 | }, nil)) |
| 212 | |
| 213 | httpClient = clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(c, "anyhost.com") |
| 214 | tr, ok = httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 215 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 216 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, 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.) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | func TestCertVerifyDisabledGlobalConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertVerifyDisabledGlobalConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 221 | def := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(nil) |
| 222 | httpClient := clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(def, "anyhost.com") |
| 223 | tr, ok := httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 224 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 225 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, 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.) |
| 226 | } |
| 227 | |
| 228 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 229 | "http.sslverify": "false", |
| 230 | })) |
| 231 | |
| 232 | httpClient = clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(c, "anyhost.com") |
| 233 | tr, ok = httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 234 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 235 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, 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.) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | func TestCertVerifyDisabledHostConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestCertVerifyDisabledHostConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 240 | def := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(nil) |
| 241 | httpClient := clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(def, "specifichost.com") |
| 242 | tr, ok := httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 243 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 244 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, 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.) |
| 245 | } |
| 246 | |
| 247 | httpClient = clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(def, "otherhost.com") |
| 248 | tr, ok = httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 249 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 250 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, 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.) |
| 251 | } |
| 252 | |
| 253 | c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 254 | "http.https://specifichost.com/.sslverify": "false", |
| 255 | })) |
| 256 | |
| 257 | httpClient = clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(c, "specifichost.com") |
| 258 | tr, ok = httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 259 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 260 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, 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.) |
| 261 | } |
| 262 | |
| 263 | httpClient = clientForHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/clientForHost().(c, "otherhost.com") |
| 264 | tr, ok = httpClient.Transportscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#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#) |
| 265 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok) { |
| 266 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, 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.) |
| 267 | } |
| 268 | } |