]> sjero.net Git - wget/blobdiff - src/retr.c
Ted Mielczarek's CSS wonder-patch, applied against the source from around the time...
[wget] / src / retr.c
index 18a7b3233817e1c6786284b5a1d472fbed2655cf..245eb129f40d5f49644d0bb69de1e7489f54cf1d 100644 (file)
@@ -1,5 +1,5 @@
 /* File retrieval.
-   Copyright (C) 1996-2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -51,6 +51,7 @@ so, delete this exception statement from your version.  */
 #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;
@@ -784,6 +785,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);
        }
     }
 
@@ -844,8 +847,18 @@ retrieve_from_file (const char *file, bool html, int *count)
          break;
        }
       if ((opt.recursive || opt.page_requisites)
-         && cur_url->url->scheme != SCHEME_FTP)
-       status = retrieve_tree (cur_url->url->url);
+         && (cur_url->url->scheme != SCHEME_FTP || getproxy (cur_url->url)))
+       {
+         int old_follow_ftp = opt.follow_ftp;
+
+         /* Turn opt.follow_ftp on in case of recursive FTP retrieval */
+         if (cur_url->url->scheme == SCHEME_FTP) 
+           opt.follow_ftp = 1;
+         
+         status = retrieve_tree (cur_url->url->url);
+
+         opt.follow_ftp = old_follow_ftp;
+       }
       else
        status = retrieve_url (cur_url->url->url, &filename, &new_file, NULL, &dt, opt.recursive);
 
@@ -1012,6 +1025,20 @@ getproxy (struct url *u)
   return proxy;
 }
 
+/* Returns true if URL would be downloaded through a proxy. */
+
+bool
+url_uses_proxy (const char *url)
+{
+  bool ret;
+  struct url *u = url_parse (url, NULL);
+  if (!u)
+    return false;
+  ret = getproxy (u) != NULL;
+  url_free (u);
+  return ret;
+}
+
 /* Should a host be accessed through proxy, concerning no_proxy?  */
 static bool
 no_proxy_match (const char *host, const char **no_proxy)