Skip to content

Commit

Permalink
client: Disable compression in default transport
Browse files Browse the repository at this point in the history
The default Golang client will advertise to the HTTP server that
it can handle gzip compressed response encoding. This is true,
but it breaks our artifacts.go code for doing download progress.

This is because the default behavior of the transport is to:

 * provide the proper reader to decompress the response
 * update the content-length header to be -1

The -1 breaks our logic. This fix gets us back to how things used
to work before CloudFlare started compressing the responses.

Signed-off-by: Andy Doan <[email protected]>
  • Loading branch information
doanac committed Apr 8, 2024
1 parent bdd7d46 commit 79f95a5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions client/foundries.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ func NewApiClient(serverUrl string, config Config, caCertPath string, version st
InsecureSkipVerify: config.InsecureSkipVerify,
}
http.DefaultTransport.(*http.Transport).TLSClientConfig = tlsCfg
http.DefaultTransport.(*http.Transport).DisableCompression = true
if len(caCertPath) > 0 {
rootCAs, _ := x509.SystemCertPool()
if rootCAs == nil {
Expand Down

0 comments on commit 79f95a5

Please sign in to comment.