]> sjero.net Git - wget/blobdiff - src/http.c
Ugly fix to make -nc without --content-disposition go back to not fetching files.
[wget] / src / http.c
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;
     }
 
+  /* 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;