From ff8e2d60d05ee757ce7bf109819347ad9a64ae55 Mon Sep 17 00:00:00 2001 From: bakito Date: Sat, 23 Jul 2022 10:58:33 +0200 Subject: [PATCH] set header read timeout --- pkg/sync/http.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/sync/http.go b/pkg/sync/http.go index 9d51b27..f81e7e6 100644 --- a/pkg/sync/http.go +++ b/pkg/sync/http.go @@ -60,9 +60,10 @@ func (w *worker) listenAndServe() { r.Use(gin.BasicAuth(map[string]string{w.cfg.API.Username: w.cfg.API.Password})) } httpServer := &http.Server{ - Addr: fmt.Sprintf(":%d", w.cfg.API.Port), - Handler: r, - BaseContext: func(_ net.Listener) context.Context { return ctx }, + Addr: fmt.Sprintf(":%d", w.cfg.API.Port), + Handler: r, + BaseContext: func(_ net.Listener) context.Context { return ctx }, + ReadHeaderTimeout: 1 * time.Second, } r.SetHTMLTemplate(template.Must(template.New("index.html").Parse(string(index))))