优化代码

This commit is contained in:
刘祥超
2024-04-15 12:20:31 +08:00
parent e0bed33cc5
commit 64a186b0e7
3 changed files with 19 additions and 11 deletions

View File

@@ -119,7 +119,9 @@ func (this *Post307Action) Perform(waf *WAF, group *RuleGroup, set *RuleSet, req
// 清空请求内容
var req = request.WAFRaw()
if req.ContentLength > 0 && req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
var buf = utils.BytePool16k.Get()
_, _ = io.CopyBuffer(io.Discard, req.Body, buf.Bytes)
utils.BytePool16k.Put(buf)
_ = req.Body.Close()
}