HttpServer: Make read timeout configurable but disabled by default (#31575)

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Carl Bergquist
2021-03-19 11:21:52 +01:00
committed by GitHub
parent fb337e5c1d
commit 862cd473eb
6 changed files with 29 additions and 2 deletions
+3 -2
View File
@@ -115,8 +115,9 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
// Remove any square brackets enclosing IPv6 addresses, a format we support for backwards compatibility
host := strings.TrimSuffix(strings.TrimPrefix(hs.Cfg.HTTPAddr, "["), "]")
hs.httpSrv = &http.Server{
Addr: net.JoinHostPort(host, hs.Cfg.HTTPPort),
Handler: hs.macaron,
Addr: net.JoinHostPort(host, hs.Cfg.HTTPPort),
Handler: hs.macaron,
ReadTimeout: hs.Cfg.ReadTimeout,
}
switch hs.Cfg.Protocol {
case setting.HTTP2Scheme: