]> sjero.net Git - wget/commitdiff
Add support for --content-on-error.
authorHenrik Holst <henrik.holst@millistream.com>
Thu, 6 Oct 2011 11:25:17 +0000 (13:25 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Thu, 6 Oct 2011 11:25:17 +0000 (13:25 +0200)
NEWS
doc/ChangeLog
doc/wget.texi
src/ChangeLog
src/http.c
src/init.c
src/main.c
src/options.h

diff --git a/NEWS b/NEWS
index 8a7cc2837e72fda01d570850543bd3c7029e4eae..79c25b3eab9f63eadb47342bc84daa68711dce25 100644 (file)
--- 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 <bug-wget@gnu.org>.
+\f
+* Changes in Wget X.Y.Z
+
+** Add support for content-on-error.  It allows to store the HTTP
+   payload on 4xx or 5xx errors.
+
 \f
 * Changes in Wget 1.13.4
 
index 1237f286a4f29097402e249b65d00833964c067e..36c07bdaba064a624f0f2439a5e4649224cfacf0 100644 (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)
 
        * wget.texi: Make dir entry consistent with others.
index d1ec72ea2d7f234944349d43e213a07f486e1737..7a77a7b6f656125001e9f9a6bf3a579eac1e0ff0 100644 (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
 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
 
index dad001dedac34f13bdb823ddd7a3aa6b7cfa7d13..c9c317ba6ccc360767607de1227fb298f15b72be 100644 (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>
 
        * main.c (print_version): Update copyright year.
index 748b4e8142a99bf28eed6d3248fd89fb61b89241..7eef453f6ccca5cedb0bb6f59d7f9b81e75c4a97 100644 (file)
@@ -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;
index 0389c39fff1ecd2df9d5b02b09d6b9a29ad7105a..b40be8ad7effcbb9d33e2add2032724017717af1 100644 (file)
@@ -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 },
index 2c4dab25521a6265cc0600e8e72bc288ec07f2f1..b80eef0a9484b324a199e1a58db4683fd2d26df0 100644 (file)
@@ -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\
index 252bf81d395650f5ca5ea00948938d7744a450b5..5e7c1eb6222cce9c418e3c7b01433ad261b9da00 100644 (file)
@@ -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 */