Skip to content

Commit b674617

Browse files
authored
fix: fix the flag --insecure not work for pull command (#140)
Signed-off-by: chlins <[email protected]>
1 parent 5a5ed89 commit b674617

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pkg/backend/pull.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,22 @@ func (b *backend) Pull(ctx context.Context, target string, cfg *config.Pull) err
6060
}
6161

6262
// create the http client.
63-
httpClient := &http.Client{}
63+
transport := &http.Transport{
64+
TLSClientConfig: &tls.Config{
65+
InsecureSkipVerify: cfg.Insecure,
66+
},
67+
}
6468
if cfg.Proxy != "" {
6569
proxyURL, err := url.Parse(cfg.Proxy)
6670
if err != nil {
6771
return fmt.Errorf("failed to parse the proxy URL: %w", err)
6872
}
6973

70-
httpClient.Transport = retry.NewTransport(&http.Transport{
71-
Proxy: http.ProxyURL(proxyURL),
72-
TLSClientConfig: &tls.Config{
73-
InsecureSkipVerify: cfg.Insecure,
74-
},
75-
})
74+
transport.Proxy = http.ProxyURL(proxyURL)
75+
}
76+
77+
httpClient := &http.Client{
78+
Transport: retry.NewTransport(transport),
7679
}
7780

7881
src.Client = &auth.Client{

0 commit comments

Comments
 (0)