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

Fix a problem when -k is specified and url's are specified in CSS code.

This commit is contained in:
Giuseppe Scrivano 2010-07-30 01:00:26 +02:00
parent 75c6ca0f5d
commit e095cc064e
5 changed files with 35 additions and 10 deletions

3
NEWS
View File

@ -36,6 +36,9 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
** By default, on server redirects, use the original URL to get the ** By default, on server redirects, use the original URL to get the
local file name. Close CVE-2010-2252. local file name. Close CVE-2010-2252.
** Fix a problem when -k is used and some URLs are specified trough
CSS.
* Changes in Wget 1.12 * Changes in Wget 1.12

View File

@ -1,3 +1,12 @@
2010-07-30 Giuseppe Scrivano <gscrivano@gnu.org>
* html-url.h (struct map_context): Remove member `tail'.
* html-url.c (append_url): Append the new url ordered by `position'.
(get_urls_html): Do not initialize `ctx.tail'.
* css-url.c (get_urls_css_file): Do not initialize `ctx.tail'.
2010-07-29 Giuseppe Scrivano <gscrivano@gnu.org> 2010-07-29 Giuseppe Scrivano <gscrivano@gnu.org>
* gnutls.c (wgnutls_peek): Don't read more data if the buffered peek * gnutls.c (wgnutls_peek): Don't read more data if the buffered peek

View File

@ -261,7 +261,7 @@ get_urls_css_file (const char *file, const char *url)
DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length))); DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length)));
ctx.text = fm->content; ctx.text = fm->content;
ctx.head = ctx.tail = NULL; ctx.head = NULL;
ctx.base = NULL; ctx.base = NULL;
ctx.parent_base = url ? url : opt.base_href; ctx.parent_base = url ? url : opt.base_href;
ctx.document_file = file; ctx.document_file = file;

View File

@ -335,13 +335,27 @@ append_url (const char *link_uri, int position, int size,
else if (link_has_scheme) else if (link_has_scheme)
newel->link_complete_p = 1; newel->link_complete_p = 1;
if (ctx->tail) /* Append the new URL maintaining the order by position. */
{ if (ctx->head == NULL)
ctx->tail->next = newel; ctx->head = newel;
ctx->tail = newel;
}
else else
ctx->tail = ctx->head = newel; {
struct urlpos *it, *prev = NULL;
it = ctx->head;
while (it && position > it->pos)
{
prev = it;
it = it->next;
}
newel->next = it;
if (prev)
prev->next = newel;
else
ctx->head = newel;
}
return newel; return newel;
} }
@ -668,7 +682,7 @@ get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length))); DEBUGP (("Loaded %s (size %s).\n", file, number_to_static_string (fm->length)));
ctx.text = fm->content; ctx.text = fm->content;
ctx.head = ctx.tail = NULL; ctx.head = NULL;
ctx.base = NULL; ctx.base = NULL;
ctx.parent_base = url ? url : opt.base_href; ctx.parent_base = url ? url : opt.base_href;
ctx.document_file = file; ctx.document_file = file;

View File

@ -40,8 +40,7 @@ struct map_context {
bool nofollow; /* whether NOFOLLOW was specified in a bool nofollow; /* whether NOFOLLOW was specified in a
<meta name=robots> tag. */ <meta name=robots> tag. */
struct urlpos *head, *tail; /* List of URLs that is being struct urlpos *head; /* List of URLs that is being built. */
built. */
}; };
struct urlpos *get_urls_file (const char *); struct urlpos *get_urls_file (const char *);