mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Fix: close http Response body on provider (#1154)
This commit is contained in:
parent
73c7b86477
commit
b283869c72
|
@ -107,6 +107,7 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
|
|
|
@ -46,6 +46,7 @@ func (hc *h2Conn) establishConn() error {
|
|||
},
|
||||
}
|
||||
|
||||
// it will be close at : `func (hc *h2Conn) Close() error`
|
||||
res, err := hc.ClientConn.RoundTrip(&req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -34,6 +34,8 @@ func handleHTTP(request *inbound.HTTPAdapter, outbound net.Conn) {
|
|||
}
|
||||
|
||||
handleResponse:
|
||||
// resp will be closed after we call resp.Write()
|
||||
// see https://golang.org/pkg/net/http/#Response.Write
|
||||
resp, err := http.ReadResponse(outboundReader, req)
|
||||
if err != nil {
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user