Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java	(revision 31863)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java	(revision 31864)
@@ -766,8 +766,5 @@
 
 	    if(user_pass.indexOf("@") != -1) {
-			
-		// Write the use proxy command - we don't do this anymore, instead we set environment variables - hopefully these can't be spied on like the following can (using ps) - actually the environment stuff didn't work for windows, so lets go back to this
-		if (Utility.isWindows()) {
-		   
+	   
 		   arg.setValue("true"); // proxy_on argument
 		   arg.setAssigned(true);
@@ -780,4 +777,8 @@
 		   arg.setValue(proxy_port);
 		   arg.setAssigned(true);
+
+		
+		// Write the use proxy command - we don't do this anymore, instead we set environment variables - hopefully these can't be spied on like the following can (using ps) - actually the environment stuff didn't work for windows, so lets go back to this
+		if (Utility.isWindows()) {
 	    
 		   arg = current_download.getArgument("user_name");
@@ -799,7 +800,16 @@
 	    }
 	    else{
+		// unset proxy_on argument
+		arg = current_download.getArgument("proxy_on");
+		arg.setValue("false"); 
+		arg.setAssigned(false);
 		return false;
 	    }
 
+	} else {
+	    // unset proxy_on argument
+	    arg = current_download.getArgument("proxy_on");
+	    arg.setValue("false"); 
+	    arg.setAssigned(false);
 	}
 	
@@ -830,5 +840,11 @@
 	    String str_url = "";
 	    if( arg_url!= null && arg_url.isAssigned()) {
-		str_url = arg_url.getValue();
+		str_url = arg_url.getValue();	    
+		/*
+		String redirected_url = getRedirectURL(str_url); // work out the real URL
+		if(!str_url.equals(redirected_url)) {
+		    arg_url.setValue(redirected_url);
+		}
+		*/
 	    }
 
@@ -842,7 +858,4 @@
 		no_check_cert_arg.setAssigned(false); // only assigned Arguments have values
 	    }
-	    
-	    
-	    //str_url = getRedirectURL(str_url); // work out the real URL
 
  	    server_info = new ServerInfoDialog(str_url ,proxy_url, mode,(Download)download_map.get(mode));
Index: /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm
===================================================================
--- /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31863)
+++ /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31864)
@@ -40,5 +40,6 @@
 use strict; # every perl program should have this!
 no strict 'refs'; # make an exception so we can use variables as filehandles
-no strict 'subs';
+no strict 'subs'; # to pass STDERR/STDOUT to functions
+
 use gsprintf 'gsprintf';
 
@@ -192,6 +193,4 @@
     my $strBaseCMD = $strOptions." --tries=2 -q -O - \"$self->{'url'}\"";
 
-    #print STDOUT "\n@@@@ GETTING server_info with WGET CMD: $strBaseCMD\n\n";
-    
     my $strIdentifyText = $self->useWget($strBaseCMD);
     
@@ -200,4 +199,6 @@
 	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'});
Index: /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
===================================================================
--- /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31863)
+++ /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31864)
@@ -169,26 +169,36 @@
     my ($self) = @_;
     my $strOptions = "";
-    
-    if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'})
-    {
-
-	if($self->{'url'} =~ m/^https\:/) {
+
+    # If http_proxy ENV VARS are not set, but proxy Perl vars are set, then we're on Windows
+    # and need to use the proxy vars as flags to wget
+    # If http_proxy Env Vars are set, then we're on Linux, wget will use the http(s) proxy
+    # env vars and we shouldn't be passing any proxy perl vars as flags
+    
+    # Truth in Perl: https://home.ubalt.edu/abento/452/perl/perltruth.html
+    # http://www.perlmonks.org/?node=what%20is%20true%20and%20false%20in%20Perl%3F
+    
+    if (!$ENV{'http_proxy'} && !$ENV{'https_proxy'}) {
+	if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'})
+	{
+	    
+	    if($self->{'url'} =~ m/^https\:/) {
 		$strOptions .= " -e https_proxy=$self->{'proxy_host'}:$self->{'proxy_port'} ";	
-	} else {
+	    } else {
 		$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 ";
-    }
-
-    if($self->{'no_check_certificate'}) { #&& $self->{'url'} =~ m/^https\:/) { # URL may be http that gets redirected to https
-	
+	    }	
+	    
+	    if ($self->{'user_name'} && $self->{'user_password'})
+	    {
+		$strOptions .= "--proxy-user=$self->{'user_name'}"." --proxy-passwd=$self->{'user_password'}";
+	    }
+	}
+
+	if ($self->{'proxy_on'}) {
+	    $strOptions .= " --proxy ";
+	}
+    }
+
+    if($self->{'no_check_certificate'}) { #&& $self->{'url'} =~ m/^https\:/) { # URL may be http that gets redirected to https, so if no_check_certificate is on, turn it on even if URL is http
+
 	$strOptions .= " --no-check-certificate ";
     }
@@ -259,6 +269,7 @@
     my $wget_file_path = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget");
     $command = "\"$wget_file_path\" $cmdWget";
-    #print STDOUT "Command is: $command\n";
-
+    #print STDOUT "Command is: $command\n"; # displayed in GLI output
+    #print STDERR "Command is: $command\n"; # goes into ServerInfoDialog
+    
     # Wget's output needs to be monitored to find out when it has naturally terminated.
     # Wget's output is sent to its STDERR so we can't use open2 without doing 2>&1.
