Index: /main/trunk/gli/classes/dictionary.properties
===================================================================
--- /main/trunk/gli/classes/dictionary.properties	(revision 31859)
+++ /main/trunk/gli/classes/dictionary.properties	(revision 31860)
@@ -1000,4 +1000,6 @@
 Preferences.Connection.ProgramCommand:Preview Command:
 Preferences.Connection.ProgramCommand_Tooltip:The launch command for the program used to view the collection preview. Remember to use %1 as the placeholder for the collection address, and to use speechmarks where necessary.
+Preferences.Connection.No_Check_Certificate: No certificate checking for Https URLs # Disable Https security certificate checking?
+Preferences.Connection.No_Check_Certificate_Tooltip:Tick to download from Https URLs even if they don't have a (valid) security certificate.
 Preferences.Connection.Proxy_Host:Proxy Host:
 Preferences.Connection.Proxy_Host_Tooltip:The address of your proxy server
Index: /main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java	(revision 31859)
+++ /main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java	(revision 31860)
@@ -106,6 +106,6 @@
 	try {
 	    String [] env = null;
-	    SafeProcess prcs = null; 
-	  
+	    SafeProcess prcs = null;
+	    
 	    if (Utility.isWindows()) {
 		prcs = new SafeProcess(command);
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java	(revision 31859)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java	(revision 31860)
@@ -571,4 +571,15 @@
 		// redirect url (we do this step in order to avoid some unintuitive behaviour from wget)
 		Download current_download = (Download)download_map.get(mode);
+		
+		boolean noCheckCertificate = Configuration.get("general.no_check_certificate", true);		
+		Argument no_check_cert_arg = current_download.getArgument("no_check_certificate");
+		if(noCheckCertificate) {
+		    no_check_cert_arg.setValue("true");
+		    no_check_cert_arg.setAssigned(true);
+		} else {
+		    no_check_cert_arg.setValue("false");
+		    no_check_cert_arg.setAssigned(false); // only assigned Arguments have values
+		}
+
 		Argument arg_url = current_download.getArgument("url");
 		
@@ -576,16 +587,16 @@
 		    String url_str = arg_url.getValue();	
 			
-			// No longer following URL redirects, since some of this has been taken care of by wget
-			// For the rest, assume the user will get the URL right that they want to download from
-			/*
-		    String redirect_url_str = getRedirectURL(url_str);
-		    
-		    // only update the Argument and its GUI ArgumentControl if the URL
-		    // has in fact changed
-		    if(!url_str.equals(redirect_url_str)) {
-			arg_url.setValue(redirect_url_str);
-			updateArgument(arg_url, redirect_url_str);
-		    }
-			*/
+		    // No longer following URL redirects, since some of this has been taken care of by wget
+		    // For the rest, assume the user will get the URL right that they want to download from
+		    /*
+		      String redirect_url_str = getRedirectURL(url_str);
+		      
+		      // only update the Argument and its GUI ArgumentControl if the URL
+		      // has in fact changed
+		      if(!url_str.equals(redirect_url_str)) {
+		      arg_url.setValue(redirect_url_str);
+		      updateArgument(arg_url, redirect_url_str);
+		      }
+		    */
 		}
 		
@@ -758,16 +769,16 @@
 		// 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");
+		   
+		   arg.setValue("true"); // proxy_on argument
 		   arg.setAssigned(true);
-
+		   
 		   arg = current_download.getArgument("proxy_host");
 		   arg.setValue(proxy_host);
 		   arg.setAssigned(true);
-
+		   
 		   arg = current_download.getArgument("proxy_port");
 		   arg.setValue(proxy_port);
 		   arg.setAssigned(true);
-
+	    
 		   arg = current_download.getArgument("user_name");
 		   arg.setValue(user_pass.substring(0, user_pass.indexOf("@")));
@@ -822,4 +833,15 @@
 	    }
 
+	    boolean noCheckCertificate = Configuration.get("general.no_check_certificate", true);
+	    Argument no_check_cert_arg = current_download.getArgument("no_check_certificate");
+	    if(noCheckCertificate) {		
+		no_check_cert_arg.setValue("true");
+		no_check_cert_arg.setAssigned(true);
+	    } else {
+		no_check_cert_arg.setValue("false");
+		no_check_cert_arg.setAssigned(false); // only assigned Arguments have values
+	    }
+	    
+	    
 	    //str_url = getRedirectURL(str_url); // work out the real URL
 
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 31859)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 31860)
@@ -71,4 +71,5 @@
     private JButton ok_button;
     private JCheckBox show_file_size_checkbox;
+    private JCheckBox no_check_certificate_checkbox; // Set no_check_certificate when retrieving Https URLs that have no (valid) certificate
     private JCheckBox use_proxy_checkbox;
     private JCheckBox view_extracted_metadata_checkbox;
@@ -318,4 +319,6 @@
 	    chdir_button.setEnabled(false);
 	}
+
+	boolean no_check_cert_enabled = Configuration.get("general.no_check_certificate", true); // pass true to look in general rather than collection specific config file
 	
 	boolean currently_enabled = Configuration.get("general.use_proxy", true);
@@ -323,4 +326,10 @@
 	JPanel connection_pane = new JPanel();
         connection_pane.setComponentOrientation(Dictionary.getOrientation());
+	no_check_certificate_checkbox = new JCheckBox(Dictionary.get("Preferences.Connection.No_Check_Certificate"));
+	no_check_certificate_checkbox.setToolTipText(Dictionary.get("Preferences.Connection.No_Check_Certificate_Tooltip"));
+	no_check_certificate_checkbox.setSelected(no_check_cert_enabled);
+	no_check_certificate_checkbox.setComponentOrientation(Dictionary.getOrientation());        
+	no_check_certificate_checkbox.setPreferredSize(ROW_SIZE);
+	
 	use_proxy_checkbox = new JCheckBox(Dictionary.get("Preferences.Connection.Use_Proxy"));
 	use_proxy_checkbox.setSelected(currently_enabled);
@@ -360,4 +369,5 @@
 	
 	// Connection
+	no_check_certificate_checkbox.addActionListener(new NoCheckCertificateListener());
 	use_proxy_checkbox.addActionListener(new UseProxyListener());
 	if (Gatherer.GS3) {
@@ -404,5 +414,5 @@
 
 	connection_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-	connection_pane.setLayout(new GridLayout(8,1,0,2));
+	connection_pane.setLayout(new GridLayout(9,1,0,2));
 	connection_pane.add(program_pane);
 	connection_pane.add(library_path_pane);
@@ -416,4 +426,5 @@
 	connection_pane.add(collect_dir_pane);
 
+	connection_pane.add(no_check_certificate_checkbox);
 	connection_pane.add(use_proxy_checkbox);
 	connection_pane.add(proxy_host_pane);
@@ -1119,4 +1130,12 @@
     }
 
+    private class NoCheckCertificateListener implements ActionListener {
+	public void actionPerformed(ActionEvent event) {
+	    boolean isEnabled = no_check_certificate_checkbox.isSelected();
+	    Configuration.set("general.no_check_certificate", true, isEnabled);
+	    boolean no_check_cert_enabled = Configuration.get("general.no_check_certificate", true);
+	}
+    }
+    
     private class UseProxyListener
 	implements ActionListener {
Index: /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm
===================================================================
--- /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31859)
+++ /main/trunk/greenstone2/perllib/downloaders/WebDownload.pm	(revision 31860)
@@ -40,4 +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';
+use gsprintf 'gsprintf';
 
 my $arguments = 
@@ -117,5 +119,5 @@
     my $cmdWget = "-N -k -x --tries=2 $strWgetOptions $strOptions $cache_dir " .$self->{'url'};
 
-	#print STDOUT "\n@@@@ RUNNING WGET CMD: $cmdWget\n\n";
+    #print STDOUT "\n@@@@ RUNNING WGET CMD: $cmdWget\n\n";
 	
     # Download the web pages
@@ -194,14 +196,20 @@
     
     if (!defined $strIdentifyText or $strIdentifyText eq ""  ){
-		print STDERR "Server information is unavailable.\n";			
-		if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'}) { # if proxying set, the settings may be wrong
-			print STDERR "Current proxy settings are:\n";
-			print STDERR "- host=$self->{'proxy_host'}\n";
-			print STDERR "- port=$self->{'proxy_port'}\n";
-		} else { # else no proxy set, the user may need proxy settings
-			print STDERR "The external server might not be responding, or you might need to switch on proxy settings.\n";
-		}
-		print STDERR "<<Finished>>\n";
-         return;  
+	
+	print STDERR "Server information is unavailable.\n";
+
+	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'});
+	} else { # else no proxy set, the user may need proxy settings
+	    &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxyless_connect_failed_info}\n");
+	}
+	
+	# with or without proxying set, getting server info may have failed if the URL was Https
+	# but the site had no valid certificate and no_check_certificate wasn't turned on
+	# suggest to the user to try turning it on
+	&gsprintf::gsprintf_multiline(STDERR, "{WebDownload.connect_failed_info}\n");
+	
+	print STDERR "<<Finished>>\n";
+	return;  
     }
 
Index: /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
===================================================================
--- /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31859)
+++ /main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm	(revision 31860)
@@ -70,5 +70,11 @@
 	'type' => "string",
 	'reqd' => "no",
-	'hiddengli' => "yes"}];
+	'hiddengli' => "yes"},
+      { 'name' => "no_check_certificate", 
+	'desc' => "{WgetDownload.no_check_certificate}",
+	'type' => "flag",
+	'reqd' => "no",
+	'hiddengli' => "yes"}
+     ];
 
 my $options = { 'name'     => "WgetDownload",
@@ -183,7 +189,8 @@
     }
 
-	if($self->{'no_check_certificate'} && $self->{'url'} =~ m/^https\:/) {
-		$strOptions .= " --no-check-certificate ";
-	}
+    if($self->{'no_check_certificate'}) { #&& $self->{'url'} =~ m/^https\:/) { # URL may be http that gets redirected to https
+	
+	$strOptions .= " --no-check-certificate ";
+    }
 	
     return $strOptions;
Index: /main/trunk/greenstone2/perllib/gsprintf.pm
===================================================================
--- /main/trunk/greenstone2/perllib/gsprintf.pm	(revision 31859)
+++ /main/trunk/greenstone2/perllib/gsprintf.pm	(revision 31860)
@@ -71,5 +71,17 @@
 sub gsprintf
 {
+    my ($handle, $text_string, @text_arguments) = @_;    
+    _gsprintf($handle, $text_string, 0, @text_arguments);
+}
+
+sub gsprintf_multiline
+{
     my ($handle, $text_string, @text_arguments) = @_;
+    _gsprintf($handle, $text_string, 1, @text_arguments);
+}
+
+sub _gsprintf
+{
+    my ($handle, $text_string, $multiline, @text_arguments) = @_;
 
     # Return unless the required arguments were supplied
@@ -82,12 +94,16 @@
     my $text_string_resolved = sprintf($text_string, @text_arguments);
 
+    if($multiline) { # replace newlines
+	$text_string_resolved =~ s@\\n@\n@g;
+    }
+    
     if ($freetext_xml_mode) {
 	$text_string_resolved = make_freetext_xml_safe($text_string_resolved);
     }
-
+    
     print $handle $text_string_resolved;
 }
 
-    
+
 
 sub lookup_string
Index: /main/trunk/greenstone2/perllib/strings.properties
===================================================================
--- /main/trunk/greenstone2/perllib/strings.properties	(revision 31859)
+++ /main/trunk/greenstone2/perllib/strings.properties	(revision 31860)
@@ -1336,4 +1336,7 @@
 WebDownload.html_only:Download only HTML files, and ignore associated files e.g images and stylesheets
 WebDownload.html_only_disp:Only HTML files
+WebDownload.proxied_connect_failed_info:Current proxy settings are:\n- host=%s\n- port=%s
+WebDownload.proxyless_connect_failed_info:- The external server might not be responding\n- or you might need to switch on proxy settings
+WebDownload.connect_failed_info:- or try ticking No Certificate Checking for Https\nin File > Preferences > Connection
 
 WgetDownload.desc: Base class that handles calls to wget
@@ -1343,4 +1346,5 @@
 WgetDownload.user_name:User name
 WgetDownload.user_password:User password
+WgetDownload.no_check_certificate:No check certificate
 
 Z3950Download.desc:A module for downloading from Z3950 repositories
