HttpWriter暴露两个方法/默认Buffer为4K

This commit is contained in:
GoEdgeLab
2022-03-24 21:42:03 +08:00
parent ee8bafd98d
commit 69e62acfab
2 changed files with 24 additions and 0 deletions

View File

@@ -1584,6 +1584,9 @@ func (this *HTTPRequest) addError(err error) {
// 计算合适的buffer size
func (this *HTTPRequest) bytePool(contentLength int64) *utils.BytePool {
if contentLength < 0 {
return utils.BytePool4k
}
if contentLength < 8192 { // 8K
return utils.BytePool1k
}