From 044ed583b9977960b599d7ba1eca657115c50e14 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 3 Aug 2023 14:40:04 +0200 Subject: [PATCH] go: set global default {read,write} timeouts --- app/echoSettings.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/echoSettings.go b/app/echoSettings.go index 9f7ab40..e9f32b9 100644 --- a/app/echoSettings.go +++ b/app/echoSettings.go @@ -6,6 +6,7 @@ package app import ( "encoding/hex" "net/http" + "time" "github.com/gorilla/sessions" "github.com/labstack/echo-contrib/session" @@ -43,6 +44,10 @@ func (a *App) SetEchoSettings() { // }, // })) + // TODO: make this configurable. + e.Server.WriteTimeout = 30 * time.Second + e.Server.ReadHeaderTimeout = 30 * time.Second + if a.setting.HTTPRateLimitEnabled() { limit := rate.Limit(a.setting.HTTPRateLimit())