Compare commits

...

1 Commits

Author SHA1 Message Date
Fangliding
1bae46b1c0 Close body on fail 2026-05-08 14:34:35 +08:00

View File

@@ -71,6 +71,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
errors.LogInfoInner(ctx, err, "failed to "+method+" "+url)
}
gotConn.Close()
common.Close(body)
wrc.Close()
return
}
@@ -80,6 +81,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
if resp.StatusCode != 200 || uploadOnly { // stream-up
io.Copy(io.Discard, resp.Body)
resp.Body.Close() // if it is called immediately, the upload will be interrupted also
common.Close(body)
wrc.Close()
return
}