From 72f1131e1c45c4953c2ac07d825ffb64edf56e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 6 May 2022 14:27:07 +0200 Subject: [PATCH] Manager: set HTTP Read Header timeout Only the `ReadHeaderTimeout` is set. `ReadTimeout` is not set, as this is quite specific per request. Shaman file uploads and websocket connections should be allowed to run quite long, whereas other queries should be relatively short. --- cmd/flamenco-manager/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/flamenco-manager/main.go b/cmd/flamenco-manager/main.go index 618441a9..1862724d 100644 --- a/cmd/flamenco-manager/main.go +++ b/cmd/flamenco-manager/main.go @@ -165,6 +165,16 @@ func buildWebService( e := echo.New() e.HideBanner = true + // The request should come in fairly quickly, given that Flamenco is intended + // to run on a local network. + e.Server.ReadHeaderTimeout = 1 * time.Second + // e.Server.ReadTimeout is not set, as this is quite specific per request. + // Shaman file uploads and websocket connections should be allowed to run + // quite long, whereas other queries should be relatively short. + // + // See https://github.com/golang/go/issues/16100 for more info about current + // limitations in Go that get in our way here. + // Hook Zerolog onto Echo: e.Use(lecho.Middleware(lecho.Config{ Logger: lecho.From(log.Logger),