diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-22 09:34:16 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-22 09:34:16 -0700 |
commit | 5b878d5bd36a6628095997c4f32e7df5366621f7 (patch) | |
tree | 4b24ca049812be627f40fc15b281a58e9a7ddbab /modules | |
parent | 2105d59936039f6ddbe3214711d160e1804523a0 (diff) |
reverseproxy: Accept integer values for flush_interval (fix #2996)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/reverseproxy/caddyfile.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index 99b6bfe..f29050f 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -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() { |