Fix --content-on-error option handling.

* src/http.c: Log --content-on-error downloads.
* src/retr.c (retrieve_url): Register the download of an error page
when --content-on-error is specified.
This commit is contained in:
Yousong Zhou 2014-10-16 15:16:53 +08:00 committed by Giuseppe Scrivano
parent 4a214bc9a3
commit 91e9a20752
2 changed files with 4 additions and 4 deletions

View File

@ -3513,7 +3513,7 @@ Remote file exists.\n\n"));
if (hstat.len == hstat.contlen)
{
if (*dt & RETROKF)
if (*dt & RETROKF || opt.content_on_error)
{
bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
@ -3549,7 +3549,7 @@ Remote file exists.\n\n"));
if (hstat.contlen == -1) /* We don't know how much we were supposed
to get, so assume we succeeded. */
{
if (*dt & RETROKF)
if (*dt & RETROKF || opt.content_on_error)
{
bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
@ -3627,7 +3627,7 @@ Remote file exists.\n\n"));
while (!opt.ntry || (count < opt.ntry));
exit:
if (ret == RETROK && local_file)
if ((ret == RETROK || opt.content_on_error) && local_file)
{
xfree (*local_file);
*local_file = xstrdup (hstat.local_file);

View File

@ -941,7 +941,7 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
DEBUGP (("[Couldn't fallback to non-utf8 for %s\n", quote (url)));
}
if (local_file && u && *dt & RETROKF)
if (local_file && u && (*dt & RETROKF || opt.content_on_error))
{
register_download (u->url, local_file);