Skip to content

Commit

Permalink
Merge pull request #58 from getsolus/grab-disable-compression
Browse files Browse the repository at this point in the history
builder/source/simple: Disable compression when downloading artifacts
  • Loading branch information
silkeh authored Dec 14, 2023
2 parents 97e36a6 + 7e30196 commit ef9d6d5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion builder/source/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"crypto/sha256"
"encoding/hex"
"log/slog"
"net/http"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -137,7 +138,19 @@ func (s *SimpleSource) download(destination string) error {
req.SetChecksum(sha256.New(), sum, false)
}

resp := grab.NewClient().Do(req)
// 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,
},
},
}

resp := client.Do(req)

// Setup our progress bar
pbar := pb.Start64(resp.Size())
Expand Down

0 comments on commit ef9d6d5

Please sign in to comment.