Diff for /loncom/lonhttpd between versions 1.8 and 1.17

version 1.8, 2003/07/01 19:57:45 version 1.17, 2010/03/11 16:34:48
Line 51  if ($port_to_use eq '80') { die('Apache Line 51  if ($port_to_use eq '80') { die('Apache
  "mpeg" => "video/mpeg",   "mpeg" => "video/mpeg",
  "mpg" => "video/mpeg",   "mpg" => "video/mpeg",
  "jpeg" => "image/jpeg",   "jpeg" => "image/jpeg",
  "jpg" => "image/jpeg");   "jpg" => "image/jpeg",
            "png" => "image/png");
   
 $logfile = "/home/httpd/perl/logs/lonhttpd.log";  $logfile = "/home/httpd/perl/logs/lonhttpd.log";
   
Line 61  $pidfile="/home/httpd/perl/logs/lonhttpd Line 62  $pidfile="/home/httpd/perl/logs/lonhttpd
   
 if (-e $pidfile) {  if (-e $pidfile) {
    open(LFH,"$pidfile");     open(LFH,"$pidfile");
    my $pide=<$LFH>;     my $pide=<LFH>;
    chomp($pide);     chomp($pide);
    close(LFH);     close(LFH);
    if (kill 0 => $pide) { die "already running"; }     if (kill 0 => $pide) { die "already running"; }
Line 86  Server: HTTPi/$VERSION Line 87  Server: HTTPi/$VERSION
 MIME-Version: 1.0  MIME-Version: 1.0
 EOF  EOF
   
 %virtual_files =  %virtual_files = ();
  (  
 "/adm/lonLCDfont/0.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/0.gif" ] ,  
 "/adm/lonLCDfont/1.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/1.gif" ] ,  
 "/adm/lonLCDfont/2.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/2.gif" ] ,  
 "/adm/lonLCDfont/3.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/3.gif" ] ,  
 "/adm/lonLCDfont/4.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/4.gif" ] ,  
 "/adm/lonLCDfont/5.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/5.gif" ] ,  
 "/adm/lonLCDfont/6.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/6.gif" ] ,  
 "/adm/lonLCDfont/7.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/7.gif" ] ,  
 "/adm/lonLCDfont/8.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/8.gif" ] ,  
 "/adm/lonLCDfont/9.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/9.gif" ] ,  
 "/adm/lonLCDfont/a.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/a.gif" ] ,  
 "/adm/lonLCDfont/b.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/b.gif" ] ,  
 "/adm/lonLCDfont/c.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/c.gif" ] ,  
 "/adm/lonLCDfont/d.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/d.gif" ] ,  
 "/adm/lonLCDfont/e.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/e.gif" ] ,  
 "/adm/lonLCDfont/f.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/f.gif" ] ,  
 "/adm/lonLCDfont/g.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/g.gif" ] ,  
 "/adm/lonLCDfont/h.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/h.gif" ] ,  
 "/adm/lonLCDfont/i.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/i.gif" ] ,  
 "/adm/lonLCDfont/j.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/j.gif" ] ,  
 "/adm/lonLCDfont/k.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/k.gif" ] ,  
 "/adm/lonLCDfont/l.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/l.gif" ] ,  
 "/adm/lonLCDfont/m.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/m.gif" ] ,  
 "/adm/lonLCDfont/n.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/n.gif" ] ,  
 "/adm/lonLCDfont/o.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/o.gif" ] ,  
 "/adm/lonLCDfont/p.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/p.gif" ] ,  
 "/adm/lonLCDfont/q.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/q.gif" ] ,  
 "/adm/lonLCDfont/r.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/r.gif" ] ,  
 "/adm/lonLCDfont/s.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/s.gif" ] ,  
 "/adm/lonLCDfont/t.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/t.gif" ] ,  
 "/adm/lonLCDfont/u.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/u.gif" ] ,  
 "/adm/lonLCDfont/v.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/v.gif" ] ,  
 "/adm/lonLCDfont/w.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/w.gif" ] ,  
 "/adm/lonLCDfont/x.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/x.gif" ] ,  
 "/adm/lonLCDfont/y.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/y.gif" ] ,  
 "/adm/lonLCDfont/z.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/z.gif" ] ,  
 "/adm/lonLCDfont/colon.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/colon.gif" ] ,  
 "/adm/lonLCDfont/slash.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/slash.gif" ] ,  
 "/adm/lonLCDfont/hyphen.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/hyphen.gif" ] ,  
 "/adm/lonLCDfont/space.gif" => [ "image/gif", "FILE",  
  "/home/httpd/html/adm/lonLCDfont/space.gif" ] ,  
  );  
   
 %content_types = (%system_content_types, %content_types);  %content_types = (%system_content_types, %content_types);
 undef %system_content_types;  undef %system_content_types;
Line 260  EOF Line 179  EOF
  }   }
   
   
 sub bye { unlink($pidfile); exit; }  sub bye { exit; }
   
   sub goodbye { unlink($pidfile); exit; }
   
 sub dead {  sub dead {
  &htsponse(500, "Server Error");   &htsponse(500, "Server Error");
Line 276  EOF Line 197  EOF
 }  }
   
 $SIG{'__DIE__'} = \&dead;  $SIG{'__DIE__'} = \&dead;
 $SIG{'ALRM'} = $SIG{'TERM'} = $SIG{'INT'} = \&bye;  $SIG{'ALRM'} = \&bye;
   $SIG{'TERM'} = $SIG{'INT'} = \&goodbye;
   
 sub master {  sub master {
  $0 = "lonhttpd: (dhttpi) handling request";   $0 = "lonhttpd: (dhttpi) handling request";
Line 345  while (<STDIN>) { Line 267  while (<STDIN>) {
  1 while $address =~ s#/\.(/|$)#\1#;   1 while $address =~ s#/\.(/|$)#\1#;
         1 while $address =~ s#/[^/]*/\.\.(/|$)#\1#;          1 while $address =~ s#/[^/]*/\.\.(/|$)#\1#;
  1 while $address =~ s#^/\.\.(/|$)#\1#;   1 while $address =~ s#^/\.\.(/|$)#\1#;
  $fail = 0;   $fail = 1;
 #  #
 # Heavily customized for LON-CAPA  # Heavily customized for LON-CAPA
 #  #
  $address=~s/\/+/\//g;   $address=~s/\/+/\//g;
  unless ($address=~/^\/(status|adm\/|res\/adm\/)/) { $fail=1; }          if ($address=~/^\/(status|adm\/|res\/adm\/)/) {
               $fail = 0;
           } elsif ($address =~ /^\/res\/([\w\.\-]+)\/\1\-domainconfig\/(logo|domlogo|img|login)\/[^\/]+$/) {
               $fail = 0;
           }
 #  #
 # because existing restriction matrix would not do precedence across rules  # because existing restriction matrix would not do precedence across rules
 #  #
Line 587  for (;;) { Line 513  for (;;) {
  waitpid($pid, 0);   waitpid($pid, 0);
  $0 = "lonhttpd: (dhttpi) on ANY:$port_to_use, last request " .   $0 = "lonhttpd: (dhttpi) on ANY:$port_to_use, last request " .
  scalar localtime;   scalar localtime;
    close(NS);
  } else {   } else {
  $0 = "lonhttpd: (dhttpi) child switching to socket";   $0 = "lonhttpd: (dhttpi) child switching to socket";
  open(STDIN, "<&NS");   open(STDIN, "<&NS");

Removed from v.1.8  
changed lines
  Added in v.1.17


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