X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fretr.c;h=0fc468377ab0d4f91abe8af6980882bea1505baa;hp=364377226025d58943fdcc85040b1b76d4069929;hb=e4371807f6eb9ee6d0cc7828773e792fbecb5ce5;hpb=462e643a7e31676eceda23e634241f7b4d2cd7bb diff --git a/src/retr.c b/src/retr.c index 36437722..0fc46837 100644 --- a/src/retr.c +++ b/src/retr.c @@ -1,6 +1,6 @@ /* File retrieval. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -51,6 +51,7 @@ as that of the covered work. */ #include "hash.h" #include "convert.h" #include "ptimer.h" +#include "html-url.h" /* Total size of downloaded files. Used to enforce quota. */ SUM_SIZE_INT total_downloaded_bytes; @@ -778,6 +779,8 @@ retrieve_url (const char *origurl, char **file, char **newloc, register_redirection (origurl, u->url); if (*dt & TEXTHTML) register_html (u->url, local_file); + if (*dt & TEXTCSS) + register_css (u->url, local_file); } } @@ -819,10 +822,32 @@ retrieve_from_file (const char *file, bool html, int *count) uerr_t status; struct urlpos *url_list, *cur_url; - url_list = (html ? get_urls_html (file, NULL, NULL) - : get_urls_file (file)); + char *input_file = NULL; + const char *url = file; + status = RETROK; /* Suppose everything is OK. */ *count = 0; /* Reset the URL count. */ + + if (url_has_scheme (url)) + { + int dt; + uerr_t status; + + if (!opt.base_href) + opt.base_href = xstrdup (url); + + status = retrieve_url (url, &input_file, NULL, NULL, &dt, false); + if (status != RETROK) + return status; + + if (dt & TEXTHTML) + html = true; + } + else + input_file = (char *) file; + + url_list = (html ? get_urls_html (input_file, NULL, NULL) + : get_urls_file (input_file)); for (cur_url = url_list; cur_url; cur_url = cur_url->next, ++*count) {