mirror of
https://github.com/caddyserver/caddy.git
synced 2026-01-17 01:30:34 +00:00
reverseproxy: Fix overwriting of max_idle_conns_per_host (closes #4201)
Also split the Caddyfile subdirective keepalive_idle_conns into two properties so the conns and conns_per_host can be set separately. This is technically a breaking change, but probably anyone who this breaks already had a broken config anyway, and silently fixing it won't help them fix their configs.
This commit is contained in:
@@ -978,6 +978,18 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||
h.KeepAlive = new(KeepAlive)
|
||||
}
|
||||
h.KeepAlive.MaxIdleConns = num
|
||||
|
||||
case "keepalive_idle_conns_per_host":
|
||||
if !d.NextArg() {
|
||||
return d.ArgErr()
|
||||
}
|
||||
num, err := strconv.Atoi(d.Val())
|
||||
if err != nil {
|
||||
return d.Errf("bad integer value '%s': %v", d.Val(), err)
|
||||
}
|
||||
if h.KeepAlive == nil {
|
||||
h.KeepAlive = new(KeepAlive)
|
||||
}
|
||||
h.KeepAlive.MaxIdleConnsPerHost = num
|
||||
|
||||
case "versions":
|
||||
@@ -1004,16 +1016,6 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||
}
|
||||
h.MaxConnsPerHost = num
|
||||
|
||||
case "max_idle_conns_per_host":
|
||||
if !d.NextArg() {
|
||||
return d.ArgErr()
|
||||
}
|
||||
num, err := strconv.Atoi(d.Val())
|
||||
if err != nil {
|
||||
return d.Errf("bad integer value '%s': %v", d.Val(), err)
|
||||
}
|
||||
h.MaxIdleConnsPerHost = num
|
||||
|
||||
default:
|
||||
return d.Errf("unrecognized subdirective %s", d.Val())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user