mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-18 16:37:38 +03:00
do not trim big body buffers - they should be handled by GC
This commit is contained in:
@@ -676,8 +676,6 @@ func (s *Server) serveConn(c net.Conn) error {
|
||||
}
|
||||
connectionClose = ctx.Request.Header.ConnectionClose || ctx.Response.Header.ConnectionClose
|
||||
|
||||
trimBigBuffers(ctx)
|
||||
|
||||
if br == nil || connectionClose {
|
||||
err = bw.Flush()
|
||||
releaseWriter(ctx, bw)
|
||||
@@ -722,17 +720,6 @@ func writeResponse(ctx *RequestCtx, w *bufio.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const bigBufferLimit = 16 * 1024
|
||||
|
||||
func trimBigBuffers(ctx *RequestCtx) {
|
||||
if cap(ctx.Request.Body) > bigBufferLimit {
|
||||
ctx.Request.Body = nil
|
||||
}
|
||||
if cap(ctx.Response.Body) > bigBufferLimit {
|
||||
ctx.Response.Body = nil
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
defaultReadBufferSize = 4096
|
||||
defaultWriteBufferSize = 4096
|
||||
|
||||
Reference in New Issue
Block a user