优化字节缓冲区相关代码

This commit is contained in:
刘祥超
2024-04-15 09:26:00 +08:00
parent 4bdd248f99
commit 5e7ea9a884
15 changed files with 243 additions and 57 deletions

View File

@@ -118,11 +118,11 @@ func (this *BlockAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, reque
}
}
buf := utils.BytePool1k.Get()
_, _ = io.CopyBuffer(writer, resp.Body, buf)
var buf = utils.BytePool1k.Get()
_, _ = io.CopyBuffer(writer, resp.Body, buf.Bytes)
utils.BytePool1k.Put(buf)
} else {
path := this.URL
var path = this.URL
if !filepath.IsAbs(this.URL) {
path = Tea.Root + string(os.PathSeparator) + path
}