summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-10-24 12:18:32 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-10-24 12:18:32 -0600
commit817470dd66edb22015651971e39f8ef183d7bf9d (patch)
treedef110b19b28053a2103a670728e2c1e085c5298 /caddyconfig
parentbbe366316771ea23381a473a528e71a72a7148a5 (diff)
httploader: Close resp body on bad status code
Related to #5158
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/httploader.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/caddyconfig/httploader.go b/caddyconfig/httploader.go
index 04dec34..7c4dc23 100644
--- a/caddyconfig/httploader.go
+++ b/caddyconfig/httploader.go
@@ -124,6 +124,7 @@ func attemptHttpCall(client *http.Client, request *http.Request) (*http.Response
if err != nil {
return nil, fmt.Errorf("problem calling http loader url: %v", err)
} else if resp.StatusCode < 200 || resp.StatusCode > 499 {
+ resp.Body.Close()
return nil, fmt.Errorf("bad response status code from http loader url: %v", resp.StatusCode)
}
return resp, nil