]>
git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: acquire-item.cc,v 1.3 1998/10/22 04:56:38 jgg Exp $
4 /* ######################################################################
6 Acquire Item - Item to acquire
8 Each item can download to exactly one file at a time. This means you
9 cannot create an item that fetches two uri's to two files at the same
10 time. The pkgAcqIndex class creates a second class upon instantiation
11 to fetch the other index files because of this.
13 ##################################################################### */
15 // Include Files /*{{{*/
17 #pragma implementation "apt-pkg/acquire-item.h"
19 #include <apt-pkg/acquire-item.h>
20 #include <apt-pkg/configuration.h>
27 // Acquire::Item::Item - Constructor /*{{{*/
28 // ---------------------------------------------------------------------
30 pkgAcquire::Item::Item(pkgAcquire
*Owner
) : Owner(Owner
), QueueCounter(0)
35 // Acquire::Item::~Item - Destructor /*{{{*/
36 // ---------------------------------------------------------------------
38 pkgAcquire::Item::~Item()
44 // AcqIndex::AcqIndex - Constructor /*{{{*/
45 // ---------------------------------------------------------------------
46 /* The package file is added to the queue and a second class is
47 instantiated to fetch the revision file */
48 pkgAcqIndex::pkgAcqIndex(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
) :
49 Item(Owner
), Location(Location
)
51 DestFile
= _config
->FindDir("Dir::State::lists") + "partial/";
52 DestFile
+= URItoFileName(Location
->PackagesURI());
54 QueueURI(Location
->PackagesURI() + ".gz",Location
->PackagesInfo());
56 // Create the Release fetch class
57 new pkgAcqIndexRel(Owner
,Location
);
60 // AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/
61 // ---------------------------------------------------------------------
62 /* The only header we use is the last-modified header. */
63 string
pkgAcqIndex::Custom600Headers()
65 string Final
= _config
->FindDir("Dir::State::lists");
66 Final
+= URItoFileName(Location
->PackagesURI());
69 if (stat(Final
.c_str(),&Buf
) != 0)
72 return "\nLast-Modified: " + TimeRFC1123(Buf
.st_mtime
);
75 // AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/
76 // ---------------------------------------------------------------------
77 /* The Release file is added to the queue */
78 pkgAcqIndexRel::pkgAcqIndexRel(pkgAcquire
*Owner
,
79 const pkgSourceList::Item
*Location
) :
80 Item(Owner
), Location(Location
)
82 DestFile
= _config
->FindDir("Dir::State::lists") + "partial/";
83 DestFile
+= URItoFileName(Location
->ReleaseURI());
85 QueueURI(Location
->ReleaseURI(),Location
->ReleaseInfo());
88 // AcqIndexRel::Custom600Headers - Insert custom request headers /*{{{*/
89 // ---------------------------------------------------------------------
90 /* The only header we use is the last-modified header. */
91 string
pkgAcqIndexRel::Custom600Headers()
93 string Final
= _config
->FindDir("Dir::State::lists");
94 Final
+= URItoFileName(Location
->ReleaseURI());
97 if (stat(Final
.c_str(),&Buf
) != 0)
100 return "\nLast-Modified: " + TimeRFC1123(Buf
.st_mtime
);