Skip to content

Commit 5c8c388

Browse files
committed
Do not let Go's http.Transport set Accept-Encoding magically
Signed-off-by: Kaviraj <[email protected]>
1 parent 885b2ef commit 5c8c388

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

conn_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package clickhouse
32

43
import (
@@ -253,6 +252,7 @@ func createHTTPRoundTripper(opt *Options) (http.RoundTripper, error) {
253252
IdleConnTimeout: opt.ConnMaxLifetime,
254253
ResponseHeaderTimeout: opt.ReadTimeout,
255254
TLSClientConfig: opt.TLS,
255+
DisableCompression: true,
256256
}
257257

258258
if opt.DialContext != nil {

conn_http_query.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package clickhouse
32

43
import (
@@ -51,9 +50,6 @@ func (h *httpConnect) query(ctx context.Context, release nativeTransportRelease,
5150
rw := h.compressionPool.Get()
5251
// The HTTPReaderWriter.NewReader will create a reader that will decompress it if needed,
5352
// cause adding Accept-Encoding:gzip on your request means response won’t be automatically decompressed
54-
// per https://github.com/golang/go/blob/master/src/net/http/transport.go#L182-L190.
55-
// Note user will need to have set enable_http_compression for CH to respond with compressed data. we don't set this
56-
// automatically as they might not have permissions.
5753
reader, err := rw.NewReader(res)
5854
if err != nil {
5955
err = fmt.Errorf("NewReader: %w", err)

0 commit comments

Comments
 (0)