reverseproxy: Accept integer values for flush_interval (fix #2996)

This commit is contained in:
Matthew Holt 2020-01-22 09:34:16 -07:00
parent 2105d59936
commit 5b878d5bd3
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5

View File

@ -335,11 +335,15 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if !d.NextArg() {
return d.ArgErr()
}
dur, err := time.ParseDuration(d.Val())
if err != nil {
return d.Errf("bad duration value '%s': %v", d.Val(), err)
if fi, err := strconv.Atoi(d.Val()); err == nil {
h.FlushInterval = caddy.Duration(fi)
} else {
dur, err := time.ParseDuration(d.Val())
if err != nil {
return d.Errf("bad duration value '%s': %v", d.Val(), err)
}
h.FlushInterval = caddy.Duration(dur)
}
h.FlushInterval = caddy.Duration(dur)
case "header_up":
if h.Headers == nil {
@ -511,7 +515,7 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
h.TLS = new(TLSConfig)
}
h.TLS.RootCAPemFiles = args
h.TLS.RootCAPEMFiles = args
case "keepalive":
if !d.NextArg() {