mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix crash when receiving a HTTP redirect upon a POST request
The crash was introduced by a recent commit.
This commit is contained in:
parent
8dc52c6eaa
commit
550457bcad
@ -1,3 +1,11 @@
|
|||||||
|
2013-05-01 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* init.c: Declare `cmd_string_uppercase'.
|
||||||
|
(commands): Now `method' uses cmd_string_uppercase.
|
||||||
|
(cmd_string_uppercase): New method
|
||||||
|
* http.c (gethttp): Do not transform opt.method to uppercase.
|
||||||
|
Reported by: Stefano Lattarini <stefano.lattarini@gmail.com>
|
||||||
|
|
||||||
2013-04-24 Darshit Shah <darnir@gmail.com>
|
2013-04-24 Darshit Shah <darnir@gmail.com>
|
||||||
|
|
||||||
* http.c (gethttp): Remove check for opt.post_data and
|
* http.c (gethttp): Remove check for opt.post_data and
|
||||||
|
@ -1766,12 +1766,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
|
|||||||
if (head_only)
|
if (head_only)
|
||||||
meth = "HEAD";
|
meth = "HEAD";
|
||||||
else if (opt.method)
|
else if (opt.method)
|
||||||
{
|
|
||||||
char *q;
|
|
||||||
for (q = opt.method; *q; ++q)
|
|
||||||
*q = c_toupper (*q);
|
|
||||||
meth = opt.method;
|
meth = opt.method;
|
||||||
}
|
|
||||||
/* Use the full path, i.e. one that includes the leading slash and
|
/* Use the full path, i.e. one that includes the leading slash and
|
||||||
the query string. E.g. if u->path is "foo/bar" and u->query is
|
the query string. E.g. if u->path is "foo/bar" and u->query is
|
||||||
"param=value", full_path will be "/foo/bar?param=value". */
|
"param=value", full_path will be "/foo/bar?param=value". */
|
||||||
|
21
src/init.c
21
src/init.c
@ -87,6 +87,7 @@ CMD_DECLARE (cmd_directory_vector);
|
|||||||
CMD_DECLARE (cmd_number);
|
CMD_DECLARE (cmd_number);
|
||||||
CMD_DECLARE (cmd_number_inf);
|
CMD_DECLARE (cmd_number_inf);
|
||||||
CMD_DECLARE (cmd_string);
|
CMD_DECLARE (cmd_string);
|
||||||
|
CMD_DECLARE (cmd_string_uppercase);
|
||||||
CMD_DECLARE (cmd_file);
|
CMD_DECLARE (cmd_file);
|
||||||
CMD_DECLARE (cmd_directory);
|
CMD_DECLARE (cmd_directory);
|
||||||
CMD_DECLARE (cmd_time);
|
CMD_DECLARE (cmd_time);
|
||||||
@ -212,7 +213,7 @@ static const struct {
|
|||||||
{ "logfile", &opt.lfilename, cmd_file },
|
{ "logfile", &opt.lfilename, cmd_file },
|
||||||
{ "login", &opt.ftp_user, cmd_string },/* deprecated*/
|
{ "login", &opt.ftp_user, cmd_string },/* deprecated*/
|
||||||
{ "maxredirect", &opt.max_redirect, cmd_number },
|
{ "maxredirect", &opt.max_redirect, cmd_number },
|
||||||
{ "method", &opt.method, cmd_string },
|
{ "method", &opt.method, cmd_string_uppercase },
|
||||||
{ "mirror", NULL, cmd_spec_mirror },
|
{ "mirror", NULL, cmd_spec_mirror },
|
||||||
{ "netrc", &opt.netrc, cmd_boolean },
|
{ "netrc", &opt.netrc, cmd_boolean },
|
||||||
{ "noclobber", &opt.noclobber, cmd_boolean },
|
{ "noclobber", &opt.noclobber, cmd_boolean },
|
||||||
@ -959,8 +960,24 @@ cmd_string (const char *com, const char *val, void *place)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Like cmd_string but ensure the string is upper case. */
|
||||||
|
static bool
|
||||||
|
cmd_string_uppercase (const char *com, const char *val, void *place)
|
||||||
|
{
|
||||||
|
char *q;
|
||||||
|
bool ret = cmd_string (com, val, place);
|
||||||
|
q = *((char **) place);
|
||||||
|
if (!ret || q == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Like the above, but handles tilde-expansion when reading a user's
|
while (*q)
|
||||||
|
*q++ = c_toupper (*q);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Like cmd_string, but handles tilde-expansion when reading a user's
|
||||||
`.wgetrc'. In that case, and if VAL begins with `~', the tilde
|
`.wgetrc'. In that case, and if VAL begins with `~', the tilde
|
||||||
gets expanded to the user's home directory. */
|
gets expanded to the user's home directory. */
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user