filer, s3: add http status 206 as late as possible

fix https://github.com/chrislusf/seaweedfs/issues/1746
This commit is contained in:
Chris Lu
2021-01-14 02:59:40 -08:00
parent fd1d8a2a09
commit 698f58f7c4
3 changed files with 12 additions and 7 deletions

View File

@@ -158,8 +158,11 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
}
}
processRangeRequest(r, w, totalSize, mimeType, func(writer io.Writer, offset int64, size int64) error {
processRangeRequest(r, w, totalSize, mimeType, func(writer io.Writer, offset int64, size int64, httpStatusCode int) error {
if offset+size <= int64(len(entry.Content)) {
if httpStatusCode != 0 {
w.WriteHeader(httpStatusCode)
}
_, err := writer.Write(entry.Content[offset : offset+size])
return err
}