From 74327ea8aec3b23ec43a5c3f944d7c8877266615 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 24 Nov 2017 23:24:12 +0100 Subject: [PATCH] prevent using net.Conn.WriteTo() --- proxy/http/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxy/http/server.go b/proxy/http/server.go index ab96f731..5d472d66 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -86,8 +86,12 @@ func parseBasicAuth(auth string) (username, password string, ok bool) { return cs[:s], cs[s+1:], true } +type readerOnly struct { + io.Reader +} + func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher dispatcher.Interface) error { - reader := bufio.NewReaderSize(conn, buf.Size) + reader := bufio.NewReaderSize(readerOnly{conn}, buf.Size) Start: conn.SetReadDeadline(time.Now().Add(time.Second * 16))