add compression flag option for http request

This commit is contained in:
ginuerzh
2024-11-02 20:41:23 +08:00
parent edb9a992e2
commit a12870e766
6 changed files with 23 additions and 11 deletions
+6 -1
View File
@@ -107,6 +107,7 @@ func (h *httpHandler) Init(md md.Metadata) error {
IdleConnTimeout: 30 * time.Second,
ResponseHeaderTimeout: h.md.readTimeout,
DisableKeepAlives: !h.md.keepalive,
DisableCompression: !h.md.compression,
}
return nil
@@ -627,7 +628,11 @@ func (h *httpHandler) proxyRoundTrip(ctx context.Context, rw io.ReadWriter, req
return
}
return resp.Close, nil
if resp.ContentLength >= 0 {
close = resp.Close
}
return
}
func (h *httpHandler) dial(ctx context.Context, network, addr string) (conn net.Conn, err error) {