aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorFred Cox <[email protected]>2023-10-11 09:42:40 +0100
committerGitHub <[email protected]>2023-10-11 04:42:40 -0400
commitb245ecd325428966ac4e4c208e268967d0e0cb83 (patch)
tree207f0937ad437e09542bf592d081ff182c62f783 /modules/caddyhttp
parent2a6859a5e46227473220c653668fa9da9f00b14e (diff)
downloadcaddy-b245ecd325428966ac4e4c208e268967d0e0cb83.tar.gz
caddy-b245ecd325428966ac4e4c208e268967d0e0cb83.zip
reverseproxy: fix parsing Caddyfile fails for unlimited request/response buffers (#5828)
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go
index 674776f87..533a82eba 100644
--- a/modules/caddyhttp/reverseproxy/caddyfile.go
+++ b/modules/caddyhttp/reverseproxy/caddyfile.go
@@ -551,17 +551,24 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if !d.NextArg() {
return d.ArgErr()
}
- size, err := humanize.ParseBytes(d.Val())
- if err != nil {
- return d.Errf("invalid byte size '%s': %v", d.Val(), err)
+ val := d.Val()
+ var size int64
+ if val == "unlimited" {
+ size = -1
+ } else {
+ usize, err := humanize.ParseBytes(val)
+ if err != nil {
+ return d.Errf("invalid byte size '%s': %v", val, err)
+ }
+ size = int64(usize)
}
if d.NextArg() {
return d.ArgErr()
}
if subdir == "request_buffers" {
- h.RequestBuffers = int64(size)
+ h.RequestBuffers = size
} else if subdir == "response_buffers" {
- h.ResponseBuffers = int64(size)
+ h.ResponseBuffers = size
}
// TODO: These three properties are deprecated; remove them sometime after v2.6.4