Show
Ignore:
Timestamp:
10.03.2017 18:51:35 (3 years ago)
Author:
ak19
Message:

Making servercontrol.pm more robust to http and https protocols

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/servercontrol.pm

    r30596 r31488  
    409409        my $host = $uri->host; 
    410410        #print STDERR "@@@@@ host: $host\n"; 
    411         if($url =~ m/http:\/\/$host(\/)?$/) { 
    412             #if($url !~ m/http:\/\/$host:$portnumber(\/)?/ || $url =~ m/http:\/\/$host(\/)?$/) { 
     411        if($url =~ m/https?:\/\/$host(\/)?$/) { 
     412            #if($url !~ m/https?:\/\/$host:$portnumber(\/)?/ || $url =~ m/https?:\/\/$host(\/)?$/) { 
    413413            # (if the URL does not contain the portnumber, OR if the port is implicitly 80 and)                  
    414414            # If the domain with http:// prefix is completely the same as the URL, assume server.exe 
     
    445445    if (open(PIN, "$perl_command |")) { 
    446446        while (defined (my $perl_output_line = <PIN>)) { 
    447         if($perl_output_line =~ m@http:\/\/(\S*)@) { # grab all the non-whitespace chars 
    448             $url="http://".$1; 
     447        if($perl_output_line =~ m@(https?):\/\/(\S*)@) { # grab all the non-whitespace chars 
     448            $url="$1://".$2; # preserve the http protocol #$url="http://".$1; 
    449449        } 
    450450        } 
     
    706706     
    707707    #my $host = $url;        
    708     #$host =~ s@^http:\/\/(www.)?@@;         
     708    #$host =~ s@^https?:\/\/(www.)?@@;       
    709709    #$host =~ s@\/.*@@; 
    710710    #print STDERR "**** HOST: $host\n";