Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[fotobilder] r1407: LJSUP-5576 (make fotobilder work on cent...

Committer: ailyin
LJSUP-5576 (make fotobilder work on centos/apache2): call DirectoryIndex emulation earlier
U   trunk/lib/Apache/FotoBilder.pm
Modified: trunk/lib/Apache/FotoBilder.pm
===================================================================
--- trunk/lib/Apache/FotoBilder.pm	2010-03-03 12:04:13 UTC (rev 1406)
+++ trunk/lib/Apache/FotoBilder.pm	2010-03-05 08:18:25 UTC (rev 1407)
@@ -180,6 +180,25 @@
         return LJ::Request::DECLINED;
     }
 
+    # emulate DirectoryIndex directive
+    if (not defined LJ::Request->filename   # it seems that under Apache v2 'filename' method maps to files only
+                                            # and for directories it returns undef.
+    ){
+        # maps uri to dir
+        my $uri = LJ::Request->uri;
+        return LJ::Request::NOT_FOUND if $uri =~ /\.\./; # forbids ANY .. in uri
+        if ($uri and -d "$ENV{FBHOME}/htdocs/" . $uri){
+            $uri .= "/" unless $uri =~ /\/$/; # make sure it ends with /
+            my $new_uri  = $uri . "index.bml";
+            my $bml_file = "$ENV{FBHOME}/htdocs/" . $uri . "index.bml";
+            LJ::Request->uri($new_uri);
+            LJ::Request->handler("perl-script");
+            LJ::Request->push_handlers(PerlHandler => \&Apache::BML::handler);
+            LJ::Request->filename($bml_file);
+            return LJ::Request::OK;
+        }
+    }
+
     # decide if it's for a BML page or not
     my ($topdir, $rest) = $uri =~ m!^/(\w+)(.*)!;
 
@@ -255,26 +274,6 @@
         }
     }
 
-    # emulate DirectoryIndex directive
-    if (not defined LJ::Request->filename   # it seems that under Apache v2 'filename' method maps to files only
-                                            # and for directories it returns undef.
-    ){
-        # maps uri to dir
-        my $uri = LJ::Request->uri;
-        return LJ::Request::NOT_FOUND if $uri =~ /\.\./; # forbids ANY .. in uri
-        
-        if ($uri and -d "$ENV{FBHOME}/htdocs/" . $uri){
-            $uri .= "/" unless $uri =~ /\/$/; # make sure it ends with /
-            my $new_uri  = $uri . "index.bml";
-            my $bml_file = "$ENV{FBHOME}/htdocs/" . $uri . "index.bml";
-            LJ::Request->uri($new_uri);
-            LJ::Request->handler("perl-script");
-            LJ::Request->push_handlers(PerlHandler => \&Apache::BML::handler);
-            LJ::Request->filename($bml_file);
-            return LJ::Request::OK;
-        }
-    }
-
     return LJ::Request::DECLINED;
 }
 

Tags: andy, fotobilder, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments