diff -ur wget-1.10-alpha1/ChangeLog wget-1.10-persistent/ChangeLog --- wget-1.10-alpha1/ChangeLog 2005-03-23 12:42:23.000000000 -0500 +++ wget-1.10-persistent/ChangeLog 2005-04-07 22:37:50.000000000 -0400 @@ -31,6 +31,18 @@ 2005-02-18 Marco Colombo * po/it.po: Updated Italian translation. + +2004-09-19 Leonid Petrov (mail@lpetrov.net) + + * Added new option --persistent + Without this option wget considers some errors like failure to + connect, failure to authenticate fatal, i.e terminates without + attempts to retry. With this option wget will re-try to connect + or log in. This option is useful only in conjunction with + --wait or --waitretry. + + Modified files: src/connect.c src/ftp.c src/http.c src/init.c + src/main.c src/options.h doc/wget.texi 2004-05-09 David Fritz diff -ur wget-1.10-alpha1/doc/wget.texi wget-1.10-persistent/doc/wget.texi --- wget-1.10-alpha1/doc/wget.texi 2005-03-06 14:34:22.000000000 -0500 +++ wget-1.10-persistent/doc/wget.texi 2005-04-07 22:26:29.000000000 -0400 @@ -738,6 +738,12 @@ time for this balance to be achieved, so don't be surprised if limiting the rate doesn't work well with very small files. +@cindex persistent +@item --persistent +Forces wget to consider some errors, like failure to connect, +failure of authenticate as non-fatal and re-try. This option +has sense only in conjunction with --wait or --waitretry. + @cindex pause @cindex wait @item -w @var{seconds} diff -ur wget-1.10-alpha1/src/connect.c wget-1.10-persistent/src/connect.c --- wget-1.10-alpha1/src/connect.c 2005-04-01 13:22:38.000000000 -0500 +++ wget-1.10-persistent/src/connect.c 2005-04-07 22:22:41.000000000 -0400 @@ -348,12 +348,13 @@ int connect_to_host (const char *host, int port) { - int i, start, end; + int i, start, end, count; int sock; struct address_list *al = lookup_host (host, 0); - retry: + count = 0; + retry: if (!al) return E_HOST; @@ -386,6 +387,17 @@ al = lookup_host (host, LH_REFRESH); goto retry; } + if ( opt.persistent ) + { + count++; + if ( count < opt.ntry ) + { + sleep_between_retrievals (count); + printwhat (count, opt.ntry); + goto retry; + } + printwhat (count, opt.ntry); + } address_list_release (al); return -1; diff -ur wget-1.10-alpha1/src/ftp.c wget-1.10-persistent/src/ftp.c --- wget-1.10-alpha1/src/ftp.c 2005-04-01 19:41:04.000000000 -0500 +++ wget-1.10-persistent/src/ftp.c 2005-04-07 22:24:13.000000000 -0400 @@ -1241,6 +1241,20 @@ else con->st |= DONE_CWD; + if ( opt.persistent ) + /* in the case of persistent option some fatal errors should be + considered as non-fatal */ + { + if ( + err == CONIMPOSSIBLE || + err == CONTNOTSUPPORTED || + err == FTPLOGINC || + err == FTPNSFOD || + err == FTPNOPASV || + err == HOSTERR + ) err = FTPSRVERR; + } + switch (err) { case HOSTERR: case CONIMPOSSIBLE: case FWRITEERR: case FOPENERR: diff -ur wget-1.10-alpha1/src/http.c wget-1.10-persistent/src/http.c --- wget-1.10-alpha1/src/http.c 2005-04-01 13:22:38.000000000 -0500 +++ wget-1.10-persistent/src/http.c 2005-04-07 22:24:30.000000000 -0400 @@ -2076,6 +2076,20 @@ /* Get the new location (with or without the redirection). */ if (hstat.newloc) *newloc = xstrdup (hstat.newloc); + if ( opt.persistent ) + /* in the case of persistent option some fatal errors should be + considered as non-fatal */ + { + if ( + err == AUTHFAILED || + err == HOSTERR || + err == CONIMPOSSIBLE || + err == CONTNOTSUPPORTED || + err == CONSSLERR || + err == PROXERR || + err == SSLERRCTXCREATE + ) err = HERR; + } switch (err) { case HERR: case HEOF: case CONSOCKERR: case CONCLOSED: diff -ur wget-1.10-alpha1/src/init.c wget-1.10-persistent/src/init.c --- wget-1.10-alpha1/src/init.c 2005-03-20 10:07:39.000000000 -0500 +++ wget-1.10-persistent/src/init.c 2005-04-07 21:38:36.000000000 -0400 @@ -174,6 +174,7 @@ { "outputdocument", &opt.output_document, cmd_file }, { "pagerequisites", &opt.page_requisites, cmd_boolean }, { "passiveftp", &opt.ftp_pasv, cmd_lockable_boolean }, + { "persistent", &opt.persistent, cmd_string }, { "postdata", &opt.post_data, cmd_string }, { "postfile", &opt.post_file_name, cmd_file }, { "preservepermissions", &opt.preserve_perm, cmd_boolean }, diff -ur wget-1.10-alpha1/src/main.c wget-1.10-persistent/src/main.c --- wget-1.10-alpha1/src/main.c 2005-03-22 08:20:02.000000000 -0500 +++ wget-1.10-persistent/src/main.c 2005-04-07 21:35:26.000000000 -0400 @@ -212,6 +212,7 @@ { "page-requisites", 'p', OPT_BOOLEAN, "pagerequisites", -1 }, { "parent", 0, OPT__PARENT, NULL, optional_argument }, { "passive-ftp", 0, OPT_BOOLEAN, "passiveftp", -1 }, + { "persistent", 0, OPT_BOOLEAN, "persistent", -1 }, { "post-data", 0, OPT_VALUE, "postdata", -1 }, { "post-file", 0, OPT_VALUE, "postfile", -1 }, { "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 }, @@ -447,6 +448,8 @@ N_("\ --random-wait wait from 0...2*WAIT secs between retrievals.\n"), N_("\ + --perisistent attempts to re-try even after errors.\n"), + N_("\ -Y, --proxy explicitly turn on proxy.\n"), N_("\ --no-proxy explicitly turn off proxy.\n"), diff -ur wget-1.10-alpha1/src/options.h wget-1.10-persistent/src/options.h --- wget-1.10-alpha1/src/options.h 2005-03-19 12:29:25.000000000 -0500 +++ wget-1.10-persistent/src/options.h 2005-04-07 21:31:48.000000000 -0400 @@ -193,6 +193,9 @@ int preserve_perm; /* whether remote permissions are used or that what is set by umask. */ + int persistent; /* whether retry after failure to connect, + login */ + #ifdef ENABLE_IPV6 int ipv4_only; /* IPv4 connections have been requested. */ int ipv6_only; /* IPv4 connections have been requested. */