issue0016: fix download error with big file

if the server do not support range/rest, when download a big file, the memory alloc onec time, that will case failed,
so write when cache failed

Change-Id: Id82956ed1810556917194bcedf79c089dd9a8dbf