Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 02:00 UTC
requestbody: Fix ContentLength calculation after body replacement (#6896)
Steffen Busch committed
Mar 12, 2025 at 23:18 UTC
2ac09fdb2046957597e17096adf6335a6d589a2f
1 file changed
+1
-1
modules/caddyhttp/requestbody/requestbody.go
+1
-1
@@ -75,7 +75,7 @@ func (rb RequestBody) ServeHTTP(w http.ResponseWriter, r *http.Request, next cad
75
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
76
replacedBody := repl.ReplaceAll(rb.Set, "")
77
r.Body = io.NopCloser(strings.NewReader(replacedBody))
78
- r.ContentLength = int64(len(rb.Set))
78
+ r.ContentLength = int64(len(replacedBody))
79
}
80
if r.Body == nil {
81
return next.ServeHTTP(w, r)