Skip to content

Commit 6ea2497

Browse files
committed
Close body on fail
1 parent 228f1e1 commit 6ea2497

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

transport/internet/splithttp/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
7171
errors.LogInfoInner(ctx, err, "failed to "+method+" "+url)
7272
}
7373
gotConn.Close()
74+
common.Close(body)
7475
wrc.Close()
7576
return
7677
}
@@ -80,6 +81,7 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
8081
if resp.StatusCode != 200 || uploadOnly { // stream-up
8182
io.Copy(io.Discard, resp.Body)
8283
resp.Body.Close() // if it is called immediately, the upload will be interrupted also
84+
gotConn.Close()
8385
wrc.Close()
8486
return
8587
}

0 commit comments

Comments
 (0)