Index: main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java	(revision 31877)
+++ main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java	(revision 31878)
@@ -310,36 +310,39 @@
 	    Process prcs = null; 
 
-         
-	    if (Utility.isWindows()) {
-              	prcs = rt.exec(cmd);   
+	    if (proxy_url != null && !proxy_url.equals("")) {          	
+		// Specify proxies as environment variables
+		// Need to manually specify GSDLHOME and GSDLOS also
+		
+		proxy_url = proxy_url.replaceAll("http://","");
+		
+		env = new String[7];
+		
+		env[0] = "http_proxy=http://"+proxy_url;
+		env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too
+		// see also https://wiki.archlinux.org/index.php/proxy_settings
+		env[2] = "ftp_proxy=ftp://"+proxy_url;
+		env[3] = "GSDLHOME=" + Configuration.gsdl_path;
+		env[4] = "GSDLOS=" + Gatherer.client_operating_system;
+		// teach it where the wgetrc file lives, in gs2build/bin/<os>:
+		env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc";
+		// Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by
+		// WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails.
+		// So make PATH available to get open3() working:
+		env[6] = "PATH="+System.getenv("PATH");		
+		
+		prcs = rt.exec(cmd, env);
+	    } 
+	    else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) {
+		// Not Windows, but running client with download panel
+		// Need to manually specify GSDLHOME and GSDLOS
+		env = new String[3];
+		env[0] = "GSDLHOME=" + Configuration.gsdl_path;
+		env[1] = "GSDLOS=" + Gatherer.client_operating_system;
+		env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
+		prcs = rt.exec(cmd, env);
 	    }
 	    else {
-		if (proxy_url != null && !proxy_url.equals("")) {          	
-		    // Specify proxies as environment variables
-		    // Need to manually specify GSDLHOME and GSDLOS also
-		    env = new String[6];
-                    proxy_url = proxy_url.replaceAll("http://","");
-		    env[0] = "http_proxy=http://"+proxy_url;
-		    env[1] = "https_proxy=http://"+proxy_url; // HTTP protocol for https:// too
-		                // see also https://wiki.archlinux.org/index.php/proxy_settings
-		    env[2] = "ftp_proxy=ftp://"+proxy_url;
-		    env[3] = "GSDLHOME=" + Configuration.gsdl_path;
-		    env[4] = "GSDLOS=" + Gatherer.client_operating_system;
-		    env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
-		    prcs = rt.exec(cmd, env); 
-		} 
-		else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled) {
-		    // Not Windows, but running client with download panel
-		    // Need to manually specify GSDLHOME and GSDLOS
-		    env = new String[3];
-		    env[0] = "GSDLHOME=" + Configuration.gsdl_path;
-		    env[1] = "GSDLOS=" + Gatherer.client_operating_system;
-		    env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
-		    prcs = rt.exec(cmd, env); 
-		}
-		else {
-		    // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set
-		    prcs = rt.exec(cmd);
-		}
+		// Will inherit the GLI's environment, with GSDLHOME and GSDLOS set
+		prcs = rt.exec(cmd);
 	    }
 	    //System.out.println(newcmd);	    
@@ -620,39 +623,41 @@
 	    String [] env = null;
 
-		if (proxy_url != null && !proxy_url.equals("")) {          	
-		    // Specify proxies as environment variables
-		    // Need to manually specify GSDLHOME and GSDLOS also
-		    
-			proxy_url = proxy_url.replaceAll("http://","");
-					
-			env = new String[7];
-		    
-			env[0] = "http_proxy=http://"+proxy_url;
-			env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too
-		                   // see also https://wiki.archlinux.org/index.php/proxy_settings
-			env[2] = "ftp_proxy=ftp://"+proxy_url;
-		    env[3] = "GSDLHOME=" + Configuration.gsdl_path;
-		    env[4] = "GSDLOS=" + Gatherer.client_operating_system;
-		    env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
-			// If PATH is not made available, so that Perl is not on the PATH, then WgetDownload.pm's open3() call
-			// to run wget fails with cryptic failure message. So make PATH available for open3():
-			env[6] = "PATH="+System.getenv("PATH");		
-			
-		    prcs = new SafeProcess(cmd, env, null);
-		} 
-		else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) {
-		    // Not Windows, but running client with download panel
-		    // Need to manually specify GSDLHOME and GSDLOS
-		    env = new String[3];
-		    env[0] = "GSDLHOME=" + Configuration.gsdl_path;
-		    env[1] = "GSDLOS=" + Gatherer.client_operating_system;
-		    env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
-		    prcs = new SafeProcess(cmd, env, null);
-		}
-		else {
-		    // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set
-		    prcs = new SafeProcess(cmd);
-		}
-
+	    if (proxy_url != null && !proxy_url.equals("")) {          	
+		// Specify proxies as environment variables
+		// Need to manually specify GSDLHOME and GSDLOS also
+		
+		proxy_url = proxy_url.replaceAll("http://","");
+		
+		env = new String[7];
+		
+		env[0] = "http_proxy=http://"+proxy_url;
+		env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too
+		// see also https://wiki.archlinux.org/index.php/proxy_settings
+		env[2] = "ftp_proxy=ftp://"+proxy_url;
+		env[3] = "GSDLHOME=" + Configuration.gsdl_path;
+		env[4] = "GSDLOS=" + Gatherer.client_operating_system;
+		// teach it where the wgetrc file lives, in gs2build/bin/<os>:
+		env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc";
+		// Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by
+		// WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails.
+		// So make PATH available to get open3() working:
+		env[6] = "PATH="+System.getenv("PATH");		
+		
+		prcs = new SafeProcess(cmd, env, null);
+	    } 
+	    else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) {
+		// Not Windows, but running client with download panel
+		// Need to manually specify GSDLHOME and GSDLOS
+		env = new String[3];
+		env[0] = "GSDLHOME=" + Configuration.gsdl_path;
+		env[1] = "GSDLOS=" + Gatherer.client_operating_system;
+		env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
+		prcs = new SafeProcess(cmd, env, null);
+	    }
+	    else {
+		// Will inherit the GLI's environment, with GSDLHOME and GSDLOS set
+		prcs = new SafeProcess(cmd);
+	    }
+	    
 	    //System.out.println(newcmd);
 	    prcs.setMainHandler(this); // attach handler to clean up before and after process.destroy()
Index: main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java	(revision 31877)
+++ main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java	(revision 31878)
@@ -111,19 +111,21 @@
 		    // Need to manually specify GSDLHOME and GSDLOS also
 		    
-            proxy_url = proxy_url.replaceAll("http://","");
-			
-			String [] env = new String[7];
+		    proxy_url = proxy_url.replaceAll("http://","");
 		    
-			env[0] = "http_proxy=http://"+proxy_url;
-			env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too
-		                   // see also https://wiki.archlinux.org/index.php/proxy_settings
-			env[2] = "ftp_proxy=ftp://"+proxy_url;
+		    String [] env = new String[7];
+		    
+		    env[0] = "http_proxy=http://"+proxy_url;
+		    env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too
+		    // see also https://wiki.archlinux.org/index.php/proxy_settings
+		    env[2] = "ftp_proxy=ftp://"+proxy_url;
 		    env[3] = "GSDLHOME=" + Configuration.gsdl_path;
 		    env[4] = "GSDLOS=" + Gatherer.client_operating_system;
-		    env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os>
-			// If PATH is not made available, so that Perl is not on the PATH, then WgetDownload.pm's open3() call
-			// to run wget fails with cryptic failure message. So make PATH available for open3():
-			env[6] = "PATH="+System.getenv("PATH");
-			
+		    // teach it where the wgetrc file lives, in gs2build/bin/<os>:
+		    env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc";
+		    // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by
+		    // WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails.
+		    // So make PATH available to get open3() working:
+		    env[6] = "PATH="+System.getenv("PATH");
+		    
 		    prcs = new SafeProcess(command, env, null);
 		} 
Index: main/trunk/greenstone2/perllib/downloaders/WebDownload.pm
===================================================================
--- main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31877)
+++ main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31878)
@@ -193,7 +193,7 @@
     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);	
-	
+    #&util::print_env(STDERR, "https_proxy", "http_proxy", "HTTPS_PROXY", "HTTP_PROXY", "ftp_proxy", "FTP_PROXY");
+    #&util::print_env(STDERR);	
+    
     my $strIdentifyText = $self->useWget($strBaseCMD);
     
Index: main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
===================================================================
--- main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31877)
+++ main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31878)
@@ -169,46 +169,46 @@
 sub addProxySettingsAsWgetFlags
 {
-	my ($self) = @_;
-	my $strOptions = "";
-	
-	if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'})
-	{
-	    $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 ";
-	}
-	
-	return $strOptions;
-}
-
-sub getWgetOptions
-{
     my ($self) = @_;
     my $strOptions = "";
     
-	# If proxy settings are set up in the environment, wget is ready to use them. More secure.
-	# But if proxy settings are not set up in the environment, pass them as flags to wget
-	# This is less secure, as pwd etc visible in task manager, but it was the original way in
-	# which wget was run on windows.
-	# Truth in Perl: https://home.ubalt.edu/abento/452/perl/perltruth.html
+    if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'})
+    {
+	$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 ";
+    }
+    
+    return $strOptions;
+}
+
+sub getWgetOptions
+{
+    my ($self) = @_;
+    my $strOptions = "";
+    
+    # If proxy settings are set up in the environment, wget is ready to use them. More secure.
+    # But if proxy settings are not set up in the environment, pass them as flags to wget
+    # This is less secure, as pwd etc visible in task manager, but it was the original way in
+    # which wget was run on windows.
+    # 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'}) {
-		$strOptions .= $self->addProxySettingsAsWgetFlags();
+	$strOptions .= $self->addProxySettingsAsWgetFlags();
     } # else wget will use proxy settings in environment, assume enough settings have been provided
+    
+    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
 	
-    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
-
 	$strOptions .= " --no-check-certificate ";
     }
-	
+    
     return $strOptions;
 }
@@ -288,6 +288,6 @@
     # closing an extra unused handle, a single handle is used instead for both the child's
     # stderr and stdout.
-	# See http://blog.0x1fff.com/2009/09/howto-execute-system-commands-in-perl.html
-	# for why this is the right thing to do.
+    # See http://blog.0x1fff.com/2009/09/howto-execute-system-commands-in-perl.html
+    # for why this is the right thing to do.
 
     # Both open2 and open3 don't return on failure, but raise an exception. The handling
