From 4c49961112370b869c3c7db61793bb899c709c09 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 2 Aug 2007 19:23:41 +0200 Subject: * 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/ --- apt-pkg/acquire-item.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'apt-pkg') 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; } -- cgit v1.2.3-70-g09d2