summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-08-02 19:23:41 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-08-02 19:23:41 +0200
commit4c49961112370b869c3c7db61793bb899c709c09 (patch)
treeceaa2fff40418026a670d910dbba26ec36484074 /apt-pkg/acquire-item.cc
parentfdd71c58de908ac6ad254b8294a7d8c47a60205c (diff)
* methods/https.cc:
- only send i-m-s if last-modified is > 0 - instead of resume send a range: if-range: custom header - merge 304 detection patch from thom may (thanks!) * apt-pkg/acquire-item.cc: - remove empty files on i-m-s hits from partial/
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 8ec4ba2c0..bc6d8cead 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -263,8 +263,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";
@@ -283,7 +285,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;
@@ -520,18 +525,19 @@ 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;
}