diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-03 10:41:17 -0800 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-03 10:41:17 -0800 |
commit | 424d785b672f80a0f1a5b6ab4a858c48f4c49bfd (patch) | |
tree | d74b5a80c0167f2d3143d480887b67baa72fe841 /methods/http.cc | |
parent | 4df70e7528c21f948dfb7032271c499c53a21515 (diff) | |
parent | c9cd3b70f3290071c79d7ef85ed87bd709a06bc6 (diff) |
merged from lp:~mvo/apt/mvo
Diffstat (limited to 'methods/http.cc')
-rw-r--r-- | methods/http.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/methods/http.cc b/methods/http.cc index 47e7c5f50..45804656d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -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; |