summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-09-29 12:37:06 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-09-29 12:37:06 -0600
commit2a8c458ffedf886af9542541ea1b1de62370929d (patch)
treef0600e3cf254b3084e8e58eeaea0b54a8c4e48ef /modules
parent037dc23cad3848050dc1e6f4dfdabeb6ea190fa7 (diff)
reverseproxy: Parse humanized byte size (fix #5095)
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go4
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go
index f746ee5..f1f10d1 100644
--- a/modules/caddyhttp/reverseproxy/caddyfile.go
+++ b/modules/caddyhttp/reverseproxy/caddyfile.go
@@ -537,9 +537,9 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if !d.NextArg() {
return d.ArgErr()
}
- size, err := strconv.Atoi(d.Val())
+ size, err := humanize.ParseBytes(d.Val())
if err != nil {
- return d.Errf("invalid size (bytes): %s", d.Val())
+ return d.Errf("invalid byte size '%s': %v", d.Val(), err)
}
if d.NextArg() {
return d.ArgErr()
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 55d3aa8..f2ac942 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -783,7 +783,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
rw.WriteHeader(code)
// Clear headers coming from the backend
- // (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses)
+ // (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses
for k := range header {
delete(h, k)
}