Fix: HTTP proxy should copy body

This commit is contained in:
Dreamacro 2019-10-26 22:12:33 +08:00
parent 65f4a35e7f
commit 52cfa94652

View File

@ -36,6 +36,7 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
if err != nil {
break
}
defer resp.Body.Close()
adapters.RemoveHopByHopHeaders(resp.Header)
if resp.StatusCode == http.StatusContinue {
@ -59,6 +60,13 @@ func (t *Tunnel) handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
break
}
buf := pool.BufPool.Get().([]byte)
_, err = io.CopyBuffer(request, resp.Body, buf)
pool.BufPool.Put(buf[:cap(buf)])
if err != nil && err != io.EOF {
break
}
req, err = http.ReadRequest(inboundReeder)
if err != nil {
break