Browse Source

fix when if buffer is not aligned

pull/747/head
Chris Lu 6 years ago
parent
commit
865a017936
  1. 5
      weed/util/http_util.go

5
weed/util/http_util.go

@ -129,11 +129,10 @@ func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachB
if r.StatusCode != 200 { if r.StatusCode != 200 {
return fmt.Errorf("%s: %s", url, r.Status) return fmt.Errorf("%s: %s", url, r.Status)
} }
bufferSize := len(allocatedBytes)
for { for {
n, err := r.Body.Read(allocatedBytes) n, err := r.Body.Read(allocatedBytes)
if n == bufferSize {
eachBuffer(allocatedBytes)
if n > 0 {
eachBuffer(allocatedBytes[:n])
} }
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {

Loading…
Cancel
Save