diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-04-14 23:28:24 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-04-14 23:28:24 -0700 |
| commit | e85048bcdc7a56c0ec9353f0459737481eb1c48d (patch) | |
| tree | 1e76d79adc992068e8f88064805aac06ad6e33ba /weed/operation/chunked_file.go | |
| parent | 3e8a3a8fec6df5b39b6b2b4603df8bc183d90aa8 (diff) | |
| download | seaweedfs-e85048bcdc7a56c0ec9353f0459737481eb1c48d.tar.xz seaweedfs-e85048bcdc7a56c0ec9353f0459737481eb1c48d.zip | |
http exhaust and close response body
Diffstat (limited to 'weed/operation/chunked_file.go')
| -rw-r--r-- | weed/operation/chunked_file.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/operation/chunked_file.go b/weed/operation/chunked_file.go index f3f6e7b00..995f06b53 100644 --- a/weed/operation/chunked_file.go +++ b/weed/operation/chunked_file.go @@ -6,6 +6,7 @@ import ( "fmt" "google.golang.org/grpc" "io" + "io/ioutil" "net/http" "sort" @@ -103,7 +104,10 @@ func readChunkNeedle(fileUrl string, w io.Writer, offset int64) (written int64, if err != nil { return written, err } - defer resp.Body.Close() + defer func() { + io.Copy(ioutil.Discard, resp.Body) + resp.Body.Close() + }() switch resp.StatusCode { case http.StatusRequestedRangeNotSatisfiable: |
