From 7d31c0641b97b86904489472b5201583417fe043 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 28 Dec 2016 00:58:53 +0100 Subject: [PATCH] fix lint warnings --- proxy/freedom/freedom.go | 5 ++++- proxy/http/server.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index e5290e3f..cacbea32 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -96,7 +96,10 @@ func (v *Handler) Dispatch(destination v2net.Destination, payload *buf.Buffer, r output := ray.OutboundOutput() if !payload.IsEmpty() { - conn.Write(payload.Bytes()) + if _, err := conn.Write(payload.Bytes()); err != nil { + log.Warning("Freedom: Failed to write to destination: ", destination, ": ", err) + return + } } go func() { diff --git a/proxy/http/server.go b/proxy/http/server.go index 49f409fc..30cfec08 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -223,7 +223,7 @@ func (v *Server) GenerateResponse(statusCode int, status string) *http.Response Header: hdr, Body: nil, ContentLength: 0, - Close: false, + Close: true, } } @@ -247,6 +247,8 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn go func() { defer finish.Done() requestWriter := bufio.NewWriter(buf.NewBytesWriter(ray.InboundInput())) + defer requestWriter.Release() + err := request.Write(requestWriter) if err != nil { log.Warning("HTTP: Failed to write request: ", err)