MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / newDownloadHTTPClient

Function newDownloadHTTPClient

agent/utils/files/file_op.go:444–460  ·  view source on GitHub ↗
(options DownloadOptions)

Source from the content-addressed store, hash-verified

442}
443
444func newDownloadHTTPClient(options DownloadOptions) (*http.Client, error) {
445 if !options.IgnoreCertificate && options.Proxy == nil {
446 return &http.Client{}, nil
447 }
448 transport := &http.Transport{}
449 if options.IgnoreCertificate {
450 transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
451 }
452 if options.Proxy != nil {
453 proxyURL, err := buildDownloadProxyURL(*options.Proxy)
454 if err != nil {
455 return nil, err
456 }
457 transport.Proxy = http.ProxyURL(proxyURL)
458 }
459 return &http.Client{Transport: transport}, nil
460}
461
462func (f FileOp) DownloadFileWithProcess(url, dst, key string, options DownloadOptions) error {
463 client, err := newDownloadHTTPClient(options)

Callers 1

Calls 1

buildDownloadProxyURLFunction · 0.85

Tested by

no test coverage detected