From 33ba08be7724e2c28a38d84818c5c7a0d12af43b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 18 Apr 2017 14:24:34 +0200 Subject: [PATCH] reduce buffer size for http header reading --- proxy/http/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/http/server.go b/proxy/http/server.go index 22fd5d124..a7d777cf3 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -74,7 +74,7 @@ func isTimeout(err error) bool { } func (s *Server) Process(ctx context.Context, network v2net.Network, conn internet.Connection, dispatcher dispatcher.Interface) error { - reader := bufio.NewReaderSize(conn, 8192) + reader := bufio.NewReaderSize(conn, 2048) Start: conn.SetReadDeadline(time.Now().Add(time.Second * 16)) @@ -234,7 +234,7 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, rea }) responseDone := signal.ExecuteAsync(func() error { - responseReader := bufio.NewReaderSize(buf.ToBytesReader(ray.InboundOutput()), 8192) + responseReader := bufio.NewReaderSize(buf.ToBytesReader(ray.InboundOutput()), 2048) response, err := http.ReadResponse(responseReader, request) if err == nil { StripHopByHopHeaders(response.Header)