From c6c365089ca1e81b857622bbc0441a6bef4469c1 Mon Sep 17 00:00:00 2001 From: Lucas Rodriguez Date: Sun, 6 Oct 2024 12:11:24 -0500 Subject: [PATCH] Add ReadTimeout and WriteTimeout to HTTP server Signed-off-by: Lucas Rodriguez --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 6a98f14..d73503a 100644 --- a/main.go +++ b/main.go @@ -58,8 +58,10 @@ func main() { limitedMux := rl.Limit(mux) server := &http.Server{ - Addr: "0.0.0.0:8080", - Handler: limitedMux, + Addr: "0.0.0.0:8080", + Handler: limitedMux, + ReadTimeout: 5 * time.Second, + WriteTimeout: 5 * time.Second, } shutdown := make(chan os.Signal, 1)