Skip to content

Commit

Permalink
Fix: http request keepAlive with right http header
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Mar 3, 2019
1 parent 0011c7a commit 23bb01a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tunnel/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -58,7 +55,7 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
break
}

if !keepalive {
if !keepAlive {
break
}

Expand Down

0 comments on commit 23bb01a

Please sign in to comment.