mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-14 06:46:27 +03:00
reverseproxy: Parse humanized byte size (fix #5095)
This commit is contained in:
parent
037dc23cad
commit
2a8c458ffe
2 changed files with 3 additions and 3 deletions
|
@ -537,9 +537,9 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
if !d.NextArg() {
|
if !d.NextArg() {
|
||||||
return d.ArgErr()
|
return d.ArgErr()
|
||||||
}
|
}
|
||||||
size, err := strconv.Atoi(d.Val())
|
size, err := humanize.ParseBytes(d.Val())
|
||||||
if err != nil {
|
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() {
|
if d.NextArg() {
|
||||||
return d.ArgErr()
|
return d.ArgErr()
|
||||||
|
|
|
@ -783,7 +783,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
|
||||||
rw.WriteHeader(code)
|
rw.WriteHeader(code)
|
||||||
|
|
||||||
// Clear headers coming from the backend
|
// 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 {
|
for k := range header {
|
||||||
delete(h, k)
|
delete(h, k)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue