mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-05 01:20:26 +08:00
缓存设置中增加“支持分片内容”选项,用来支持Chunked内容
This commit is contained in:
@@ -304,7 +304,7 @@ func (this *HTTPWriter) prepareGzip(size int64) {
|
|||||||
|
|
||||||
// 准备缓存
|
// 准备缓存
|
||||||
func (this *HTTPWriter) prepareCache(size int64) {
|
func (this *HTTPWriter) prepareCache(size int64) {
|
||||||
if this.writer == nil || size <= 0 {
|
if this.writer == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,10 +319,16 @@ func (this *HTTPWriter) prepareCache(size int64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cacheRef := this.req.cacheRef
|
cacheRef := this.req.cacheRef
|
||||||
if cacheRef == nil ||
|
if cacheRef == nil || !cacheRef.IsOn {
|
||||||
!cacheRef.IsOn ||
|
return
|
||||||
(cacheRef.MaxSizeBytes() > 0 && size > cacheRef.MaxSizeBytes()) ||
|
}
|
||||||
(cachePolicy.MaxSizeBytes() > 0 && size > cachePolicy.MaxSizeBytes()) {
|
|
||||||
|
// 如果允许 ChunkedEncoding,就无需尺寸的判断,因为此时的 size 为 -1
|
||||||
|
if !cacheRef.AllowChunkedEncoding && size < 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if size >= 0 && ((cacheRef.MaxSizeBytes() > 0 && size > cacheRef.MaxSizeBytes()) ||
|
||||||
|
(cachePolicy.MaxSizeBytes() > 0 && size > cachePolicy.MaxSizeBytes())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user