From 6024ae8d84c7486be7f7be3e1091f47d73008222 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 28 Dec 2015 20:27:14 +0100 Subject: set read/write timeout for web interface diff --git a/src/helsinki.at/rhimportd/ctrlWeb.go b/src/helsinki.at/rhimportd/ctrlWeb.go index 6b6568d..a786a23 100644 --- a/src/helsinki.at/rhimportd/ctrlWeb.go +++ b/src/helsinki.at/rhimportd/ctrlWeb.go @@ -28,6 +28,7 @@ import ( "helsinki.at/rhimport" "net/http" _ "net/http/pprof" + "time" ) type webHandler struct { @@ -46,5 +47,6 @@ func StartControlWeb(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDbCh http.Handle("/trusted/simple", webHandler{conf, rddb, true, webSimpleHandler}) rhl.Println("web-ctrl: listening on", addr_s) - http.ListenAndServe(addr_s, nil) // TODO: reader.Timeout, writer.Timeout??? + server := &http.Server{Addr: addr_s, ReadTimeout: 60 * time.Second, WriteTimeout: 60 * time.Second} + server.ListenAndServe() } -- cgit v0.10.2