Skip to content

Commit

Permalink
reverseproxy: Make default buffer size const
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Aug 17, 2020
1 parent 0afbab8 commit c94f5bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/caddyhttp/reverseproxy/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (h Handler) copyResponse(dst io.Writer, src io.Reader, flushInterval time.D
// of bytes written.
func (h Handler) copyBuffer(dst io.Writer, src io.Reader, buf []byte) (int64, error) {
if len(buf) == 0 {
buf = make([]byte, 32*1024)
buf = make([]byte, defaultBufferSize)
}
var written int64
for {
Expand Down Expand Up @@ -252,6 +252,8 @@ func (c switchProtocolCopier) copyToBackend(errc chan<- error) {

var streamingBufPool = sync.Pool{
New: func() interface{} {
return make([]byte, 32*1024)
return make([]byte, defaultBufferSize)
},
}

const defaultBufferSize = 32 * 1024

0 comments on commit c94f5bb

Please sign in to comment.