mirror of
https://github.com/mirror/wget.git
synced 2024-12-29 14:30:48 +08:00
[svn] retr.c (retrieve_url): Manually applied T. Bharath
<TBharath@responsenetworks.com>'s patch to get wget to grok illegal relative URL redirects. Reformatted and re-commented it.
This commit is contained in:
parent
4d925ebc24
commit
24c465b5ad
@ -1,3 +1,7 @@
|
||||
2000-10-27 Dan Harkless <dan-wget@dilvish.speed.net>
|
||||
|
||||
* TODO: wget now groks illegal relative URL HTTP redirects.
|
||||
|
||||
2000-10-24 Dan Harkless <dan-wget@dilvish.speed.net>
|
||||
|
||||
* NEWS: Forgot to update regarding new --bind-address option.
|
||||
|
3
TODO
3
TODO
@ -28,9 +28,6 @@ may tend towards the top). Not all of these represent user-visible changes.
|
||||
|
||||
* --retr-symlinks should cause wget to traverse links to directories too.
|
||||
|
||||
* Lots of noncompliant webservers issue HTTP redirects to relative URLs, and
|
||||
browsers follow them, so wget should too.
|
||||
|
||||
* Make wget return non-zero status in more situations, like incorrect HTTP auth.
|
||||
|
||||
* Timestamps are sometimes not copied over on files retrieved by FTP.
|
||||
|
@ -1,3 +1,9 @@
|
||||
2000-10-27 Dan Harkless <dan-wget@dilvish.speed.net>
|
||||
|
||||
* retr.c (retrieve_url): Manually applied T. Bharath
|
||||
<TBharath@responsenetworks.com>'s patch to get wget to grok
|
||||
illegal relative URL redirects. Reformatted and re-commented it.
|
||||
|
||||
2000-10-23 Dan Harkless <dan-wget@dilvish.speed.net>
|
||||
|
||||
* connect.c (make_connection and bindport): Manually applied Rob
|
||||
|
22
src/retr.c
22
src/retr.c
@ -406,6 +406,28 @@ retrieve_url (const char *origurl, char **file, char **newloc,
|
||||
}
|
||||
if (mynewloc)
|
||||
{
|
||||
/* The HTTP specs only allow absolute URLs to appear in redirects, but
|
||||
a ton of boneheaded webservers and CGIs out there break the rules
|
||||
and use relative URLs, and popular browsers are lenient about this,
|
||||
so wget should be too. */
|
||||
if (strstr(mynewloc, "://") == NULL)
|
||||
/* Doesn't look like an absolute URL (this check will incorrectly
|
||||
think that rare relative URLs containing "://" later in the
|
||||
string are absolute). */
|
||||
{
|
||||
char *temp = malloc(strlen(url) + strlen(mynewloc) + 1);
|
||||
|
||||
if (mynewloc[0] == '/')
|
||||
/* "Hostless absolute" URL. Convert to absolute. */
|
||||
sprintf(temp,"%s%s", url, mynewloc);
|
||||
else
|
||||
/* Relative URL. Convert to absolute. */
|
||||
sprintf(temp,"%s/%s", url, mynewloc);
|
||||
|
||||
free(mynewloc);
|
||||
mynewloc = temp;
|
||||
}
|
||||
|
||||
free (url);
|
||||
url = mynewloc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user