Skip to content

Commit

Permalink
builder/source/simple: Disable compression when downloading artifacts
Browse files Browse the repository at this point in the history
Generally causing more issues than it solves. It's usefulness is also
pretty debatable when we're downloading pre-compressed artifacts.

Resolves getsolus/packages#989.
  • Loading branch information
joebonrichie committed Dec 8, 2023
1 parent 97e36a6 commit 2b86832
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 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,17 @@ func (s *SimpleSource) download(destination string) error {
req.SetChecksum(sha256.New(), sum, false)
}

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

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

resp := client.Do(req)

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

0 comments on commit 2b86832

Please sign in to comment.