修复WebP缓存长度可能不正确的问题

This commit is contained in:
刘祥超
2021-10-01 17:20:37 +08:00
parent 96c63300f4
commit b320d2dc58
2 changed files with 41 additions and 35 deletions

View File

@@ -193,6 +193,7 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) {
this.writer.WriteHeader(http.StatusNotModified)
this.isCached = true
this.cacheRef = nil
this.writer.SetOk()
return true
}
@@ -203,6 +204,7 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) {
this.writer.WriteHeader(http.StatusNotModified)
this.isCached = true
this.cacheRef = nil
this.writer.SetOk()
return true
}
@@ -349,7 +351,6 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) {
}
} else { // 没有Range
this.writer.PrepareCompression(reader.BodySize())
this.writer.WriteHeader(reader.Status())
err = reader.ReadBody(buf, func(n int) (goNext bool, err error) {
@@ -370,5 +371,8 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) {
this.isCached = true
this.cacheRef = nil
this.writer.SetOk()
return true
}