Skip to content

Commit 7f59773

Browse files
cfergeaupraveenkumar
authored andcommitted
download: Add proxy support
Our use of cavaliercoder/grab relies on the http_proxy/https_proxy environment variables to make use of proxies. This has been causing issues in the past (see 'proxy: Use our own http transport with crc's proxy config'), and this is also not enough when a proxy accessed over https is used, and usage of proxy-ca-file is needed. This commit makes use of the recently introduced network.HTTPTransport() to solve this.
1 parent b50dc99 commit 7f59773

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pkg/download/download.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ package download
33
import (
44
"os"
55

6-
"github.com/cavaliercoder/grab"
76
"github.com/code-ready/crc/pkg/crc/logging"
7+
"github.com/code-ready/crc/pkg/crc/network"
8+
9+
"github.com/cavaliercoder/grab"
810
"github.com/pkg/errors"
911
)
1012

1113
func Download(uri, destination string, mode os.FileMode) (string, error) {
1214
logging.Debugf("Downloading %s to %s", uri, destination)
1315

1416
client := grab.NewClient()
17+
client.HTTPClient.Transport = network.HTTPTransport()
1518
req, err := grab.NewRequest(destination, uri)
1619
if err != nil {
1720
return "", errors.Wrapf(err, "unable to get response from %s", uri)

0 commit comments

Comments
 (0)