diff -u wget-1.13_orig/src/http.c wget-1.13/src/http.c --- wget-1.13_orig/src/http.c 2011-10-02 00:59:05.949926929 +0200 +++ wget-1.13/src/http.c 2011-10-01 01:29:52.740942125 +0200 @@ -2448,7 +2448,7 @@ 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 -u wget-1.13_orig/src/init.c wget-1.13/src/init.c --- wget-1.13_orig/src/init.c 2011-10-02 00:59:05.979926929 +0200 +++ wget-1.13/src/init.c 2011-10-01 01:34:02.810941982 +0200 @@ -139,6 +139,7 @@ { "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 -u wget-1.13_orig/src/main.c wget-1.13/src/main.c --- wget-1.13_orig/src/main.c 2011-10-02 00:59:05.859926929 +0200 +++ wget-1.13/src/main.c 2011-10-01 01:50:05.760941442 +0200 @@ -178,6 +178,7 @@ { "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 }, @@ -595,6 +596,8 @@ --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\ challenge.\n"), diff -u wget-1.13_orig/src/options.h wget-1.13/src/options.h --- wget-1.13_orig/src/options.h 2011-10-02 00:59:05.949926929 +0200 +++ wget-1.13/src/options.h 2011-10-01 01:46:34.520941561 +0200 @@ -130,6 +130,8 @@ 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 */ diff -u wget-1.13_orig/doc/wget.info wget-1.13/doc/wget.info --- wget-1.13_orig/doc/wget.info 2011-10-02 00:59:06.769926929 +0200 +++ wget-1.13/doc/wget.info 2011-10-02 00:58:26.139926946 +0200 @@ -1288,6 +1288,10 @@ use `Content-Disposition' headers to describe what the name of a downloaded file should be. +`--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. + `--trust-server-names' If this is set to on, on a redirect the last component of the redirection URL will be used as the local file name. By default diff -u wget-1.13_orig/doc/wget.texi wget-1.13/doc/wget.texi --- wget-1.13_orig/doc/wget.texi 2011-10-02 00:59:06.769926929 +0200 +++ wget-1.13/doc/wget.texi 2011-10-02 00:58:21.869926947 +0200 @@ -1506,6 +1506,12 @@ @code{Content-Disposition} headers to describe what the name of a downloaded file should be. address@hidden Content On Error address@hidden --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