diff options
-rw-r--r-- | apt-pkg/acquire-item.cc | 16 | ||||
-rwxr-xr-x | test/integration/test-apt-update-stale | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 2c081261d..6444a21b3 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1731,6 +1731,9 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire * const Owner, /* The only header we use is the last-modified header. */ string pkgAcqDiffIndex::Custom600Headers() const { + if (TransactionManager->LastMetaIndexParser != NULL) + return "\nIndex-File: true"; + string const Final = GetFinalFilename(); if(Debug) @@ -2566,12 +2569,17 @@ void pkgAcqIndex::Init(string const &URI, string const &URIDesc, /* The only header we use is the last-modified header. */ string pkgAcqIndex::Custom600Headers() const { - string Final = GetFinalFilename(); string msg = "\nIndex-File: true"; - struct stat Buf; - if (stat(Final.c_str(),&Buf) == 0) - msg += "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); + + if (TransactionManager->LastMetaIndexParser == NULL) + { + std::string const Final = GetFinalFilename(); + + struct stat Buf; + if (stat(Final.c_str(),&Buf) == 0) + msg += "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); + } if(Target.IsOptional) msg += "\nFail-Ignore: true"; diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale index fd5ec8214..c01a2a1d4 100755 --- a/test/integration/test-apt-update-stale +++ b/test/integration/test-apt-update-stale @@ -39,6 +39,6 @@ cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \ aptarchive/dists/unstable/main/binary-i386/ # ensure this raises an error -testfailuremsg "W: Failed to fetch copy:$(readlink -f ./rootdir)/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_binary-i386_Packages Hash Sum mismatch +testfailuremsg "W: Failed to fetch http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-i386/Packages.gz Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 testfileequal lists.before "$(listcurrentlistsdirectory)" |