0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2025-01-06 22:40:34 -05:00

fixed tcp_mem resource leak when sending 304

This commit is contained in:
Wilrik 2018-07-06 16:36:06 +02:00 committed by Will Norris
parent 2ad861f4b0
commit 74c16f575e

View file

@ -315,12 +315,13 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
return nil, err
}
defer resp.Body.Close()
if should304(req, resp) {
// bare 304 response, full response will be used from cache
return &http.Response{StatusCode: http.StatusNotModified}, nil
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err