mirror of
https://github.com/mirror/wget.git
synced 2024-12-28 22:00:27 +08:00
Add new option --retry-on-host-error
* doc/wget.texi: Add docs for --retry-on-host-error * src/http.c (http_loop): Add code for HOSTERR * src/init.c: Add option --retry-on-host-error * src/main.c: Likewise * src/options.h: Add options.retry_on_host_error Copyright-paperwork-exempt: Yes
This commit is contained in:
parent
ad261f41ce
commit
e7979da9e8
@ -1750,6 +1750,10 @@ some few obscure servers, which never send HTTP authentication
|
||||
challenges, but accept unsolicited auth info, say, in addition to
|
||||
form-based authentication.
|
||||
|
||||
@item --retry-on-host-error
|
||||
Consider host errors, such as ``Temporary failure in name resolution'',
|
||||
as non-fatal, transient errors.
|
||||
|
||||
@item --retry-on-http-error=@var{code[,code,...]}
|
||||
Consider given HTTP response codes as non-fatal, transient errors.
|
||||
Supply a comma-separated list of 3-digit HTTP response codes as
|
||||
|
13
src/http.c
13
src/http.c
@ -4386,7 +4386,18 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
|
||||
logputs (LOG_VERBOSE, "\n");
|
||||
logprintf (LOG_NOTQUIET, _("Cannot write to %s (%s).\n"),
|
||||
quote (hstat.local_file), strerror (errno));
|
||||
case HOSTERR: case CONIMPOSSIBLE: case PROXERR: case SSLINITFAILED:
|
||||
case HOSTERR:
|
||||
/* Fatal unless option set otherwise. */
|
||||
if ( opt.retry_on_host_error )
|
||||
{
|
||||
printwhat (count, opt.ntry);
|
||||
xfree (hstat.message);
|
||||
xfree (hstat.error);
|
||||
continue;
|
||||
}
|
||||
ret = err;
|
||||
goto exit;
|
||||
case CONIMPOSSIBLE: case PROXERR: case SSLINITFAILED:
|
||||
case CONTNOTSUPPORTED: case VERIFCERTERR: case FILEBADFILE:
|
||||
case UNKNOWNATTR:
|
||||
/* Fatal errors just return from the function. */
|
||||
|
@ -313,6 +313,7 @@ static const struct {
|
||||
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
|
||||
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
|
||||
{ "retryconnrefused", &opt.retry_connrefused, cmd_boolean },
|
||||
{ "retryonhosterror", &opt.retry_on_host_error, cmd_boolean },
|
||||
{ "retryonhttperror", &opt.retry_on_http_error, cmd_string },
|
||||
{ "robots", &opt.use_robots, cmd_boolean },
|
||||
{ "savecookies", &opt.cookies_output, cmd_file },
|
||||
|
@ -420,6 +420,7 @@ static struct cmdline_option option_data[] =
|
||||
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
|
||||
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
|
||||
{ "retry-connrefused", 0, OPT_BOOLEAN, "retryconnrefused", -1 },
|
||||
{ "retry-on-host-error", 0, OPT_BOOLEAN, "retryonhosterror", -1 },
|
||||
{ "retry-on-http-error", 0, OPT_VALUE, "retryonhttperror", -1 },
|
||||
{ "save-cookies", 0, OPT_VALUE, "savecookies", -1 },
|
||||
{ "save-headers", 0, OPT_BOOLEAN, "saveheaders", -1 },
|
||||
|
@ -41,6 +41,7 @@ struct options
|
||||
bool quiet; /* Are we quiet? */
|
||||
int ntry; /* Number of tries per URL */
|
||||
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */
|
||||
bool retry_on_host_error; /* Treat host errors as non-fatal. */
|
||||
char *retry_on_http_error; /* Treat given HTTP errors as non-fatal. */
|
||||
bool background; /* Whether we should work in background. */
|
||||
bool ignore_length; /* Do we heed content-length at all? */
|
||||
|
Loading…
Reference in New Issue
Block a user