Browse Source

close http request body

pull/1650/head
Chris Lu 4 years ago
parent
commit
141ce67c09
  1. 1
      weed/server/filer_server_handlers_write.go
  2. 5
      weed/util/http_util.go

1
weed/server/filer_server_handlers_write.go

@ -66,6 +66,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
) )
fs.autoChunk(ctx, w, r, so) fs.autoChunk(ctx, w, r, so)
util.CloseRequest(r)
} }

5
weed/util/http_util.go

@ -374,3 +374,8 @@ func CloseResponse(resp *http.Response) {
io.Copy(ioutil.Discard, resp.Body) io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close() resp.Body.Close()
} }
func CloseRequest(req *http.Request) {
io.Copy(ioutil.Discard, req.Body)
req.Body.Close()
}
Loading…
Cancel
Save