summaryrefslogtreecommitdiff
path: root/internal/httpclient
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-05-05 15:43:38 +0000
committerLibravatar GitHub <noreply@github.com>2024-05-05 16:43:38 +0100
commitd3f6960ba074bff5963c40fb6ff95cfe316d542b (patch)
treef516a5603eba71a3f5c51f3fd68ea6f5e04feed1 /internal/httpclient
parent[feature] Add HTTP header permission section to frontend (#2893) (diff)
downloadgotosocial-d3f6960ba074bff5963c40fb6ff95cfe316d542b.tar.xz
close + drain body if response body is too large (#2897)
Diffstat (limited to 'internal/httpclient')
-rw-r--r--internal/httpclient/client.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go
index 74c931ea9..ba8760091 100644
--- a/internal/httpclient/client.go
+++ b/internal/httpclient/client.go
@@ -400,6 +400,7 @@ func (c *Client) do(r *Request) (rsp *http.Response, retry bool, err error) {
// Check response body not too large.
if rsp.ContentLength > c.bodyMax {
+ _ = rsp.Body.Close()
return nil, false, ErrBodyTooLarge
}