@marcel91200 / caddy Mirror · read-only / commits / bbe36631
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

caddyconfig: Fix httploader leak from unused responses (#5159)

fixes #5158 Signed-off-by: Chris Lahaye <mail@chrislahaye.com> Signed-off-by: Chris Lahaye <mail@chrislahaye.com>

Chris Lahaye committed Oct 24, 2022 at 19:58 UTC bbe366316771ea23381a473a528e71a72a7148a5
1 file changed +2 -2
caddyconfig/httploader.go
+2 -2
@@ -134,16 +134,16 @@ func doHttpCallWithRetries(ctx caddy.Context, client *http.Client, request *http
134 var err error
135 const maxAttempts = 10
136
137 - // attempt up to 10 times
137 for i := 0; i < maxAttempts; i++ {
138 resp, err = attemptHttpCall(client, request)
139 if err != nil && i < maxAttempts-1 {
141 - // wait 500ms before reattempting, or until context is done
140 select {
141 case <-time.After(time.Millisecond * 500):
142 case <-ctx.Done():
143 return resp, ctx.Err()
144 }
145 + } else {
146 + break
147 }
148 }
149