@marcel91200 / caddy Mirror · read-only / commits / 817470dd
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 09:15 UTC

httploader: Close resp body on bad status code

Related to #5158

Matthew Holt committed Oct 24, 2022 at 12:18 UTC 817470dd66edb22015651971e39f8ef183d7bf9d
1 file changed +1
caddyconfig/httploader.go
+1
@@ -124,6 +124,7 @@ func attemptHttpCall(client *http.Client, request *http.Request) (*http.Response
124 if err != nil {
125 return nil, fmt.Errorf("problem calling http loader url: %v", err)
126 } else if resp.StatusCode < 200 || resp.StatusCode > 499 {
127 + resp.Body.Close()
128 return nil, fmt.Errorf("bad response status code from http loader url: %v", resp.StatusCode)
129 }
130 return resp, nil