fix: request content_length

#486
This commit is contained in:
samwaf
2025-10-21 17:20:38 +08:00
parent 0c19b2c3b1
commit 3b7564aca0

View File

@@ -283,12 +283,5 @@ func (waf *WafEngine) decompressRequestContent(req *http.Request) ([]byte, error
return bodyBytes, fmt.Errorf("读取解压后的请求体失败: %v", readErr)
}
// 更新请求体为解压后的内容
req.Body = io.NopCloser(bytes.NewBuffer(decompressedBytes))
// 移除Content-Encoding头因为内容已经解压
req.Header.Del("Content-Encoding")
// 更新Content-Length
req.Header.Set("Content-Length", fmt.Sprintf("%d", len(decompressedBytes)))
return decompressedBytes, nil
}