]> git.saurik.com Git - apt.git/commitdiff
* methods/http.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 3 Feb 2010 18:00:54 +0000 (10:00 -0800)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 3 Feb 2010 18:00:54 +0000 (10:00 -0800)
  - add cache-control headers even if no cache is given to allow
    adding options for intercepting proxies

debian/changelog
methods/http.cc

index a150197b1358aad4b2b56cd6c479412919a9dabf..03936a31b57c43d516aaa7d015ff6f233f4e8730 100644 (file)
@@ -17,6 +17,9 @@ apt (0.7.25.1) UNRELEASED; urgency=low
   * cmdline/apt-cdrom.cc:
     - add new --auto-detect option that uses libudev to figure out
       the cdrom/mount-point
+  * methods/http.cc:
+    - add cache-control headers even if no cache is given to allow
+      adding options for intercepting proxies
 
  -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 18 Dec 2009 16:54:18 +0100
 
index 2dae87a02be878cb3da87c0c18336a8633b2c743..2bd57024b415822dc8407f113ddae3eb2d436fe1 100644 (file)
@@ -682,23 +682,25 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
                 and a no-store directive for archives. */
       sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\n",
              Itm->Uri.c_str(),ProperHost.c_str());
-      // only generate a cache control header if we actually want to 
-      // use a cache
-      if (_config->FindB("Acquire::http::No-Cache",false) == false)
+   }
+   // generate a cache control header (if needed)
+   if (_config->FindB("Acquire::http::No-Cache",false) == true) 
+   {
+      strcat(Buf,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
+   }
+   else
+   {
+      if (Itm->IndexFile == true) 
       {
-        if (Itm->IndexFile == true)
-           sprintf(Buf+strlen(Buf),"Cache-Control: max-age=%u\r\n",
-                   _config->FindI("Acquire::http::Max-Age",0));
-        else
-        {
-           if (_config->FindB("Acquire::http::No-Store",false) == true)
-              strcat(Buf,"Cache-Control: no-store\r\n");
-        }       
+        sprintf(Buf+strlen(Buf),"Cache-Control: max-age=%u\r\n",
+                _config->FindI("Acquire::http::Max-Age",0));
+      }
+      else
+      {
+        if (_config->FindB("Acquire::http::No-Store",false) == true)
+           strcat(Buf,"Cache-Control: no-store\r\n");
       }
    }
-   // generate a no-cache header if needed
-   if (_config->FindB("Acquire::http::No-Cache",false) == true)
-      strcat(Buf,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
 
    
    string Req = Buf;