mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-09 10:49:35 +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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(resp.Body)
|
buf, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
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)
|
res, err := hc.ClientConn.RoundTrip(&req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -34,6 +34,8 @@ func handleHTTP(request *inbound.HTTPAdapter, outbound net.Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleResponse:
|
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)
|
resp, err := http.ReadResponse(outboundReader, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user