]> sjero.net Git - wget/commitdiff
Ugly fix to make -nc without --content-disposition go back to not fetching files.
authorMicah Cowan <micah@cowan.name>
Sun, 3 Feb 2008 20:20:52 +0000 (12:20 -0800)
committerMicah Cowan <micah@cowan.name>
Sun, 3 Feb 2008 20:20:52 +0000 (12:20 -0800)
src/ChangeLog
src/http.c

index 7be1d9a22cc071397b000499795b3b0887a8c249..caeb3b77945eca52a30704e530e8385eaa54170e 100644 (file)
@@ -6,6 +6,9 @@
        bugs (#22161, #20481)
        (get_eta, count_cols): Added to support the changes for
        create_image.
        bugs (#22161, #20481)
        (get_eta, count_cols): Added to support the changes for
        create_image.
+       * http.c (http_loop): Put no-clobber logic back into http_loop,
+       before starting to fetch, for when we're not doing
+       content-disposition.
 
 2008-01-31  Micah Cowan  <micah@cowan.name>
 
 
 2008-01-31  Micah Cowan  <micah@cowan.name>
 
index da4b32e38e093476096c93491b137ea3b6f76521..02645724b136bc0f5554b9e98489e38aacfbdc68 100644 (file)
@@ -2359,6 +2359,26 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
       got_name = true;
     }
 
       got_name = true;
     }
 
+  /* TODO: Ick! This code is now in both gethttp and http_loop, and is
+   * screaming for some refactoring. */
+  if (got_name && file_exists_p (hstat.local_file) && opt.noclobber)
+    {
+      /* If opt.noclobber is turned on and file already exists, do not
+         retrieve the file */
+      logprintf (LOG_VERBOSE, _("\
+File `%s' already there; not retrieving.\n\n"), 
+                 hstat.local_file);
+      /* If the file is there, we suppose it's retrieved OK.  */
+      *dt |= RETROKF;
+
+      /* #### Bogusness alert.  */
+      /* If its suffix is "html" or "htm" or similar, assume text/html.  */
+      if (has_html_suffix_p (hstat.local_file))
+        *dt |= TEXTHTML;
+
+      return RETRUNNEEDED;
+    }
+
   /* Reset the counter. */
   count = 0;
   
   /* Reset the counter. */
   count = 0;