do not trim big body buffers - they should be handled by GC

This commit is contained in:
Aliaksandr Valialkin
2015-11-14 21:13:04 +02:00
parent ac64d65324
commit 1c19e5f2c1
-13
View File
@@ -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