summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-28 19:27:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-28 19:27:14 (GMT)
commit6024ae8d84c7486be7f7be3e1091f47d73008222 (patch)
treeb2d0b264f124b4f2424495e22b27d0ca4298a52e
parent326e1353c0b7e0ac5e518d04e7fb5337036cf43d (diff)
set read/write timeout for web interface
-rw-r--r--src/helsinki.at/rhimportd/ctrlWeb.go4
1 files changed, 3 insertions, 1 deletions
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()
}