[LON-CAPA-cvs] cvs: loncom / lonhttpd

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 10 Apr 2007 20:08:02 -0000


raeburn		Tue Apr 10 16:08:02 2007 EDT

  Modified files:              
    /loncom	lonhttpd 
  Log:
  httpi can be used for domain images stored in res space belonging to $dom-domainconfig user.
  add mime-type for png 
  
  
Index: loncom/lonhttpd
diff -u loncom/lonhttpd:1.10 loncom/lonhttpd:1.11
--- loncom/lonhttpd:1.10	Sun Feb 13 19:18:03 2005
+++ loncom/lonhttpd	Tue Apr 10 16:08:01 2007
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: lonhttpd,v 1.10 2005/02/14 00:18:03 albertel Exp $
+# $Id: lonhttpd,v 1.11 2007/04/10 20:08:01 raeburn Exp $
 
 $VERSION = "1.3.2 (Demonic/Linux/LON-CAPA Derivative $Revison$)";
 
@@ -51,7 +51,8 @@
 	 "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";
 
@@ -348,12 +349,22 @@
 	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\/([^\/]+)\/([^\/]+)\-domainconfig\/(logo|domlogo|img)\/[^\/]+$/) {
+#            FIXME - should check $1 is a real domain here - need a lightweight
+#                    domain checker.
+#            @alldomains = &Apache::lonnet::get_domains();
+#            if (grep(/^\Q$1\E$/,@alldomains)) {
+                $fail = 0;
+#            }
+        }
+
 #
 # because existing restriction matrix would not do precedence across rules
 #