Diff for /loncom/lontrans.pm between versions 1.15 and 1.25

version 1.15, 2016/07/25 19:49:45 version 1.25, 2019/01/20 02:42:35
Line 30  package Apache::lontrans; Line 30  package Apache::lontrans;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :remotehost REDIRECT);  use Apache::Constants qw(:common :remotehost REDIRECT);
 use Apache::lonnet();  use Apache::lonnet;
 use Apache::File();  use Apache::File();
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     # FIXME line remove when mod_perl fixes BUG#4948       # FIXME line remove when mod_perl fixes BUG#4948
     $r->notes->set('error-notes' => '');      $r->notes->set('error-notes' => '');
     if ($r->uri=~m{^/raw/}) {      if ($r->uri=~m{^/raw/}) {
         my $host = $r->headers_in->get('Host');          my $host = $r->headers_in->get('Host');
         if ($host) {          if ($host) {
             unless ($host =~ /^internal\-/) {              unless ($host =~ /^internal\-/) {
                 my $c = $r->connection;                  my $remote_ip = $r->get_remote_host();
                 if (ref($c)) {                  my $lonhost = $r->dir_config('lonHostID');
                     my $remote_ip = $c->remote_ip;                  if (&redirect_raw($remote_ip,$lonhost)) {
                     my $lonhost = $r->dir_config('lonHostID');                      my $location = 'https://internal-'.$host.$r->uri;
                     if (&redirect_raw($remote_ip,$lonhost)) {                      $r->headers_out->set(Location => $location);
                         my $location = 'https://internal-'.$host.$r->uri;                      return REDIRECT;
                         $r->headers_out->set(Location => $location);  
                         return REDIRECT;  
                     }  
                 }                  }
             }              }
         }          }
Line 69  sub handler { Line 66  sub handler {
  '/userfiles/'.(join('/',@ufile)));   '/userfiles/'.(join('/',@ufile)));
         }          }
         return OK;          return OK;
     } else {       } else {
         return DECLINED;          return DECLINED;
     }      }
 }  }
Line 101  sub redirect_raw { Line 98  sub redirect_raw {
                             my $remintdom = &Apache::lonnet::internet_dom($remprimary);                              my $remintdom = &Apache::lonnet::internet_dom($remprimary);
                             if (ref($replication->{'certreq'}) eq 'ARRAY') {                              if (ref($replication->{'certreq'}) eq 'ARRAY') {
                                 if (grep(/^\Q$remintdom\E$/,@{$replication->{'certreq'}})) {                                  if (grep(/^\Q$remintdom\E$/,@{$replication->{'certreq'}})) {
                                     $redirect = 1;  
                                 } else {  
                                     $redirect = 0;                                      $redirect = 0;
                                   } else {
                                       $redirect = 1;
                                 }                                  }
                             }                              }
                             if (ref($replication->{'nocertreq'}) eq 'ARRAY') {                              if (ref($replication->{'nocertreq'}) eq 'ARRAY') {
                                 if (grep(/^\Q$remintdom\E$/,@{$replication->{'nocertreq'}})) {                                  if (grep(/^\Q$remintdom\E$/,@{$replication->{'nocertreq'}})) {
                                     $redirect = 0;  
                                 } else {  
                                     $redirect = 1;                                      $redirect = 1;
                                   } else {
                                       $redirect = 0;
                                 }                                  }
                             }                              }
                         }                          }
Line 120  sub redirect_raw { Line 117  sub redirect_raw {
             last;              last;
         }          }
     }      }
     return $redirect;        return $redirect;
 }  }
   
 1;  1;
 __END__  __END__
   
   
   
   
   
   
   

Removed from v.1.15  
changed lines
  Added in v.1.25


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>