Skip to content

Commit 39a380d

Browse files
committed
fix(caching): update end range calculation to use ObjectSize from Content-Range instead of Content-Length
1 parent 5b99300 commit 39a380d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/middleware/caching/caching_fillrange.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ func (f *fillRange) PostRequest(c *Caching, req *http.Request, resp *http.Respon
9595
}
9696

9797
// 修正填充的 end 数据范围
98+
// 从 Content-Range 取 ObjectSize 而不是 Content-Length
9899
newEnd := (fill.newEnd - fill.newStart)
99-
if newEnd > int(resp.ContentLength) {
100-
fill.newEnd = fill.newStart + int(resp.ContentLength) - 1
100+
if newEnd > int(cr.ObjSize) {
101+
fill.newEnd = fill.newStart + int(cr.ObjSize) - 1
101102
}
102103
if fill.rawEnd > fill.newEnd {
103104
fill.rawEnd = fill.newEnd

0 commit comments

Comments
 (0)