diff --git a/NEWS b/NEWS index 8a7cc283..79c25b3e 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,12 @@ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, See the end for copying conditions. Please send GNU Wget bug reports to . + +* 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 diff --git a/doc/ChangeLog b/doc/ChangeLog index 1237f286..36c07bda 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2011-10-02 Henrik Holst (tiny change) + + * wget.texi (HTTP Options): Document option --content-on-error. + 2011-09-27 Karl Berry (tiny change) * wget.texi: Make dir entry consistent with others. diff --git a/doc/wget.texi b/doc/wget.texi index d1ec72ea..7a77a7b6 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -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 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 @item --trust-server-names diff --git a/src/ChangeLog b/src/ChangeLog index dad001de..c9c317ba 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-10-02 Henrik Holst (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 * main.c (print_version): Update copyright year. diff --git a/src/http.c b/src/http.c index 748b4e81..7eef453f 100644 --- a/src/http.c +++ b/src/http.c @@ -2451,7 +2451,7 @@ read_header: type = NULL; /* We don't need it any more. */ /* 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... */ hs->len = 0; diff --git a/src/init.c b/src/init.c index 0389c39f..b40be8ad 100644 --- a/src/init.c +++ b/src/init.c @@ -139,6 +139,7 @@ static const struct { { "chooseconfig", &opt.choose_config, cmd_file }, { "connecttimeout", &opt.connect_timeout, cmd_time }, { "contentdisposition", &opt.content_disposition, cmd_boolean }, + { "contentonerror", &opt.content_on_error, cmd_boolean }, { "continue", &opt.always_rest, cmd_boolean }, { "convertlinks", &opt.convert_links, cmd_boolean }, { "cookies", &opt.cookies, cmd_boolean }, diff --git a/src/main.c b/src/main.c index 2c4dab25..b80eef0a 100644 --- a/src/main.c +++ b/src/main.c @@ -178,6 +178,7 @@ static struct cmdline_option option_data[] = { "continue", 'c', OPT_BOOLEAN, "continue", -1 }, { "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 }, { "content-disposition", 0, OPT_BOOLEAN, "contentdisposition", -1 }, + { "content-on-error", 0, OPT_BOOLEAN, "contentonerror", -1 }, { "cookies", 0, OPT_BOOLEAN, "cookies", -1 }, { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 }, { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 }, @@ -594,6 +595,8 @@ HTTP options:\n"), N_("\ --content-disposition honor the Content-Disposition header when\n\ choosing local file names (EXPERIMENTAL).\n"), + N_("\ + --content-on-error output the received content on server errors.\n"), N_("\ --auth-no-challenge send Basic HTTP authentication information\n\ without first waiting for the server's\n\ diff --git a/src/options.h b/src/options.h index 252bf81d..5e7c1eb6 100644 --- a/src/options.h +++ b/src/options.h @@ -130,6 +130,8 @@ struct options bool server_response; /* Do we print server response? */ bool save_headers; /* Do we save headers together with file? */ + bool content_on_error; /* Do we output the content when the HTTP + status code indicates a server error */ #ifdef ENABLE_DEBUG bool debug; /* Debugging on/off */