aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-09-17 00:27:40 -0700
committerChris Lu <chris.lu@gmail.com>2018-09-17 00:27:40 -0700
commit865a0179369601e496d385e47bdbda93dcc3f243 (patch)
tree23309d1aabb0210227515090f2e62bec85c62915
parent97575e718549b960d3eeffc6f1a9f05803a01dc2 (diff)
downloadseaweedfs-865a0179369601e496d385e47bdbda93dcc3f243.tar.xz
seaweedfs-865a0179369601e496d385e47bdbda93dcc3f243.zip
fix when if buffer is not aligned
-rw-r--r--weed/util/http_util.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go
index 7b28d3d91..56c294f0d 100644
--- a/weed/util/http_util.go
+++ b/weed/util/http_util.go
@@ -129,11 +129,10 @@ func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachB
if r.StatusCode != 200 {
return fmt.Errorf("%s: %s", url, r.Status)
}
- bufferSize := len(allocatedBytes)
for {
n, err := r.Body.Read(allocatedBytes)
- if n == bufferSize {
- eachBuffer(allocatedBytes)
+ if n > 0 {
+ eachBuffer(allocatedBytes[:n])
}
if err != nil {
if err == io.EOF {