Ignore:
Timestamp:
2017-08-09T16:48:21+12:00 (7 years ago)
Author:
ak19
Message:

The changes necessary for getting the new no_check_certificate checkbox to appear and work in GLI and get propagated to the perl code that launches wget. This checkbox controls whether wget is launched with the no-check-certificate flag to retrieve Https URLs despite lack of (valid) certificates.

Location:
main/trunk/greenstone2/perllib/downloaders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/downloaders/WebDownload.pm

    r31857 r31860  
    4040use strict; # every perl program should have this!
    4141no strict 'refs'; # make an exception so we can use variables as filehandles
     42no strict 'subs';
     43use gsprintf 'gsprintf';
    4244
    4345my $arguments =
     
    117119    my $cmdWget = "-N -k -x --tries=2 $strWgetOptions $strOptions $cache_dir " .$self->{'url'};
    118120
    119     #print STDOUT "\n@@@@ RUNNING WGET CMD: $cmdWget\n\n";
     121    #print STDOUT "\n@@@@ RUNNING WGET CMD: $cmdWget\n\n";
    120122   
    121123    # Download the web pages
     
    194196   
    195197    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; 
    206214    }
    207215
  • main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm

    r31856 r31860  
    7070    'type' => "string",
    7171    '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     ];
    7379
    7480my $options = { 'name'     => "WgetDownload",
     
    183189    }
    184190
    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    }
    188195   
    189196    return $strOptions;
Note: See TracChangeset for help on using the changeset viewer.