From f2dbabeaa06a5405062418cfe865290612409427 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Fri, 31 Aug 2018 21:24:10 +0800 Subject: [PATCH] Fix: close connection when response closed --- tunnel/connection.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tunnel/connection.go b/tunnel/connection.go index 581ca1ac..27a24a42 100644 --- a/tunnel/connection.go +++ b/tunnel/connection.go @@ -36,7 +36,10 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, proxy C.ProxyAdapter) } else { resp.Close = true } - resp.Write(request.Conn()) + err = resp.Write(request.Conn()) + if err != nil || resp.Close { + break + } req, err = http.ReadRequest(bufio.NewReader(request.Conn())) if err != nil {