MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / initHttpClient

Function initHttpClient

main.go:157–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157func initHttpClient() {
158
159 // tls
160 tlsConfig := func(c *http.Client) {
161 c.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = !config.Conf().Optional.TLSVerify
162 }
163 common.SetHttpDownloadClient(tlsConfig)
164 common.SetHttpSaasClient(tlsConfig)
165
166 // proxy
167 if config.Conf().Optional.Proxy != "" {
168 proxyUrl := config.Conf().Optional.Proxy
169 if proxy, err := url.Parse(proxyUrl); err == nil {
170 proxyConfig := func(c *http.Client) {
171 c.Transport.(*http.Transport).Proxy = http.ProxyURL(proxy)
172 }
173 common.SetHttpDownloadClient(proxyConfig)
174 common.SetHttpSaasClient(proxyConfig)
175 logs.Infof("use proxy %s", proxyUrl)
176 } else {
177 logs.Warnf("parse proxy %s error: %s", proxyUrl, err)
178 }
179 }
180}
181
182func startProgressBar(arg *opensca.TaskArg) (stop func()) {
183

Callers 1

mainFunction · 0.85

Calls 5

ConfFunction · 0.92
SetHttpDownloadClientFunction · 0.92
SetHttpSaasClientFunction · 0.92
InfofFunction · 0.92
WarnfFunction · 0.92

Tested by

no test coverage detected