mirror of
https://github.com/mirror/wget.git
synced 2025-03-29 13:30:30 +08:00
Revert "Add support for --retry-on-http-error"
This reverts commit 977276374d
.
This commit is contained in:
parent
80c62c238e
commit
05acf5d3f6
@ -1718,21 +1718,6 @@ some few obscure servers, which never send HTTP authentication
|
|||||||
challenges, but accept unsolicited auth info, say, in addition to
|
challenges, but accept unsolicited auth info, say, in addition to
|
||||||
form-based authentication.
|
form-based authentication.
|
||||||
|
|
||||||
@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
|
|
||||||
argument. Useful to work around special circumstances where retries
|
|
||||||
are required, but the server responds with an error code normally not
|
|
||||||
retried by Wget. Such errors might be 503 (Service Unavailable) and
|
|
||||||
429 (Too Many Requests). Retries enabled by this option are performed
|
|
||||||
subject to the normal retry timing and retry count limitations of
|
|
||||||
Wget.
|
|
||||||
|
|
||||||
Using this option is intended to support special use cases only and is
|
|
||||||
generally not recommended, as it can force retries even in cases where
|
|
||||||
the server is actually trying to decrease its load. Please use it
|
|
||||||
wisely and only if you know what you are doing.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node HTTPS (SSL/TLS) Options, FTP Options, HTTP Options, Invoking
|
@node HTTPS (SSL/TLS) Options, FTP Options, HTTP Options, Invoking
|
||||||
|
29
src/http.c
29
src/http.c
@ -3982,30 +3982,6 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether the supplied HTTP status code is among those
|
|
||||||
listed for the --retry-on-http-error option. */
|
|
||||||
static bool
|
|
||||||
check_retry_on_http_error (const int statcode)
|
|
||||||
{
|
|
||||||
if (!opt.retry_on_http_error)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool ret = false;
|
|
||||||
char * retry_conf = strdup(opt.retry_on_http_error);
|
|
||||||
char * tok = strtok(retry_conf, ",");
|
|
||||||
while (tok)
|
|
||||||
{
|
|
||||||
if (atoi(tok) == statcode)
|
|
||||||
{
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tok = strtok(NULL, ",");
|
|
||||||
}
|
|
||||||
free(retry_conf);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The genuine HTTP loop! This is the part where the retrieval is
|
/* The genuine HTTP loop! This is the part where the retrieval is
|
||||||
retried, and retried, and retried, and... */
|
retried, and retried, and retried, and... */
|
||||||
uerr_t
|
uerr_t
|
||||||
@ -4343,11 +4319,6 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
|
|||||||
logprintf (LOG_NOTQUIET, _("\
|
logprintf (LOG_NOTQUIET, _("\
|
||||||
Remote file does not exist -- broken link!!!\n"));
|
Remote file does not exist -- broken link!!!\n"));
|
||||||
}
|
}
|
||||||
else if (check_retry_on_http_error(hstat.statcode))
|
|
||||||
{
|
|
||||||
printwhat (count, opt.ntry);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logprintf (LOG_NOTQUIET, _("%s ERROR %d: %s.\n"),
|
logprintf (LOG_NOTQUIET, _("%s ERROR %d: %s.\n"),
|
||||||
|
@ -304,7 +304,6 @@ static const struct {
|
|||||||
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
|
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
|
||||||
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
|
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
|
||||||
{ "retryconnrefused", &opt.retry_connrefused, cmd_boolean },
|
{ "retryconnrefused", &opt.retry_connrefused, cmd_boolean },
|
||||||
{ "retryonhttperror", &opt.retry_on_http_error, cmd_string },
|
|
||||||
{ "robots", &opt.use_robots, cmd_boolean },
|
{ "robots", &opt.use_robots, cmd_boolean },
|
||||||
{ "savecookies", &opt.cookies_output, cmd_file },
|
{ "savecookies", &opt.cookies_output, cmd_file },
|
||||||
{ "saveheaders", &opt.save_headers, cmd_boolean },
|
{ "saveheaders", &opt.save_headers, cmd_boolean },
|
||||||
|
@ -404,7 +404,6 @@ static struct cmdline_option option_data[] =
|
|||||||
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
|
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
|
||||||
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
|
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
|
||||||
{ "retry-connrefused", 0, OPT_BOOLEAN, "retryconnrefused", -1 },
|
{ "retry-connrefused", 0, OPT_BOOLEAN, "retryconnrefused", -1 },
|
||||||
{ "retry-on-http-error", 0, OPT_VALUE, "retryonhttperror", -1 },
|
|
||||||
{ "save-cookies", 0, OPT_VALUE, "savecookies", -1 },
|
{ "save-cookies", 0, OPT_VALUE, "savecookies", -1 },
|
||||||
{ "save-headers", 0, OPT_BOOLEAN, "saveheaders", -1 },
|
{ "save-headers", 0, OPT_BOOLEAN, "saveheaders", -1 },
|
||||||
{ IF_SSL ("secure-protocol"), 0, OPT_VALUE, "secureprotocol", -1 },
|
{ IF_SSL ("secure-protocol"), 0, OPT_VALUE, "secureprotocol", -1 },
|
||||||
|
@ -43,7 +43,6 @@ struct options
|
|||||||
bool quiet; /* Are we quiet? */
|
bool quiet; /* Are we quiet? */
|
||||||
int ntry; /* Number of tries per URL */
|
int ntry; /* Number of tries per URL */
|
||||||
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */
|
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */
|
||||||
char *retry_on_http_error; /* Treat given HTTP errors as non-fatal. */
|
|
||||||
bool background; /* Whether we should work in background. */
|
bool background; /* Whether we should work in background. */
|
||||||
bool ignore_length; /* Do we heed content-length at all? */
|
bool ignore_length; /* Do we heed content-length at all? */
|
||||||
bool recursive; /* Are we recursive? */
|
bool recursive; /* Are we recursive? */
|
||||||
|
Loading…
Reference in New Issue
Block a user