mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 12:58:16 +03:00
set timeouts for webserver, for idle connections and reading http request header
This commit is contained in:
parent
00ea31f2f6
commit
9bd497b836
@ -512,6 +512,8 @@ func listen1(ip string, port int, tlsConfig *tls.Config, name string, kinds []st
|
|||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Handler: handler,
|
Handler: handler,
|
||||||
TLSConfig: tlsConfig,
|
TLSConfig: tlsConfig,
|
||||||
|
ReadHeaderTimeout: 30 * time.Second,
|
||||||
|
IdleTimeout: 65 * time.Second, // Chrome closes connections after 60 seconds, firefox after 115 seconds.
|
||||||
ErrorLog: golog.New(mlog.ErrWriter(xlog.Fields(mlog.Field("pkg", "net/http")), mlog.LevelInfo, protocol+" error"), "", 0),
|
ErrorLog: golog.New(mlog.ErrWriter(xlog.Fields(mlog.Field("pkg", "net/http")), mlog.LevelInfo, protocol+" error"), "", 0),
|
||||||
}
|
}
|
||||||
serve := func() {
|
serve := func() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user