recursive FTP retrieval through HTTP proxy fixed

Mauro Tortonesi <[email protected]> Mon, 12 Jun 2006 17:30:01 +0200
Newsgroups gmane.comp.web.wget.patches
Message-ID <[email protected]>
This patch fixes recursive FTP retrieval through HTTP proxy. Many thanks to 
  CHEN Peng and Tony Lewis.


2006-06-12  Mauro Tortonesi  <[email protected]>

	* retr.c (retrieve_from_file): Use retrieve_tree and automatically
	turn on opt.follow_ftp in case of recursive FTP retrieval through
         HTTP proxy.

	* main.c: Automatically turn on opt.follow_ftp in case of recursive
	FTP retrieval through HTTP proxy.

2006-06-12  Tony Lewis  <[email protected]>

	* main.c: Improved CHEN Peng's patch by proposing a simpler logic.

2006-06-12  CHEN Peng  <[email protected]>

	* main.c: Use retrieve_tree in case of recursive FTP retrieval
         through	HTTP proxy.


P.S. sorry for the messed up line wrappings in my patches, but it
      seems that my old version of thunderbird won't let me to disable
      automatic text wrapping. too bad.


Index: src/retr.c
===================================================================
--- src/retr.c	(revision 2147)
+++ src/retr.c	(working copy)
@@ -844,8 +844,18 @@
  	  break;
  	}
        if ((opt.recursive || opt.page_requisites)
-	  && cur_url->url->scheme != SCHEME_FTP)
+	  && (cur_url->url->scheme != SCHEME_FTP || opt.use_proxy))
+      	{
+	  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);

Index: src/main.c
===================================================================
--- src/main.c	(revision 2147)
+++ src/main.c	(working copy)
@@ -945,8 +945,18 @@
        int dt;

        if ((opt.recursive || opt.page_requisites)
-	  && url_scheme (*t) != SCHEME_FTP)
+	  && (url_scheme (*t) != SCHEME_FTP || opt.use_proxy))
+      	{
+	  int old_follow_ftp = opt.follow_ftp;
+
+	  /* Turn opt.follow_ftp on in case of recursive FTP retrieval */
+	  if (url_scheme (*t) == SCHEME_FTP)
+	    opt.follow_ftp = 1;
+	
  	status = retrieve_tree (*t);
+
+	  opt.follow_ftp = old_follow_ftp;
+	}
        else
  	status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt, 
opt.recursive);



-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi                          http://www.tortonesi.com

University of Ferrara - Dept. of Eng.    http://www.ing.unife.it
GNU Wget - HTTP/FTP file retrieval tool  http://www.gnu.org/software/wget
Deep Space 6 - IPv6 for Linux            http://www.deepspace6.net
Ferrara Linux User Group                 http://www.ferrara.linux.it