Don't pattern-match server redirects

Hrvoje Niksic <[email protected]> Sat, 25 Jun 2005 17:04:31 +0200
Newsgroups gmane.comp.web.wget.patches
Message-ID <[email protected]>
This patch fixes Debian bug 163243 at http://tinyurl.com/a6zf3/.


2005-06-25  Hrvoje Niksic  <[email protected]>

	* http.c (http_loop): Don't warn about wildcards in HTTP URLs if
	globbing isn't requested in the first place.

	* retr.c (retrieve_url): Temporarily turn off globbing when
	processing HTTP->FTP redirects.

Index: src/http.c
===================================================================
--- src/http.c	(revision 1817)
+++ src/http.c	(working copy)
@@ -1996,7 +1996,7 @@
   *newloc = NULL;
 
   /* Warn on (likely bogus) wildcard usage in HTTP.  */
-  if (has_wildcards_p (u->path))
+  if (opt.ftp_glob && has_wildcards_p (u->path))
     logputs (LOG_VERBOSE, _("Warning: wildcards not supported in HTTP.\n"));
 
   xzero (hstat);
Index: src/ChangeLog
===================================================================
--- src/ChangeLog	(revision 1817)
+++ src/ChangeLog	(working copy)
@@ -1,5 +1,13 @@
Index: src/retr.c
===================================================================
--- src/retr.c	(revision 1817)
+++ src/retr.c	(working copy)
@@ -660,14 +660,16 @@
     }
   else if (u->scheme == SCHEME_FTP)
     {
-      /* If this is a redirection, we must not allow recursive FTP
-	 retrieval, so we save recursion to oldrec, and restore it
-	 later.  */
-      bool oldrec = opt.recursive;
+      /* If this is a redirection, temporarily turn off opt.ftp_glob
+	 and opt.recursive, both being undesirable when following
+	 redirects.  */
+      bool oldrec = opt.recursive, oldglob = opt.ftp_glob;
       if (redirection_count)
-	opt.recursive = false;
+	opt.recursive = opt.ftp_glob = false;
+
       result = ftp_loop (u, dt, proxy_url);
       opt.recursive = oldrec;
+      opt.ftp_glob = oldglob;
 
       /* There is a possibility of having HTTP being redirected to
 	 FTP.  In these cases we must decide whether the text is HTML