summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-08-17 10:47:53 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-08-17 16:17:16 -0600
commitc94f5bb7dd3c98d6573c44f06d99c7252911a9fa (patch)
tree13b49c5444b3e3ef7f0e887b7339da70880587dd
parent0afbab866794448fc0fe8b6cd6a299d7a078c2f1 (diff)
reverseproxy: Make default buffer size const
-rw-r--r--modules/caddyhttp/reverseproxy/streaming.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/caddyhttp/reverseproxy/streaming.go b/modules/caddyhttp/reverseproxy/streaming.go
index 127c0f0..666cf48 100644
--- a/modules/caddyhttp/reverseproxy/streaming.go
+++ b/modules/caddyhttp/reverseproxy/streaming.go
@@ -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 {
@@ -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