mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
Close body on fail
This commit is contained in:
@@ -71,6 +71,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
|
|||||||
errors.LogInfoInner(ctx, err, "failed to "+method+" "+url)
|
errors.LogInfoInner(ctx, err, "failed to "+method+" "+url)
|
||||||
}
|
}
|
||||||
gotConn.Close()
|
gotConn.Close()
|
||||||
|
common.Close(body)
|
||||||
wrc.Close()
|
wrc.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -80,6 +81,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
|
|||||||
if resp.StatusCode != 200 || uploadOnly { // stream-up
|
if resp.StatusCode != 200 || uploadOnly { // stream-up
|
||||||
io.Copy(io.Discard, resp.Body)
|
io.Copy(io.Discard, resp.Body)
|
||||||
resp.Body.Close() // if it is called immediately, the upload will be interrupted also
|
resp.Body.Close() // if it is called immediately, the upload will be interrupted also
|
||||||
|
common.Close(body)
|
||||||
wrc.Close()
|
wrc.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user