git » gofer » commit 6b0c630

http: Add server-side timeouts

author Alberto Bertogli
2020-04-26 02:54:29 UTC
committer Alberto Bertogli
2020-04-26 09:21:50 UTC
parent 35685dd9332cd2e95cead4b4d62970079a3a5885

http: Add server-side timeouts

proxy/http.go +4 -1

diff --git a/proxy/http.go b/proxy/http.go
index 78a26e6..9e29b8e 100644
--- a/proxy/http.go
+++ b/proxy/http.go
@@ -6,6 +6,7 @@ import (
 	"net/http/httputil"
 	"net/url"
 	"strings"
+	"time"
 
 	"blitiri.com.ar/go/gofer/config"
 	"blitiri.com.ar/go/gofer/trace"
@@ -17,7 +18,9 @@ import (
 func httpServer(conf config.HTTP) *http.Server {
 	srv := &http.Server{
 		Addr: conf.Addr,
-		// TODO: timeouts.
+
+		ReadTimeout:  30 * time.Second,
+		WriteTimeout: 30 * time.Second,
 	}
 
 	// Load route table.