From 23bb01a4df2f1296856d60228710ba315d478c9f Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sun, 3 Mar 2019 11:51:15 +0800 Subject: [PATCH] Fix: http request keepAlive with right http header --- tunnel/connection.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tunnel/connection.go b/tunnel/connection.go index 8b9832d..25c3656 100644 --- a/tunnel/connection.go +++ b/tunnel/connection.go @@ -25,12 +25,9 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) { conn := newTrafficTrack(outbound, t.traffic) req := request.R host := req.Host - keepalive := true for { - if strings.ToLower(req.Header.Get("Connection")) == "close" { - keepalive = false - } + keepAlive := strings.TrimSpace(strings.ToLower(req.Header.Get("Proxy-Connection"))) == "keep-alive" req.Header.Set("Connection", "close") req.RequestURI = "" @@ -58,7 +55,7 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) { break } - if !keepalive { + if !keepAlive { break }