diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-03-11 12:34:55 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-03-11 12:34:55 -0700 |
commit | 3d616e8c6d65e5617f5a918d72fb1514c9c7144e (patch) | |
tree | c9d4625edc176dae528faf7cfebdd107089c4397 /modules/caddyhttp/replacer.go | |
parent | b82e22b459b9f81278810dc32916ca270efa888c (diff) |
requestbody: Return HTTP 413 (fix #4558)
Diffstat (limited to 'modules/caddyhttp/replacer.go')
-rw-r--r-- | modules/caddyhttp/replacer.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/modules/caddyhttp/replacer.go b/modules/caddyhttp/replacer.go index 26f7e0b..d3fa891 100644 --- a/modules/caddyhttp/replacer.go +++ b/modules/caddyhttp/replacer.go @@ -162,12 +162,8 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo // read the request body into a buffer (can't pool because we // don't know its lifetime and would have to make a copy anyway) buf := new(bytes.Buffer) - _, err := io.Copy(buf, req.Body) - if err != nil { - return "", true - } - // replace real body with buffered data - req.Body = io.NopCloser(buf) + _, _ = io.Copy(buf, req.Body) // can't handle error, so just ignore it + req.Body = io.NopCloser(buf) // replace real body with buffered data return buf.String(), true // original request, before any internal changes |