mirror of
https://github.com/caddyserver/caddy.git
synced 2026-01-16 17:20:34 +00:00
caddyhttp: Add server options keepalive_idle and keepalive_count (#7298)
* Add Server options KeepAliveIdle (keepalive_idle) and KeepAliveCount (keepalive_count) Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com> * Add Server option KeepAliveDisable (keepalive_disable) Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com> * Remove Server option KeepAliveDisable (keepalive_disable), disable when interval is negative Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com> * Add keepalive parameters to caddyfiletest Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com> --------- Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>
This commit is contained in:
@@ -538,6 +538,8 @@ func (app *App) Start() error {
|
||||
KeepAliveConfig: net.KeepAliveConfig{
|
||||
Enable: srv.KeepAliveInterval >= 0,
|
||||
Interval: time.Duration(srv.KeepAliveInterval),
|
||||
Idle: time.Duration(srv.KeepAliveIdle),
|
||||
Count: srv.KeepAliveCount,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -76,9 +76,25 @@ type Server struct {
|
||||
|
||||
// KeepAliveInterval is the interval at which TCP keepalive packets
|
||||
// are sent to keep the connection alive at the TCP layer when no other
|
||||
// data is being transmitted. The default is 15s.
|
||||
// data is being transmitted.
|
||||
// If zero, the default is 15s.
|
||||
// If negative, keepalive packets are not sent and other keepalive parameters
|
||||
// are ignored.
|
||||
KeepAliveInterval caddy.Duration `json:"keepalive_interval,omitempty"`
|
||||
|
||||
// KeepAliveIdle is the time that the connection must be idle before
|
||||
// the first TCP keep-alive probe is sent when no other data is being
|
||||
// transmitted.
|
||||
// If zero, the default is 15s.
|
||||
// If negative, underlying socket value is unchanged.
|
||||
KeepAliveIdle caddy.Duration `json:"keepalive_idle,omitempty"`
|
||||
|
||||
// KeepAliveCount is the maximum number of TCP keep-alive probes that
|
||||
// should be sent before dropping a connection.
|
||||
// If zero, the default is 9.
|
||||
// If negative, underlying socket value is unchanged.
|
||||
KeepAliveCount int `json:"keepalive_count,omitempty"`
|
||||
|
||||
// MaxHeaderBytes is the maximum size to parse from a client's
|
||||
// HTTP request headers.
|
||||
MaxHeaderBytes int `json:"max_header_bytes,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user