mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-04 22:55:48 +08:00
缓存写入结束时检查Content-Length是否和实际内容长度一致
This commit is contained in:
@@ -136,6 +136,13 @@ func (this *FileWriter) Close() error {
|
||||
|
||||
var path = this.rawWriter.Name()
|
||||
|
||||
// check content length
|
||||
if this.metaBodySize > 0 && this.bodySize != this.metaBodySize {
|
||||
_ = this.rawWriter.Close()
|
||||
_ = os.Remove(path)
|
||||
return ErrUnexpectedContentLength
|
||||
}
|
||||
|
||||
err := this.WriteHeaderLength(types.Int(this.headerSize))
|
||||
if err != nil {
|
||||
fsutils.WriteBegin()
|
||||
|
||||
Reference in New Issue
Block a user