mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Merging fix #20499: MAX_REDIRECTIONS should be configurable.
This commit is contained in:
parent
01346093a8
commit
10da871ac4
@ -1,3 +1,7 @@
|
||||
2007-07-28 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* wget.texi <HTTP Options>: Added --max-redirect option.
|
||||
|
||||
2007-07-05 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* fdl.texi:
|
||||
|
@ -1239,6 +1239,13 @@ wget --header="Host: foo.bar" http://localhost/
|
||||
In versions of Wget prior to 1.10 such use of @samp{--header} caused
|
||||
sending of duplicate headers.
|
||||
|
||||
@cindex redirect
|
||||
@item --max-redirect=@var{number}
|
||||
Specifies the maximum number of redirections to follow for a resource.
|
||||
The default is 20, which is usually far more than necessary. However, on
|
||||
those occasions where you want to allow more (or fewer), this is the
|
||||
option to use.
|
||||
|
||||
@cindex proxy user
|
||||
@cindex proxy password
|
||||
@cindex proxy authentication
|
||||
|
@ -1,3 +1,20 @@
|
||||
2007-07-28 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* options.h, init.c, retr.c, main.c: renamed opt maxredirect
|
||||
field to max_redirect, for improved consistency.
|
||||
* init.c: changed max_redirect parser from cmd_number_inf to
|
||||
cmd_number, as infinite redirects may not be appropriate.
|
||||
Alternatively, if cmd_number_inf should be used, then
|
||||
opt.max_redirect's value should be checked a bit differently in
|
||||
retr.c, to allow for the "infinite" meaning of zero.
|
||||
|
||||
2007-07-16 Joshua David Williams <yurimxpxman@gmail.com>
|
||||
|
||||
* options.h: added maxredirect to options struct
|
||||
* init.c: added maxredirect to list of variables
|
||||
* retr.c (retrieve_url): replaced MAX_REDIRECTIONS with opt.maxredirect
|
||||
* main.c: added option --max-redirect
|
||||
|
||||
2007-07-16 Joshua David Williams <yurimxpxman@gmail.com>
|
||||
|
||||
* test.h: tests made more verbose; now displays the name
|
||||
|
@ -182,6 +182,7 @@ static struct {
|
||||
{ "loadcookies", &opt.cookies_input, cmd_file },
|
||||
{ "logfile", &opt.lfilename, cmd_file },
|
||||
{ "login", &opt.ftp_user, cmd_string },/* deprecated*/
|
||||
{ "maxredirect", &opt.max_redirect, cmd_number },
|
||||
{ "mirror", NULL, cmd_spec_mirror },
|
||||
{ "netrc", &opt.netrc, cmd_boolean },
|
||||
{ "noclobber", &opt.noclobber, cmd_boolean },
|
||||
@ -321,6 +322,7 @@ defaults (void)
|
||||
opt.restrict_files_case = restrict_no_case_restriction;
|
||||
|
||||
opt.content_disposition = true;
|
||||
opt.max_redirect = 20;
|
||||
}
|
||||
|
||||
/* Return the user's home directory (strdup-ed), or NULL if none is
|
||||
|
@ -189,6 +189,7 @@ static struct cmdline_option option_data[] =
|
||||
{ "level", 'l', OPT_VALUE, "reclevel", -1 },
|
||||
{ "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
|
||||
{ "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
|
||||
{ "max-redirect", 0, OPT_VALUE, "maxredirect", -1 },
|
||||
{ "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
|
||||
{ "no", 'n', OPT__NO, NULL, required_argument },
|
||||
{ "no-clobber", 0, OPT_BOOLEAN, "noclobber", -1 },
|
||||
@ -496,6 +497,8 @@ HTTP options:\n"),
|
||||
--ignore-length ignore `Content-Length' header field.\n"),
|
||||
N_("\
|
||||
--header=STRING insert STRING among the headers.\n"),
|
||||
N_("\
|
||||
--max-redirect maximum redirections allowed per page.\n"),
|
||||
N_("\
|
||||
--proxy-user=USER set USER as proxy username.\n"),
|
||||
N_("\
|
||||
|
@ -36,8 +36,10 @@ struct options
|
||||
bool background; /* Whether we should work in background. */
|
||||
bool ignore_length; /* Do we heed content-length at all? */
|
||||
bool recursive; /* Are we recursive? */
|
||||
bool spanhost; /* Do we span across hosts in
|
||||
bool spanhost; /* Do we span across hosts in
|
||||
recursion? */
|
||||
int max_redirect; /* Maximum number of times we'll allow
|
||||
a page to redirect. */
|
||||
bool relative_only; /* Follow only relative links. */
|
||||
bool no_parent; /* Restrict access to the parent
|
||||
directory. */
|
||||
|
10
src/retr.c
10
src/retr.c
@ -567,12 +567,6 @@ calc_rate (wgint bytes, double secs, int *units)
|
||||
return dlrate;
|
||||
}
|
||||
|
||||
/* Maximum number of allowed redirections. 20 was chosen as a
|
||||
"reasonable" value, which is low enough to not cause havoc, yet
|
||||
high enough to guarantee that normal retrievals will not be hurt by
|
||||
the check. */
|
||||
|
||||
#define MAX_REDIRECTIONS 20
|
||||
|
||||
#define SUSPEND_POST_DATA do { \
|
||||
post_data_suspended = true; \
|
||||
@ -746,10 +740,10 @@ retrieve_url (const char *origurl, char **file, char **newloc,
|
||||
mynewloc = xstrdup (newloc_parsed->url);
|
||||
|
||||
/* Check for max. number of redirections. */
|
||||
if (++redirection_count > MAX_REDIRECTIONS)
|
||||
if (++redirection_count > opt.max_redirect)
|
||||
{
|
||||
logprintf (LOG_NOTQUIET, _("%d redirections exceeded.\n"),
|
||||
MAX_REDIRECTIONS);
|
||||
opt.max_redirect);
|
||||
url_free (newloc_parsed);
|
||||
url_free (u);
|
||||
xfree (url);
|
||||
|
Loading…
Reference in New Issue
Block a user