From ee98006e9f26746eca48ceb376283d9af35347e4 Mon Sep 17 00:00:00 2001 From: Josh Chorlton Date: Thu, 4 Jan 2024 22:39:31 +0000 Subject: [PATCH] fix infinite recursion with idle timer --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f22e0cb12..9472701b8 100644 --- a/main.go +++ b/main.go @@ -253,9 +253,10 @@ func startHttpServer(c *config.Config, httpServer **http.Server, } if c.IdleTimeout > 0 { + ch := cacheHandler // Avoid an infinite loop in the closure below. cacheHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { idleTimer.ResetTimer() - cacheHandler(w, r) + ch(w, r) }) }