internal/tun2: relay stream body with closer

This commit is contained in:
Cadey Ratio 2017-12-12 10:00:04 -08:00
parent c2fbaa9da9
commit 9bb2d4f436
1 changed files with 0 additions and 11 deletions

View File

@ -2,10 +2,8 @@ package tun2
import (
"bufio"
"bytes"
"context"
"expvar"
"io/ioutil"
"net"
"net/http"
"time"
@ -143,15 +141,6 @@ func (c *Connection) RoundTrip(req *http.Request) (*http.Response, error) {
if err != nil {
return nil, errors.Wrap(err, ErrCantReadResponse.Error())
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, errors.Wrap(err, "can't read response body")
}
resp.Body = ioutil.NopCloser(bytes.NewBuffer(body))
resp.ContentLength = int64(len(body))
c.counter.Add(1)