Handled possible short writes to httpResponseWriter (#1804)

* XL: Handled possible short writes to httpResponseWriter

* Added tests for Range Header combinations
This commit is contained in:
Krishnan Parthasarathi
2016-05-30 23:57:15 +05:30
committed by Harshavardhana
parent b466f27705
commit 967c2b2940
3 changed files with 30 additions and 20 deletions

View File

@@ -19,7 +19,7 @@ package main
import "errors"
// ReadFile - decoded erasure coded file.
func (e erasure) ReadFile(volume, path string, bufferOffset int64, startOffset int64, buffer []byte) (int64, error) {
func (e erasure) ReadFile(volume, path string, startOffset int64, buffer []byte) (int64, error) {
// Calculate the current encoded block size.
curEncBlockSize := getEncodedBlockLen(int64(len(buffer)), e.DataBlocks)
offsetEncOffset := getEncodedBlockLen(startOffset, e.DataBlocks)
@@ -89,7 +89,7 @@ func (e erasure) ReadFile(volume, path string, bufferOffset int64, startOffset i
}
// Copy data blocks.
copy(buffer, dataBlocks[bufferOffset:])
copy(buffer, dataBlocks)
// Relenquish memory.
dataBlocks = nil