mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-16 07:46:36 +08:00
Partial Content从源站读取数据时验证本地缓存的Content-MD5是否一致
This commit is contained in:
@@ -403,6 +403,11 @@ func (this *HTTPWriter) PrepareCache(resp *http.Response, size int64) {
|
||||
return
|
||||
}
|
||||
partialWriter.SetBodyLength(total)
|
||||
|
||||
var contentMD5 = this.rawWriter.Header().Get("Content-MD5")
|
||||
if len(contentMD5) > 0 {
|
||||
partialWriter.SetContentMD5(contentMD5)
|
||||
}
|
||||
}
|
||||
var filterReader = readers.NewFilterReaderCloser(resp.Body)
|
||||
this.cacheIsFinished = true
|
||||
@@ -462,6 +467,11 @@ func (this *HTTPWriter) PrepareCache(resp *http.Response, size int64) {
|
||||
// 写入total
|
||||
if !writtenTotal && total > 0 {
|
||||
partialWriter.SetBodyLength(total)
|
||||
var contentMD5 = this.rawWriter.Header().Get("Content-MD5")
|
||||
if len(contentMD5) > 0 {
|
||||
partialWriter.SetContentMD5(contentMD5)
|
||||
}
|
||||
|
||||
writtenTotal = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user