]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* merged with apt--mvo
[apt.git] / methods / http.cc
index 81a64d7a3f1e769ddf58a45cecdf7e51c35873ba..e2337a9ba3459d1110a15e98a5f5c4591fa1c8fc 100644 (file)
@@ -58,6 +58,7 @@ unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 bool Debug = false;
 
+
 // CircleBuf::CircleBuf - Circular input buffer                                /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -95,7 +96,7 @@ bool CircleBuf::Read(int Fd)
       // Woops, buffer is full
       if (InP - OutP == Size)
         return true;
-      
+
       // Write the buffer segment
       int Res;
       Res = read(Fd,Buf + (InP%Size),LeftRead());
@@ -635,9 +636,9 @@ 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());
-      if (_config->FindB("Acquire::http::No-Cache",false) == true)
-        strcat(Buf,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
-      else
+      // only generate a cache control header if we actually want to 
+      // use a cache
+      if (_config->FindB("Acquire::http::No-Cache",false) == false)
       {
         if (Itm->IndexFile == true)
            sprintf(Buf+strlen(Buf),"Cache-Control: max-age=%u\r\n",
@@ -649,6 +650,10 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
         }       
       }
    }
+   // 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;