From 0a8a80e58374771acc225fe1e08ed8e0fe0016cc Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:09 +0000 Subject: Sync Author: jgg Date: 1998-10-22 04:56:38 GMT Sync --- apt-pkg/acquire-item.cc | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index e92b61181..e1049dde9 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-item.cc,v 1.2 1998/10/20 02:39:12 jgg Exp $ +// $Id: acquire-item.cc,v 1.3 1998/10/22 04:56:38 jgg Exp $ /* ###################################################################### Acquire Item - Item to acquire @@ -19,6 +19,9 @@ #include #include #include + +#include +#include /*}}}*/ // Acquire::Item::Item - Constructor /*{{{*/ @@ -45,23 +48,30 @@ pkgAcquire::Item::~Item() pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location) : Item(Owner), Location(Location) { - QueueURI(Location->PackagesURI() + ".gz"); - Description = Location->PackagesInfo(); + DestFile = _config->FindDir("Dir::State::lists") + "partial/"; + DestFile += URItoFileName(Location->PackagesURI()); + + QueueURI(Location->PackagesURI() + ".gz",Location->PackagesInfo()); + // Create the Release fetch class new pkgAcqIndexRel(Owner,Location); } /*}}}*/ -// pkgAcqIndex::ToFile - File to write the download to /*{{{*/ +// AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- -/* */ -string pkgAcqIndex::ToFile() +/* The only header we use is the last-modified header. */ +string pkgAcqIndex::Custom600Headers() { - string PartialDir = _config->FindFile("Dir::State::lists") + "/partial/"; + string Final = _config->FindDir("Dir::State::lists"); + Final += URItoFileName(Location->PackagesURI()); + + struct stat Buf; + if (stat(Final.c_str(),&Buf) != 0) + return string(); - return PartialDir + URItoFileName(Location->PackagesURI()); + return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ - // AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/ // --------------------------------------------------------------------- /* The Release file is added to the queue */ @@ -69,17 +79,24 @@ pkgAcqIndexRel::pkgAcqIndexRel(pkgAcquire *Owner, const pkgSourceList::Item *Location) : Item(Owner), Location(Location) { - QueueURI(Location->ReleaseURI()); - Description = Location->ReleaseInfo(); + DestFile = _config->FindDir("Dir::State::lists") + "partial/"; + DestFile += URItoFileName(Location->ReleaseURI()); + + QueueURI(Location->ReleaseURI(),Location->ReleaseInfo()); } /*}}}*/ -// AcqIndexRel::ToFile - File to write the download to /*{{{*/ +// AcqIndexRel::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- -/* */ -string pkgAcqIndexRel::ToFile() +/* The only header we use is the last-modified header. */ +string pkgAcqIndexRel::Custom600Headers() { - string PartialDir = _config->FindFile("Dir::State::lists") + "/partial/"; + string Final = _config->FindDir("Dir::State::lists"); + Final += URItoFileName(Location->ReleaseURI()); + + struct stat Buf; + if (stat(Final.c_str(),&Buf) != 0) + return string(); - return PartialDir + URItoFileName(Location->ReleaseURI()); + return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ -- cgit v1.2.3