DisableCompression=true not work, the request header still has Accept-Encoding: gzip #29607
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have set DisableCompression=true but not work, the request header still has added Accept-Encoding: gzip, bug??
res, err := (&http.Client{
Transport: &http.Transport{
DialContext: func(ctx context.Context, netw, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(netw, addr, time.Duration(job[taskID].HttpConnectTimeout)*time.Millisecond)
if err != nil {
return nil, err
}
err = conn.SetReadDeadline(time.Now().Add(time.Duration(job[taskID].HttpReadTimeout) * time.Millisecond))
if err != nil {
return nil, err
}
err = conn.SetWriteDeadline(time.Now().Add(time.Duration(job[taskID].HttpWriteTimeout) * time.Millisecond))
if err != nil {
return nil, err
}
return conn, nil
},
TLSClientConfig: &tls.Config{
InsecureSkipVerify: job[taskID].HttpInsecureSkipVerify,
},
DisableCompression: true,
},
}).Do(req)
What did you expect to see?
No auto added Accept-Encoding: gzip, then the server will response no gzip content:
GET / HTTP/1.1
Host: www.jobs.af
User-Agent: Go-http-client/1.1
What did you see instead?
Auto added Accept-Encoding: gzip, it seems that DisableCompression not work.
GET / HTTP/1.1
Host: www.jobs.af
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip
The text was updated successfully, but these errors were encountered: