--- loncom/lonhttpd 2003/07/30 15:28:56 1.9 +++ loncom/lonhttpd 2007/07/11 18:48:20 1.15 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: lonhttpd,v 1.9 2003/07/30 15:28:56 www Exp $ +# $Id: lonhttpd,v 1.15 2007/07/11 18:48:20 albertel Exp $ $VERSION = "1.3.2 (Demonic/Linux/LON-CAPA Derivative $Revison$)"; @@ -51,7 +51,8 @@ if ($port_to_use eq '80') { die('Apache "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "jpeg" => "image/jpeg", - "jpg" => "image/jpeg"); + "jpg" => "image/jpeg", + "png" => "image/png"); $logfile = "/home/httpd/perl/logs/lonhttpd.log"; @@ -61,7 +62,7 @@ $pidfile="/home/httpd/perl/logs/lonhttpd if (-e $pidfile) { open(LFH,"$pidfile"); - my $pide=<$LFH>; + my $pide=; chomp($pide); close(LFH); if (kill 0 => $pide) { die "already running"; } @@ -348,12 +349,16 @@ while () { 1 while $address =~ s#/\.(/|$)#\1#; 1 while $address =~ s#/[^/]*/\.\.(/|$)#\1#; 1 while $address =~ s#^/\.\.(/|$)#\1#; - $fail = 0; + $fail = 1; # # Heavily customized for LON-CAPA # $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)\/[^\/]+$/) { + $fail = 0; + } # # because existing restriction matrix would not do precedence across rules # @@ -590,6 +595,7 @@ for (;;) { waitpid($pid, 0); $0 = "lonhttpd: (dhttpi) on ANY:$port_to_use, last request " . scalar localtime; + close(NS); } else { $0 = "lonhttpd: (dhttpi) child switching to socket"; open(STDIN, "<&NS");