Skip to content

Commit 95c7960

Browse files
foobarTristan Su
authored and
Tristan Su
committed
feat(httpd): configurable http read timeout
HTTP read timeout is useful to avoid half-open connections due to bad network. See #15410.
1 parent 24f9f05 commit 95c7960

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

services/httpd/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type Config struct {
6464
MaxEnqueuedWriteLimit int `toml:"max-enqueued-write-limit"`
6565
EnqueuedWriteTimeout time.Duration `toml:"enqueued-write-timeout"`
6666
TLS *tls.Config `toml:"-"`
67+
ReadTimeout time.Duration `toml:"read-timeout"`
6768
}
6869

6970
// NewConfig returns a new Config with default settings.

services/httpd/service.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ func NewService(c Config) *Service {
8787
bindSocket: c.BindSocket,
8888
Handler: handler,
8989
httpServer: http.Server{
90-
Handler: handler,
90+
Handler: handler,
91+
ReadTimeout: c.ReadTimeout,
9192
},
9293
Logger: zap.NewNop(),
9394
}

0 commit comments

Comments
 (0)