]> sjero.net Git - wget/commitdiff
[svn] New option --retry-connrefused from Ahmod Dancy.
authorhniksic <devnull@localhost>
Thu, 4 Sep 2003 21:34:58 +0000 (14:34 -0700)
committerhniksic <devnull@localhost>
Thu, 4 Sep 2003 21:34:58 +0000 (14:34 -0700)
NEWS
src/ChangeLog
src/ftp.c
src/http.c
src/init.c
src/main.c
src/options.h
src/wget.h

diff --git a/NEWS b/NEWS
index 083e26c80c9da89c0e44c4ff1a7031c5a2ba9cc3..27b5b5a350696248ec788c2c2c01f25b6f81396b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,14 @@
 GNU Wget NEWS -- history of user-visible changes.
 
 GNU Wget NEWS -- history of user-visible changes.
 
-Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send GNU Wget bug reports to <bug-wget@gnu.org>.
 \f
 * Changes in Wget 1.9.
 
 See the end for copying conditions.
 
 Please send GNU Wget bug reports to <bug-wget@gnu.org>.
 \f
 * Changes in Wget 1.9.
 
+** The build process now requires Autoconf 2.5x.
+
 ** It is now possible to specify that POST method be used for HTTP
 requests.  For example, `wget --post-data="id=foo&data=bar" URL' will
 send a POST request with the specified contents.
 ** It is now possible to specify that POST method be used for HTTP
 requests.  For example, `wget --post-data="id=foo&data=bar" URL' will
 send a POST request with the specified contents.
@@ -23,6 +25,10 @@ The ETA is still based on the average speed, though.
 ** It is now possible to connect to FTP servers through FWTK
 firewalls.  Set ftp_proxy to an FTP URL, and Wget will automatically
 log on to the proxy as "username@host".
 ** It is now possible to connect to FTP servers through FWTK
 firewalls.  Set ftp_proxy to an FTP URL, and Wget will automatically
 log on to the proxy as "username@host".
+
+** The new option `--retry-connrefused' makes Wget retry downloads
+even in the face of refused connections, which are otherwise
+considered a fatal error.
 \f
 * Wget 1.8.1 is a bugfix release with no user-visible changes.
 \f
 \f
 * Wget 1.8.1 is a bugfix release with no user-visible changes.
 \f
index 4dcc6d62014aace36d421b1a70671f1233d54958..c5faaf22fc133b454d38727d8a5e5fc9457fa053 100644 (file)
@@ -1,3 +1,15 @@
+2003-09-03  Ahmon Dancy  <dancy@dancysoft.com>
+
+       * main.c init.c options.h: Added --retry-connrefused option so
+       that Connection Refused failures are treated as non-fatal (when
+       trying to retrieve from busy servers).
+
+       * wget.h: New CONNECT_ERROR macro for encapsulating this
+       modification.
+
+       * ftp.c http.c : Use CONNECT_ERROR macro in places where
+       ECONNREFUSED was checked.
+
 2003-01-11  Ian Abbott <abbotti@mev.co.uk>
 
        * ftp.c (ftp_retrieve_glob): Reject insecure filenames as determined
 2003-01-11  Ian Abbott <abbotti@mev.co.uk>
 
        * ftp.c (ftp_retrieve_glob): Reject insecure filenames as determined
index c49f25e97859dcac3a72a344a5d211463713f4c7..3159171f7c4caa3c26bc92d59aadf83ea0254ca0 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -185,7 +185,7 @@ getftp (struct url *u, long *len, long restval, ccon *con)
       address_list_release (al);
 
       if (csock < 0)
       address_list_release (al);
 
       if (csock < 0)
-       return errno == ECONNREFUSED ? CONREFUSED : CONERROR;
+       return CONNECT_ERROR (errno);
 
       if (cmd & LEAVE_PENDING)
        rbuf_initialize (&con->rbuf, csock);
 
       if (cmd & LEAVE_PENDING)
        rbuf_initialize (&con->rbuf, csock);
@@ -578,7 +578,7 @@ Error in server response, closing control connection.\n"));
                  logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"),
                             pretty_print_address (&passive_addr), passive_port,
                             strerror (save_errno));
                  logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"),
                             pretty_print_address (&passive_addr), passive_port,
                             strerror (save_errno));
-                 return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR;
+                 return CONNECT_ERROR (save_errno);
                }
 
              pasv_mode_open = 1;  /* Flag to avoid accept port */
                }
 
              pasv_mode_open = 1;  /* Flag to avoid accept port */
index 7c8280c1a20daa798a4e578147c96a083d1509dd..14176aac0af659d58f78e354db861f2c82d1ffbe 100644 (file)
@@ -765,7 +765,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
       address_list_release (al);
 
       if (sock < 0)
       address_list_release (al);
 
       if (sock < 0)
-       return errno == ECONNREFUSED ? CONREFUSED : CONERROR;
+       return CONNECT_ERROR (errno);
 
 #ifdef HAVE_SSL
      if (conn->scheme == SCHEME_HTTPS)
 
 #ifdef HAVE_SSL
      if (conn->scheme == SCHEME_HTTPS)
index dec3744168f973e04e928b9df940d77ddbe5b72b..e342b848ccb8bdfd207888f0cbaffde5294d48f2 100644 (file)
@@ -188,6 +188,7 @@ static struct {
   { "relativeonly",    &opt.relative_only,     cmd_boolean },
   { "removelisting",   &opt.remove_listing,    cmd_boolean },
   { "retrsymlinks",    &opt.retr_symlinks,     cmd_boolean },
   { "relativeonly",    &opt.relative_only,     cmd_boolean },
   { "removelisting",   &opt.remove_listing,    cmd_boolean },
   { "retrsymlinks",    &opt.retr_symlinks,     cmd_boolean },
+  { "retryconnrefused",        &opt.retry_connrefused, cmd_boolean },
   { "robots",          &opt.use_robots,        cmd_boolean },
   { "savecookies",     &opt.cookies_output,    cmd_file },
   { "saveheaders",     &opt.save_headers,      cmd_boolean },
   { "robots",          &opt.use_robots,        cmd_boolean },
   { "savecookies",     &opt.cookies_output,    cmd_file },
   { "saveheaders",     &opt.save_headers,      cmd_boolean },
index 03bf357b36e58e6ee2b46277dd26c6ef57b4e684..cfcdbbe3ad52f9e72fefbbaa31fb4505231d62a7 100644 (file)
@@ -162,6 +162,7 @@ Logging and input file:\n\
   fputs (_("\
 Download:\n\
   -t,  --tries=NUMBER           set number of retries to NUMBER (0 unlimits).\n\
   fputs (_("\
 Download:\n\
   -t,  --tries=NUMBER           set number of retries to NUMBER (0 unlimits).\n\
+       --retry-connrefused      retry even if connection is refused.\n\
   -O   --output-document=FILE   write documents to FILE.\n\
   -nc, --no-clobber             don\'t clobber existing files or use .# suffixes.\n\
   -c,  --continue               resume getting a partially-downloaded file.\n\
   -O   --output-document=FILE   write documents to FILE.\n\
   -nc, --no-clobber             don\'t clobber existing files or use .# suffixes.\n\
   -c,  --continue               resume getting a partially-downloaded file.\n\
@@ -294,6 +295,7 @@ main (int argc, char *const *argv)
     { "recursive", no_argument, NULL, 'r' },
     { "relative", no_argument, NULL, 'L' },
     { "retr-symlinks", no_argument, NULL, 137 },
     { "recursive", no_argument, NULL, 'r' },
     { "relative", no_argument, NULL, 'L' },
     { "retr-symlinks", no_argument, NULL, 137 },
+    { "retry-connrefused", no_argument, NULL, 174 },
     { "save-headers", no_argument, NULL, 's' },
     { "server-response", no_argument, NULL, 'S' },
     { "span-hosts", no_argument, NULL, 'H' },
     { "save-headers", no_argument, NULL, 's' },
     { "server-response", no_argument, NULL, 'S' },
     { "span-hosts", no_argument, NULL, 'H' },
@@ -515,6 +517,9 @@ GNU General Public License for more details.\n"));
        case 'x':
          setval ("dirstruct", "on");
          break;
        case 'x':
          setval ("dirstruct", "on");
          break;
+       case 174:
+         setval ("retryconnrefused", "on");
+         break;
 
          /* Options accepting an argument: */
        case 129:
 
          /* Options accepting an argument: */
        case 129:
index 34e9991cbfa95595b3b578f708078e75f05bcabb..518a50def859087382e27ede11b98bd3a03b9f19 100644 (file)
@@ -35,6 +35,7 @@ struct options
   int verbose;                 /* Are we verbose? */
   int quiet;                   /* Are we quiet? */
   int ntry;                    /* Number of tries per URL */
   int verbose;                 /* Are we verbose? */
   int quiet;                   /* Are we quiet? */
   int ntry;                    /* Number of tries per URL */
+  int retry_connrefused;       /* Treat CONNREFUSED as non-fatal. */
   int background;              /* Whether we should work in background. */
   int kill_longer;             /* Do we reject messages with *more*
                                   data than specified in
   int background;              /* Whether we should work in background. */
   int kill_longer;             /* Do we reject messages with *more*
                                   data than specified in
index ccc73b6146c2f1bf6511938259f9e719705dcc2f..21b758bd62f31231e181b6c30c534aed24c7fc28 100644 (file)
@@ -326,4 +326,7 @@ typedef unsigned char  boolean;
    retrieve the requisites of a single document. */
 #define INFINITE_RECURSION -1
 
    retrieve the requisites of a single document. */
 #define INFINITE_RECURSION -1
 
+#define CONNECT_ERROR(x) ((x) == ECONNREFUSED && !opt.retry_connrefused        \
+                         ? CONREFUSED : CONERROR)
+
 #endif /* WGET_H */
 #endif /* WGET_H */