(options DownloadOptions)
| 442 | } |
| 443 | |
| 444 | func 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 | |
| 462 | func (f FileOp) DownloadFileWithProcess(url, dst, key string, options DownloadOptions) error { |
| 463 | client, err := newDownloadHTTPClient(options) |
no test coverage detected