rpc: set timeouts for http server, see #16859

This commit is contained in:
Martin Holst Swende 2018-06-04 11:41:55 +02:00
parent 143c4341d8
commit 17f80cc2e2
No known key found for this signature in database
GPG Key ID: 683B438C05A5DDF0
1 changed files with 6 additions and 1 deletions

View File

@ -165,7 +165,12 @@ func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server {
// Wrap the CORS-handler within a host-handler
handler := newCorsHandler(srv, cors)
handler = newVHostHandler(vhosts, handler)
return &http.Server{Handler: handler}
return &http.Server{
Handler: handler,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
}
}
// ServeHTTP serves JSON-RPC requests over HTTP.