+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.
* --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.
+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
}
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;
}