stsc's better-messages-for-spider-mode patch.

This commit is contained in:
Micah Cowan 2008-06-22 15:07:19 -07:00
parent c98aeb0cc3
commit b2dbe2b7e4
2 changed files with 18 additions and 1 deletions

View 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

View 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;
}
}