]> sjero.net Git - wget/commitdiff
stsc's better-messages-for-spider-mode patch.
authorMicah Cowan <micah@cowan.name>
Sun, 22 Jun 2008 22:07:19 +0000 (15:07 -0700)
committerMicah Cowan <micah@cowan.name>
Sun, 22 Jun 2008 22:07:19 +0000 (15:07 -0700)
src/ChangeLog
src/http.c

index c9da1c8e27dbaf47305d5e482f06723e2c4dfa69..b3defda019ee8fec1d3f47bfad0dae7ede52864b 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-22  Steven Schubiger  <schubiger@gmail.com>
+
+       * http.c: Make -nv --spider include the file's name when it
+       exists.
+       
 2008-06-22  Micah Cowan  <micah@cowan.name>
 
        * Makefile.am (version.c): Fixed version string invocation so it
index 78e57373976fb2d2bb663f84ef5bc00cf317b06e..d17b5db12f70515160f94845907f18271fcaee0b 100644 (file)
@@ -1296,6 +1296,7 @@ struct http_stat
   char *remote_time;            /* remote time-stamp string */
   char *error;                  /* textual HTTP error */
   int statcode;                 /* status code */
+  char *message;                /* status message */
   wgint rd_size;                /* amount of data read from socket */
   double dltime;                /* time it took to download the data */
   const char *referer;          /* value of the referer header. */
@@ -1713,6 +1714,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
 
           resp = resp_new (head);
           statcode = resp_status (resp, &message);
+          hs->message = xstrdup (message);
           resp_free (resp);
           xfree (head);
           if (statcode != 200)
@@ -1795,6 +1797,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   /* Check for status line.  */
   message = NULL;
   statcode = resp_status (resp, &message);
+  hs->message = xstrdup (message);
   if (!opt.server_response)
     logprintf (LOG_VERBOSE, "%2d %s\n", statcode,
                message ? quotearg_style (escape_quoting_style, message) : "");
@@ -2662,19 +2665,20 @@ The sizes do not match (local %s) -- retrieving.\n"),
               
               if (opt.spider)
                 {
+                  bool finished = true;
                   if (opt.recursive)
                     {
                       if (*dt & TEXTHTML)
                         {
                           logputs (LOG_VERBOSE, _("\
 Remote file exists and could contain links to other resources -- retrieving.\n\n"));
+                          finished = false;
                         }
                       else 
                         {
                           logprintf (LOG_VERBOSE, _("\
 Remote file exists but does not contain any link -- not retrieving.\n\n"));
                           ret = RETROK; /* RETRUNNEEDED is not for caller. */
-                          goto exit;
                         }
                     }
                   else
@@ -2691,6 +2695,14 @@ but recursion is disabled -- not retrieving.\n\n"));
 Remote file exists.\n\n"));
                         }
                       ret = RETROK; /* RETRUNNEEDED is not for caller. */
+                    }
+                  
+                  if (finished)
+                    {
+                      logprintf (LOG_NONVERBOSE, 
+                                 _("%s URL:%s %2d %s\n"), 
+                                 tms, u->url, hstat.statcode,
+                                 hstat.message ? escnonprint (hstat.message) : "");
                       goto exit;
                     }
                 }