mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix http range requests
This commit is contained in:
parent
72e1aff237
commit
6a5c037099
|
@ -63,7 +63,7 @@ public class SeaweedRead {
|
|||
if (!chunkView.isFullChunk) {
|
||||
request.setHeader(HttpHeaders.ACCEPT_ENCODING, "");
|
||||
request.setHeader(HttpHeaders.RANGE,
|
||||
String.format("bytes=%d-%d", chunkView.offset, chunkView.offset + chunkView.size));
|
||||
String.format("bytes=%d-%d", chunkView.offset, chunkView.offset + chunkView.size - 1));
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -196,7 +196,7 @@ func ReadUrl(fileUrl string, offset int64, size int, buf []byte, isReadRange boo
|
|||
return 0, err
|
||||
}
|
||||
if isReadRange {
|
||||
req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", offset, offset+int64(size)))
|
||||
req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", offset, offset+int64(size)-1))
|
||||
} else {
|
||||
req.Header.Set("Accept-Encoding", "gzip")
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ func ReadUrlAsStream(fileUrl string, offset int64, size int, fn func(data []byte
|
|||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", offset, offset+int64(size)))
|
||||
req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", offset, offset+int64(size)-1))
|
||||
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue