mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-13 23:10:25 +08:00
缓存条件增加"强制返回区间内容"选项
This commit is contained in:
@@ -241,10 +241,12 @@ func (this *HTTPRequest) doCacheRead(useStale bool) (shouldStop bool) {
|
||||
reader, err = storage.OpenReader(key, useStale, false)
|
||||
if err != nil && this.cacheRef.AllowPartialContent {
|
||||
// 尝试读取分片的缓存内容
|
||||
if len(rangeHeader) == 0 {
|
||||
if len(rangeHeader) == 0 && this.cacheRef.ForcePartialContent {
|
||||
// 默认读取开头
|
||||
rangeHeader = "bytes=0-"
|
||||
}
|
||||
|
||||
if len(rangeHeader) > 0 {
|
||||
pReader, ranges := this.tryPartialReader(storage, key, useStale, rangeHeader)
|
||||
if pReader != nil {
|
||||
isPartialCache = true
|
||||
@@ -253,6 +255,7 @@ func (this *HTTPRequest) doCacheRead(useStale bool) (shouldStop bool) {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == caches.ErrNotFound {
|
||||
|
||||
Reference in New Issue
Block a user