* [ Abi break ] apt-pkg/acquire-item.{cc,h}:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 28 Apr 2010 07:41:44 +0000 (09:41 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 28 Apr 2010 07:41:44 +0000 (09:41 +0200)
  - add "IsIndexFile" to constructor of pkgAcqFile so that it sends
    the right cache control headers

apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
debian/changelog

index d2aca59..270838f 100644 (file)
@@ -1539,8 +1539,9 @@ void pkgAcqArchive::Finished()
 /* The file is added to the queue */
 pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash,
                       unsigned long Size,string Dsc,string ShortDesc,
-                      const string &DestDir, const string &DestFilename) :
-                       Item(Owner), ExpectedHash(Hash)
+                      const string &DestDir, const string &DestFilename,
+                       bool IsIndexFile) :
+                       Item(Owner), ExpectedHash(Hash), IsIndexFile(IsIndexFile)
 {
    Retries = _config->FindI("Acquire::Retries",0);
    
@@ -1655,3 +1656,12 @@ void pkgAcqFile::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    Item::Failed(Message,Cnf);
 }
                                                                        /*}}}*/
+// AcqIndex::Custom600Headers - Insert custom request headers          /*{{{*/
+// ---------------------------------------------------------------------
+/* The only header we use is the last-modified header. */
+string pkgAcqFile::Custom600Headers()
+{
+   if (IsIndexFile)
+      return "\nIndex-File: true";
+}
+                                                                       /*}}}*/
index 3f073de..592924f 100644 (file)
@@ -856,6 +856,9 @@ class pkgAcqFile : public pkgAcquire::Item
     */
    unsigned int Retries;
    
+   /** \brief Should this file be considered a index file */
+   bool IsIndexFile;
+
    public:
    
    // Specialized action members
@@ -864,6 +867,7 @@ class pkgAcqFile : public pkgAcquire::Item
                     pkgAcquire::MethodConfig *Cnf);
    virtual string DescURI() {return Desc.URI;};
    virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual string Custom600Headers();
 
    /** \brief Create a new pkgAcqFile object.
     *
@@ -887,6 +891,8 @@ class pkgAcqFile : public pkgAcquire::Item
     *
     *  \param DestFilename The filename+path the file is downloaded to.
     *
+    *  \param IsIndexFile The file is considered a IndexFile and cache-control
+    *                     headers like "cache-control: max-age=0" are send
     *
     * If DestFilename is empty, download to DestDir/<basename> if
     * DestDir is non-empty, $CWD/<basename> otherwise.  If
@@ -896,7 +902,8 @@ class pkgAcqFile : public pkgAcquire::Item
 
    pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Size,
              string Desc, string ShortDesc,
-             const string &DestDir="", const string &DestFilename="");
+             const string &DestDir="", const string &DestFilename="",
+             bool IsIndexFile=false);
 };
                                                                        /*}}}*/
 /** @} */
index 896f850..b23327b 100644 (file)
@@ -31,6 +31,9 @@ apt (0.7.25.4) UNRELEASED; urgency=low
       error out (LP: #502641)
   * apt-pkg/indexfile.cc:
     - deal correctly with three letter langcodes (LP: #391409)
+  * [ Abi break ] apt-pkg/acquire-item.{cc,h}:
+    - add "IsIndexFile" to constructor of pkgAcqFile so that it sends
+      the right cache control headers
 
   [ Robert Collins ]
   * Change the package index Info methods to allow apt-cache policy to be