Skip to content

Commit

Permalink
builder/source/simple: Initialize our own grab client
Browse files Browse the repository at this point in the history
Instead of initializing a default `NewClient()`

Co-authored-by: Silke Hofstra <[email protected]>
  • Loading branch information
joebonrichie and silkeh committed Dec 12, 2023
1 parent 2b86832 commit 7e30196
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions builder/source/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,18 @@ func (s *SimpleSource) download(destination string) error {
req.SetChecksum(sha256.New(), sum, false)
}

// Keep go-grab defaults but also disable compression
// https://github.com/cavaliergopher/grab/blob/v3.0.1/v3/client.go#L53
tr := &http.Transport{
DisableCompression: true,
Proxy: http.ProxyFromEnvironment,
// Create a client with compression disabled.
// See: https://github.com/cavaliergopher/grab/blob/v3.0.1/v3/client.go#L53
client := &grab.Client{
UserAgent: "solbuild",
HTTPClient: &http.Client{
Transport: &http.Transport{
DisableCompression: true,
Proxy: http.ProxyFromEnvironment,
},
},
}

client := grab.NewClient()
client.HTTPClient = &http.Client{Transport: tr}

resp := client.Do(req)

// Setup our progress bar
Expand Down

0 comments on commit 7e30196

Please sign in to comment.