From: hniksic Date: Thu, 4 Sep 2003 21:34:58 +0000 (-0700) Subject: [svn] New option --retry-connrefused from Ahmod Dancy. X-Git-Tag: v1.13~1737 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=30ac043b0a4a9a983dd1b50ce1c89ed953019292 [svn] New option --retry-connrefused from Ahmod Dancy. --- diff --git a/NEWS b/NEWS index 083e26c8..27b5b5a3 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,14 @@ 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 . * 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. @@ -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". + +** The new option `--retry-connrefused' makes Wget retry downloads +even in the face of refused connections, which are otherwise +considered a fatal error. * Wget 1.8.1 is a bugfix release with no user-visible changes. diff --git a/src/ChangeLog b/src/ChangeLog index 4dcc6d62..c5faaf22 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2003-09-03 Ahmon Dancy + + * 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 * ftp.c (ftp_retrieve_glob): Reject insecure filenames as determined diff --git a/src/ftp.c b/src/ftp.c index c49f25e9..3159171f 100644 --- 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) - return errno == ECONNREFUSED ? CONREFUSED : CONERROR; + return CONNECT_ERROR (errno); 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)); - return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR; + return CONNECT_ERROR (save_errno); } pasv_mode_open = 1; /* Flag to avoid accept port */ diff --git a/src/http.c b/src/http.c index 7c8280c1..14176aac 100644 --- a/src/http.c +++ b/src/http.c @@ -765,7 +765,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) address_list_release (al); if (sock < 0) - return errno == ECONNREFUSED ? CONREFUSED : CONERROR; + return CONNECT_ERROR (errno); #ifdef HAVE_SSL if (conn->scheme == SCHEME_HTTPS) diff --git a/src/init.c b/src/init.c index dec37441..e342b848 100644 --- a/src/init.c +++ b/src/init.c @@ -188,6 +188,7 @@ static struct { { "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 }, diff --git a/src/main.c b/src/main.c index 03bf357b..cfcdbbe3 100644 --- a/src/main.c +++ b/src/main.c @@ -162,6 +162,7 @@ Logging and input file:\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\ @@ -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 }, + { "retry-connrefused", no_argument, NULL, 174 }, { "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 174: + setval ("retryconnrefused", "on"); + break; /* Options accepting an argument: */ case 129: diff --git a/src/options.h b/src/options.h index 34e9991c..518a50de 100644 --- a/src/options.h +++ b/src/options.h @@ -35,6 +35,7 @@ struct options 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 diff --git a/src/wget.h b/src/wget.h index ccc73b61..21b758bd 100644 --- a/src/wget.h +++ b/src/wget.h @@ -326,4 +326,7 @@ typedef unsigned char boolean; 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 */