Fix: HTTP inbound proxy can't close correctly
This commit is contained in:
parent
d4ea12f7f9
commit
ba7dd209fc
1 changed files with 1 additions and 1 deletions
|
@ -35,7 +35,6 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
|
||||||
adapters.RemoveHopByHopHeaders(resp.Header)
|
adapters.RemoveHopByHopHeaders(resp.Header)
|
||||||
|
|
||||||
if resp.StatusCode == http.StatusContinue {
|
if resp.StatusCode == http.StatusContinue {
|
||||||
|
@ -59,6 +58,7 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// even if resp.Write write body to the connection, but some http request have to Copy to close it
|
||||||
buf := pool.BufPool.Get().([]byte)
|
buf := pool.BufPool.Get().([]byte)
|
||||||
_, err = io.CopyBuffer(request, resp.Body, buf)
|
_, err = io.CopyBuffer(request, resp.Body, buf)
|
||||||
pool.BufPool.Put(buf[:cap(buf)])
|
pool.BufPool.Put(buf[:cap(buf)])
|
||||||
|
|
Loading…
Reference in a new issue