parent
5e4b35e03a
commit
34c8655974
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -25,8 +26,13 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, proxy C.ProxyAdapter)
|
||||||
conn := newTrafficTrack(proxy.Conn(), t.traffic)
|
conn := newTrafficTrack(proxy.Conn(), t.traffic)
|
||||||
req := request.R
|
req := request.R
|
||||||
host := req.Host
|
host := req.Host
|
||||||
|
keepalive := true
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
if strings.ToLower(req.Header.Get("Connection")) == "close" {
|
||||||
|
keepalive = false
|
||||||
|
}
|
||||||
|
|
||||||
req.Header.Set("Connection", "close")
|
req.Header.Set("Connection", "close")
|
||||||
req.RequestURI = ""
|
req.RequestURI = ""
|
||||||
adapters.RemoveHopByHopHeaders(req.Header)
|
adapters.RemoveHopByHopHeaders(req.Header)
|
||||||
|
@ -53,6 +59,10 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, proxy C.ProxyAdapter)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !keepalive {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
req, err = http.ReadRequest(bufio.NewReader(request.Conn()))
|
req, err = http.ReadRequest(bufio.NewReader(request.Conn()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue