1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Fix #20811: Assertion failure with --spider --recursive.

This commit is contained in:
micah 2007-08-29 21:36:30 -07:00
parent adc0632654
commit 02a54e9919
3 changed files with 11 additions and 2 deletions

View File

@ -38,6 +38,12 @@
RETRUNNEEDED appears never to be referenced outside of RETRUNNEEDED appears never to be referenced outside of
http.c (and wget.h), and, when returned by gethttp, is http.c (and wget.h), and, when returned by gethttp, is
translated by http_loop to RETROK. translated by http_loop to RETROK.
* url.c (are_urls_equal): Don't call getchar_from_escaped_string
if u2 is shorter than u1.
(test_are_urls_equal): Added tests to handle u2 shorter than u1,
and %2f not treated the same as / (latter currently fails).
* spider.c (in_url_list_p): Don't call are_urls_equal if one of
them is NULL.
2007-08-23 Joshua David Williams <yurimxpxman@gmail.com> 2007-08-23 Joshua David Williams <yurimxpxman@gmail.com>

View File

@ -74,7 +74,7 @@ in_url_list_p (const struct url_list *list, const char *url)
for (ptr = list; ptr; ptr = ptr->next) for (ptr = list; ptr; ptr = ptr->next)
{ {
/* str[case]cmp is inadequate for URL comparison */ /* str[case]cmp is inadequate for URL comparison */
if (are_urls_equal (url, ptr->url)) if (ptr->url != NULL && are_urls_equal (url, ptr->url))
return true; return true;
} }

View File

@ -1971,11 +1971,12 @@ are_urls_equal (const char *u1, const char *u2)
const char *p, *q; const char *p, *q;
int pp, qq; int pp, qq;
char ch1, ch2; char ch1, ch2;
assert(u1 && u2);
p = u1; p = u1;
q = u2; q = u2;
while (*p while (*p && *q
&& (pp = getchar_from_escaped_string (p, &ch1)) && (pp = getchar_from_escaped_string (p, &ch1))
&& (qq = getchar_from_escaped_string (q, &ch2)) && (qq = getchar_from_escaped_string (q, &ch2))
&& (TOLOWER(ch1) == TOLOWER(ch2))) && (TOLOWER(ch1) == TOLOWER(ch2)))
@ -2111,6 +2112,8 @@ test_are_urls_equal()
{ "http://www.adomain.com/apath/", "http://www.adomain.com/anotherpath/", false }, { "http://www.adomain.com/apath/", "http://www.adomain.com/anotherpath/", false },
{ "http://www.adomain.com/apath/", "http://www.anotherdomain.com/path/", false }, { "http://www.adomain.com/apath/", "http://www.anotherdomain.com/path/", false },
{ "http://www.adomain.com/~path/", "http://www.adomain.com/%7epath/", true }, { "http://www.adomain.com/~path/", "http://www.adomain.com/%7epath/", true },
{ "http://www.adomain.com/longer-path/", "http://www.adomain.com/path/", false },
{ "http://www.adomain.com/path%2f", "http://www.adomain.com/path/", false },
}; };
for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i) for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i)