1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Add support for --content-on-error.

This commit is contained in:
Henrik Holst 2011-10-06 13:25:17 +02:00 committed by Giuseppe Scrivano
parent 2223ac8ce3
commit fce4e757a2
8 changed files with 34 additions and 1 deletions

6
NEWS
View File

@ -5,6 +5,12 @@ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
See the end for copying conditions. See the end for copying conditions.
Please send GNU Wget bug reports to <bug-wget@gnu.org>. Please send GNU Wget bug reports to <bug-wget@gnu.org>.
* Changes in Wget X.Y.Z
** Add support for content-on-error. It allows to store the HTTP
payload on 4xx or 5xx errors.
* Changes in Wget 1.13.4 * Changes in Wget 1.13.4

View File

@ -1,3 +1,7 @@
2011-10-02 Henrik Holst <henrik.holst@millistream.com> (tiny change)
* wget.texi (HTTP Options): Document option --content-on-error.
2011-09-27 Karl Berry <karl@freefriends.org> (tiny change) 2011-09-27 Karl Berry <karl@freefriends.org> (tiny change)
* wget.texi: Make dir entry consistent with others. * wget.texi: Make dir entry consistent with others.

View File

@ -1506,6 +1506,12 @@ This option is useful for some file-downloading CGI programs that use
@code{Content-Disposition} headers to describe what the name of a @code{Content-Disposition} headers to describe what the name of a
downloaded file should be. downloaded file should be.
@cindex Content On Error
@item --content-on-error
If this is set to on, wget will not skip the content when the server responds
with a http status code that indicates error.
@cindex Trust server names @cindex Trust server names
@item --trust-server-names @item --trust-server-names

View File

@ -1,3 +1,14 @@
2011-10-02 Henrik Holst <henrik.holst@millistream.com> (tiny change)
* http.c (gethttp): If 'contentonerror' is used then do not
skip the http body on 4xx and 5xx errors.
* init.c (commands): Add 'contentonerror'.
* main.c (print_help, option_data): Add new option 'contentonerror'
to make wget not skip the http content on 4xx and 5xx errors.
* options.h: New variable 'content_on_error'.
2011-09-19 Giuseppe Scrivano <gscrivano@gnu.org> 2011-09-19 Giuseppe Scrivano <gscrivano@gnu.org>
* main.c (print_version): Update copyright year. * main.c (print_version): Update copyright year.

View File

@ -2451,7 +2451,7 @@ read_header:
type = NULL; /* We don't need it any more. */ type = NULL; /* We don't need it any more. */
/* Return if we have no intention of further downloading. */ /* Return if we have no intention of further downloading. */
if (!(*dt & RETROKF) || head_only) if ((!(*dt & RETROKF) && !opt.content_on_error) || head_only)
{ {
/* In case the caller cares to look... */ /* In case the caller cares to look... */
hs->len = 0; hs->len = 0;

View File

@ -139,6 +139,7 @@ static const struct {
{ "chooseconfig", &opt.choose_config, cmd_file }, { "chooseconfig", &opt.choose_config, cmd_file },
{ "connecttimeout", &opt.connect_timeout, cmd_time }, { "connecttimeout", &opt.connect_timeout, cmd_time },
{ "contentdisposition", &opt.content_disposition, cmd_boolean }, { "contentdisposition", &opt.content_disposition, cmd_boolean },
{ "contentonerror", &opt.content_on_error, cmd_boolean },
{ "continue", &opt.always_rest, cmd_boolean }, { "continue", &opt.always_rest, cmd_boolean },
{ "convertlinks", &opt.convert_links, cmd_boolean }, { "convertlinks", &opt.convert_links, cmd_boolean },
{ "cookies", &opt.cookies, cmd_boolean }, { "cookies", &opt.cookies, cmd_boolean },

View File

@ -178,6 +178,7 @@ static struct cmdline_option option_data[] =
{ "continue", 'c', OPT_BOOLEAN, "continue", -1 }, { "continue", 'c', OPT_BOOLEAN, "continue", -1 },
{ "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 }, { "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 },
{ "content-disposition", 0, OPT_BOOLEAN, "contentdisposition", -1 }, { "content-disposition", 0, OPT_BOOLEAN, "contentdisposition", -1 },
{ "content-on-error", 0, OPT_BOOLEAN, "contentonerror", -1 },
{ "cookies", 0, OPT_BOOLEAN, "cookies", -1 }, { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
{ "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 }, { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
{ WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 }, { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
@ -594,6 +595,8 @@ HTTP options:\n"),
N_("\ N_("\
--content-disposition honor the Content-Disposition header when\n\ --content-disposition honor the Content-Disposition header when\n\
choosing local file names (EXPERIMENTAL).\n"), choosing local file names (EXPERIMENTAL).\n"),
N_("\
--content-on-error output the received content on server errors.\n"),
N_("\ N_("\
--auth-no-challenge send Basic HTTP authentication information\n\ --auth-no-challenge send Basic HTTP authentication information\n\
without first waiting for the server's\n\ without first waiting for the server's\n\

View File

@ -130,6 +130,8 @@ struct options
bool server_response; /* Do we print server response? */ bool server_response; /* Do we print server response? */
bool save_headers; /* Do we save headers together with bool save_headers; /* Do we save headers together with
file? */ file? */
bool content_on_error; /* Do we output the content when the HTTP
status code indicates a server error */
#ifdef ENABLE_DEBUG #ifdef ENABLE_DEBUG
bool debug; /* Debugging on/off */ bool debug; /* Debugging on/off */