]> sjero.net Git - wget/commitdiff
[svn] Send the no-cache directive when required regardless of whether we're
authorhniksic <devnull@localhost>
Fri, 27 Apr 2001 05:26:44 +0000 (22:26 -0700)
committerhniksic <devnull@localhost>
Fri, 27 Apr 2001 05:26:44 +0000 (22:26 -0700)
going through a proxy.
Published in <sxsitjqncbx.fsf@florida.arsdigita.de>.

src/ChangeLog
src/http.c
src/init.c
src/options.h

index cadb7bb168b6de1e9b99a991b1775999104efdd0..19e9cb2f94681e3d6590ba96d5f30da5c6d08fc8 100644 (file)
@@ -1,3 +1,12 @@
+2001-04-27  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * http.c (http_loop): If allow_cache is zero, always disable
+       caching, not only when retrieving through proxy.
+
+       * init.c: Ditto.
+
+       * options.h (struct options): Rename proxy_cache to allow_cache.
+
 2001-04-27  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * http.c (mktime_from_utc): Improve documentation.
index 34f97ce7cd348f5d2343b9389ba7cd435af3e666..ecf29384c68708116e3a28422c97975775cf7993 100644 (file)
@@ -1521,8 +1521,16 @@ File `%s' already there, will not retrieve.\n"), u->local);
          && file_exists_p (locf))
        if (stat (locf, &st) == 0 && S_ISREG (st.st_mode))
          hstat.restval = st.st_size;
-      /* Decide whether to send the no-cache directive.  */
-      if (u->proxy && (count > 1 || (opt.proxy_cache == 0)))
+
+      /* Decide whether to send the no-cache directive.  We send it in
+        two cases:
+          a) we're using a proxy, and we're past our first retrieval.
+             Some proxies are notorious for caching incomplete data, so
+             we require a fresh get.
+          b) caching is explicitly inhibited. */
+      if ((u->proxy && count > 1) /* a */
+         || !opt.allow_cache     /* b */
+         )
        *dt |= SEND_NOCACHE;
       else
        *dt &= ~SEND_NOCACHE;
index 46fd6b910621be0532e6181d38eec567c0dafe61..d824d8c32fb83f6debb6755cca0e3eaf3776505f 100644 (file)
@@ -104,7 +104,7 @@ static struct {
   { "backups",         &opt.backups,           cmd_number },
   { "base",            &opt.base_href,         cmd_string },
   { "bindaddress",     &opt.bind_address,      cmd_address },
-  { "cache",           &opt.proxy_cache,       cmd_boolean },
+  { "cache",           &opt.allow_cache,       cmd_boolean },
   { "continue",                &opt.always_rest,       cmd_boolean },
   { "convertlinks",    &opt.convert_links,     cmd_boolean },
   { "cookies",         &opt.cookies,           cmd_boolean },
@@ -237,7 +237,7 @@ defaults (void)
   tmp = getenv ("no_proxy");
   if (tmp)
     opt.no_proxy = sepstring (tmp);
-  opt.proxy_cache = 1;
+  opt.allow_cache = 1;
 
 #ifdef HAVE_SELECT
   opt.timeout = 900;
index 90b5919e22801661bb5a6c1234c447e595625396..42bfd7c650f007f451a51c021547b1de54bd7055 100644 (file)
@@ -92,7 +92,7 @@ struct options
   int http_keep_alive;         /* whether we use keep-alive */
 
   int use_proxy;               /* Do we use proxy? */
-  int proxy_cache;             /* Do we load from proxy cache? */
+  int allow_cache;             /* Do we allow server-side caching? */
   char *http_proxy, *ftp_proxy, *https_proxy;
   char **no_proxy;
   char *base_href;