summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-08-03 10:22:24 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-08-03 10:22:24 +0200
commitb84fa7158d04f8b2136f01dda106ba0272027887 (patch)
tree0a6838b64e5717b6370652b0dc1ee8356ffae12f /apt-pkg/acquire-item.cc
parenta1e9299a9485a219f3a1e3736b1cec21aa24577f (diff)
parent4c49961112370b869c3c7db61793bb899c709c09 (diff)
* apt-pkg/acquire-item.cc:
- remove zero size files on I-M-S hit * methods/https.cc: - only send LastModified if we actually have one - send range request with if-range - delete failed downloads
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 6d71b6ea3..4f5d644ab 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -688,8 +688,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
{
// The files timestamp matches
if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
-
+ }
Decompression = true;
Local = true;
DestFile += ".decomp";
@@ -708,7 +710,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
+ }
if (FileName == DestFile)
Erase = true;
@@ -980,18 +985,18 @@ void pkgAcqMetaIndex::RetrievalDone(string Message)
// see if the download was a IMSHit
IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false);
-
Complete = true;
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
- // The files timestamp matches
- if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == false)
- {
- // Move it into position
+ // If we get a IMS hit we can remove the empty file in partial
+ // othersie we move the file in place
+ if (IMSHit)
+ unlink(DestFile.c_str());
+ else
Rename(DestFile,FinalFile);
- }
+
chmod(FinalFile.c_str(),0644);
DestFile = FinalFile;
}