Index: main/trunk/greenstone2/perllib/downloaders/WebDownload.pm
===================================================================
--- main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31878)
+++ main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31880)
@@ -193,5 +193,5 @@
     my $strBaseCMD = $strOptions." --tries=2 -q -O - \"$self->{'url'}\"";
 
-    #&util::print_env(STDERR, "https_proxy", "http_proxy", "HTTPS_PROXY", "HTTP_PROXY", "ftp_proxy", "FTP_PROXY");
+    #&util::print_env(STDERR, "https_proxy", "http_proxy", "ftp_proxy");
     #&util::print_env(STDERR);	
     
@@ -201,9 +201,17 @@
 	
 	print STDERR "Server information is unavailable.\n";
-
-	#&util::print_env(STDERR, "https_proxy", "http_proxy");
-	
-	if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'}) { # if proxying set, the settings may be wrong
-	    &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxied_connect_failed_info}\n", $self->{'proxy_host'}, $self->{'proxy_port'});
+	
+	if ($self->{'proxy_on'}) { # if proxying set, the settings may be wrong
+	    &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxied_connect_failed_info}\n");
+	    
+	    if($self->{'http_proxy_host'} && defined $self->{'http_proxy_port'}) {
+		&gsprintf::gsprintf_multiline(STDERR, "{WebDownload.http_proxy_settings}\n", $self->{'http_proxy_host'}, $self->{'http_proxy_port'});
+	    }
+	    if($self->{'https_proxy_host'} && defined $self->{'https_proxy_port'}) {
+		&gsprintf::gsprintf_multiline(STDERR, "{WebDownload.https_proxy_settings}\n", $self->{'https_proxy_host'}, $self->{'https_proxy_port'});
+	    }
+	    if($self->{'ftp_proxy_host'} && defined $self->{'ftp_proxy_port'}) {
+		&gsprintf::gsprintf_multiline(STDERR, "{WebDownload.ftp_proxy_settings}\n", $self->{'ftp_proxy_host'}, $self->{'ftp_proxy_port'});
+	    }
 	} else { # else no proxy set, the user may need proxy settings
 	    &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxyless_connect_failed_info}\n");
Index: main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
===================================================================
--- main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31878)
+++ main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31880)
@@ -51,21 +51,41 @@
 	'reqd' => "no",
 	'hiddengli' => "yes"},
-      { 'name' => "proxy_host",  
-	'desc' => "{WgetDownload.proxy_host}",         
-	'type' => "string",
-	'reqd' => "no",
-	'hiddengli' => "yes"},
-      { 'name' => "proxy_port", 
-	'desc' => "{WgetDownload.proxy_port}",         
+      { 'name' => "http_proxy_host",
+	'desc' => "{WgetDownload.http_proxy_host}",
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
+      { 'name' => "http_proxy_port",
+	'desc' => "{WgetDownload.http_proxy_port}",
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
+      { 'name' => "https_proxy_host",  
+	'desc' => "{WgetDownload.https_proxy_host}",         
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
+      { 'name' => "https_proxy_port", 
+	'desc' => "{WgetDownload.https_proxy_port}",         
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
+      { 'name' => "ftp_proxy_host",  
+	'desc' => "{WgetDownload.ftp_proxy_host}",         
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
+      { 'name' => "ftp_proxy_port", 
+	'desc' => "{WgetDownload.ftp_proxy_port}",         
 	'type' => "string",
 	'reqd' => "no",
 	'hiddengli' => "yes"},
       { 'name' => "user_name",  
-	'desc' => "{WgetDownload.user_name}",         
+	'desc' => "{WgetDownload.user_name}",
 	'type' => "string",
 	'reqd' => "no",
 	'hiddengli' => "yes"},
       { 'name' => "user_password", 
-	'desc' => "{WgetDownload.user_password}",         
+	'desc' => "{WgetDownload.user_password}",
 	'type' => "string",
 	'reqd' => "no",
@@ -171,19 +191,28 @@
     my ($self) = @_;
     my $strOptions = "";
-    
-    if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'})
+
+    if($self->{'http_proxy_host'} && $self->{'http_proxy_port'}) {
+	$strOptions .= " -e http_proxy=$self->{'http_proxy_host'}:$self->{'http_proxy_port'} ";
+    }
+    if($self->{'https_proxy_host'} && $self->{'https_proxy_port'}) {
+	$strOptions .= " -e https_proxy=$self->{'https_proxy_host'}:$self->{'https_proxy_port'} ";
+    }
+    if($self->{'ftp_proxy_host'} && $self->{'ftp_proxy_port'}) {
+	$strOptions .= " -e ftp_proxy=$self->{'ftp_proxy_host'}:$self->{'ftp_proxy_port'} ";
+    }
+    
+    # For wget, there is only one set pair of proxy-user and proxy-passwd, so wget seems to assume
+    # that all 3 proxy protocols (http|https|ftp) will use the same username and pwd combination?
+    # Note that this only matters when passing the proxying details as flags to wget, not when
+    # the proxies are setup as environment variables.
+    if ($self->{'user_name'} && $self->{'user_password'})
     {
-	$strOptions .= " -e https_proxy=$self->{'proxy_host'}:$self->{'proxy_port'} ";	
-	$strOptions .= " -e http_proxy=$self->{'proxy_host'}:$self->{'proxy_port'} ";	    
-	
-	if ($self->{'user_name'} && $self->{'user_password'})
-	{
-	    $strOptions .= "--proxy-user=$self->{'user_name'}"." --proxy-passwd=$self->{'user_password'}";
-	}
-    }
-    
-    if ($self->{'proxy_on'}) {
-	$strOptions .= " --proxy ";
-    }
+	$strOptions .= "--proxy-user=$self->{'user_name'}"." --proxy-passwd=$self->{'user_password'}";	    
+	# how is "--proxy-passwd" instead of "--proxy-password" even working????	    
+	# see https://www.gnu.org/software/wget/manual/html_node/Proxies.html
+	# and https://www.gnu.org/software/wget/manual/wget.html
+	# Not touching this, in case the manual is simply wrong. Since our code works in 
+	# practice (when we were still using wget proxy username/pwd flags for windows).
+    }   
     
     return $strOptions;
@@ -202,7 +231,11 @@
     # http://www.perlmonks.org/?node=what%20is%20true%20and%20false%20in%20Perl%3F
     
-    if (!$ENV{'http_proxy'} && !$ENV{'https_proxy'}) {
-	$strOptions .= $self->addProxySettingsAsWgetFlags();
-    } # else wget will use proxy settings in environment, assume enough settings have been provided
+    if ($self->{'proxy_on'}) {
+	if(!$ENV{'http_proxy'} && !$ENV{'https_proxy'} && !$ENV{'ftp_proxy'}) {
+	    $strOptions .= $self->addProxySettingsAsWgetFlags();
+	} # else wget will use proxy settings in environment, assume enough settings have been provided
+	# either way, we're using the proxy
+	$strOptions .= " --proxy ";
+    }
     
     if($self->{'no_check_certificate'}) { # URL may be http that gets redirected to https, so if no_check_certificate is on, turn it on even if URL is http
