Skip to content

Commit 549d9d4

Browse files
committed
- use io.ReadFull instead of iouutil.ReadAll in HTTP based pipelines.
1 parent 44c473f commit 549d9d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sources/http.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package sources
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"log"
66
"strconv"
77
"strings"
@@ -38,7 +38,7 @@ func newHTTPSource(sourceListManager objectListManager, pipelineFactory sourceHT
3838
}
3939

4040
if numOfFilePerPipeline <= 0 {
41-
return nil , fmt.Errorf("Invalid operation. The number of files per batch must be greater than zero")
41+
return nil, fmt.Errorf("Invalid operation. The number of files per batch must be greater than zero")
4242
}
4343

4444
numOfBatches := (len(sourceInfos) + numOfFilePerPipeline - 1) / numOfFilePerPipeline
@@ -205,7 +205,9 @@ func (f *HTTPPipeline) ExecuteReader(partitionsQ chan pipeline.PartsPartition, p
205205

206206
return err
207207
}
208-
p.Data, err = ioutil.ReadAll(res.Body)
208+
//p.Data, err = ioutil.ReadAll(res.Body)
209+
_, err = io.ReadFull(res.Body, p.Data[:p.BytesToRead])
210+
209211
res.Body.Close()
210212
if err != nil {
211213
return err

0 commit comments

Comments
 (0)