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

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit 862cd473eb)
This commit is contained in:
Carl Bergquist
2021-03-19 12:01:37 +01:00
committed by GitHub
parent 1df1d60e1e
commit 5039c90b8c
6 changed files with 31 additions and 2 deletions
+3 -2
View File
@@ -107,8 +107,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(setting.HttpAddr, "["), "]")
hs.httpSrv = &http.Server{
Addr: net.JoinHostPort(host, setting.HttpPort),
Handler: hs.macaron,
Addr: net.JoinHostPort(host, setting.HttpPort),
Handler: hs.macaron,
ReadTimeout: hs.Cfg.ReadTimeout,
}
switch hs.Cfg.Protocol {
case setting.HTTP2Scheme: