Changeset 31860 for main/trunk/greenstone2
- Timestamp:
- 2017-08-09T16:48:21+12:00 (7 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/downloaders/WebDownload.pm
r31857 r31860 40 40 use strict; # every perl program should have this! 41 41 no strict 'refs'; # make an exception so we can use variables as filehandles 42 no strict 'subs'; 43 use gsprintf 'gsprintf'; 42 44 43 45 my $arguments = … … 117 119 my $cmdWget = "-N -k -x --tries=2 $strWgetOptions $strOptions $cache_dir " .$self->{'url'}; 118 120 119 121 #print STDOUT "\n@@@@ RUNNING WGET CMD: $cmdWget\n\n"; 120 122 121 123 # Download the web pages … … 194 196 195 197 if (!defined $strIdentifyText or $strIdentifyText eq "" ){ 196 print STDERR "Server information is unavailable.\n"; 197 if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'}) { # if proxying set, the settings may be wrong 198 print STDERR "Current proxy settings are:\n"; 199 print STDERR "- host=$self->{'proxy_host'}\n"; 200 print STDERR "- port=$self->{'proxy_port'}\n"; 201 } else { # else no proxy set, the user may need proxy settings 202 print STDERR "The external server might not be responding, or you might need to switch on proxy settings.\n"; 203 } 204 print STDERR "<<Finished>>\n"; 205 return; 198 199 print STDERR "Server information is unavailable.\n"; 200 201 if ($self->{'proxy_on'} && $self->{'proxy_host'} && $self->{'proxy_port'}) { # if proxying set, the settings may be wrong 202 &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxied_connect_failed_info}\n", $self->{'proxy_host'}, $self->{'proxy_port'}); 203 } else { # else no proxy set, the user may need proxy settings 204 &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.proxyless_connect_failed_info}\n"); 205 } 206 207 # with or without proxying set, getting server info may have failed if the URL was Https 208 # but the site had no valid certificate and no_check_certificate wasn't turned on 209 # suggest to the user to try turning it on 210 &gsprintf::gsprintf_multiline(STDERR, "{WebDownload.connect_failed_info}\n"); 211 212 print STDERR "<<Finished>>\n"; 213 return; 206 214 } 207 215 -
main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
r31856 r31860 70 70 'type' => "string", 71 71 'reqd' => "no", 72 'hiddengli' => "yes"}]; 72 'hiddengli' => "yes"}, 73 { 'name' => "no_check_certificate", 74 'desc' => "{WgetDownload.no_check_certificate}", 75 'type' => "flag", 76 'reqd' => "no", 77 'hiddengli' => "yes"} 78 ]; 73 79 74 80 my $options = { 'name' => "WgetDownload", … … 183 189 } 184 190 185 if($self->{'no_check_certificate'} && $self->{'url'} =~ m/^https\:/) { 186 $strOptions .= " --no-check-certificate "; 187 } 191 if($self->{'no_check_certificate'}) { #&& $self->{'url'} =~ m/^https\:/) { # URL may be http that gets redirected to https 192 193 $strOptions .= " --no-check-certificate "; 194 } 188 195 189 196 return $strOptions; -
main/trunk/greenstone2/perllib/gsprintf.pm
r31419 r31860 71 71 sub gsprintf 72 72 { 73 my ($handle, $text_string, @text_arguments) = @_; 74 _gsprintf($handle, $text_string, 0, @text_arguments); 75 } 76 77 sub gsprintf_multiline 78 { 73 79 my ($handle, $text_string, @text_arguments) = @_; 80 _gsprintf($handle, $text_string, 1, @text_arguments); 81 } 82 83 sub _gsprintf 84 { 85 my ($handle, $text_string, $multiline, @text_arguments) = @_; 74 86 75 87 # Return unless the required arguments were supplied … … 82 94 my $text_string_resolved = sprintf($text_string, @text_arguments); 83 95 96 if($multiline) { # replace newlines 97 $text_string_resolved =~ s@\\n@\n@g; 98 } 99 84 100 if ($freetext_xml_mode) { 85 101 $text_string_resolved = make_freetext_xml_safe($text_string_resolved); 86 102 } 87 103 88 104 print $handle $text_string_resolved; 89 105 } 90 106 91 107 92 108 93 109 sub lookup_string -
main/trunk/greenstone2/perllib/strings.properties
r31787 r31860 1336 1336 WebDownload.html_only:Download only HTML files, and ignore associated files e.g images and stylesheets 1337 1337 WebDownload.html_only_disp:Only HTML files 1338 WebDownload.proxied_connect_failed_info:Current proxy settings are:\n- host=%s\n- port=%s 1339 WebDownload.proxyless_connect_failed_info:- The external server might not be responding\n- or you might need to switch on proxy settings 1340 WebDownload.connect_failed_info:- or try ticking No Certificate Checking for Https\nin File > Preferences > Connection 1338 1341 1339 1342 WgetDownload.desc: Base class that handles calls to wget … … 1343 1346 WgetDownload.user_name:User name 1344 1347 WgetDownload.user_password:User password 1348 WgetDownload.no_check_certificate:No check certificate 1345 1349 1346 1350 Z3950Download.desc:A module for downloading from Z3950 repositories
Note:
See TracChangeset
for help on using the changeset viewer.