[Catalyst-commits] r7444 - in trunk/Catalyst-Engine-Apache: . lib/Catalyst/Engine

andyg at dev.catalyst.perl.org andyg at dev.catalyst.perl.org
Wed Feb 20 13:49:53 GMT 2008


Author: andyg
Date: 2008-02-20 13:49:52 +0000 (Wed, 20 Feb 2008)
New Revision: 7444

Modified:
   trunk/Catalyst-Engine-Apache/Changes
   trunk/Catalyst-Engine-Apache/lib/Catalyst/Engine/Apache.pm
Log:
C::E::Apache 1.12:
 - Fixed warning when a non-trivial regex is used in a LocationMatch block.
   (Steffen Schwigon)
 - Clear the value of $c->engine->return() before each request.
 - Added support for 'PerlSetVar CatalystDisableLocationMatch 1' to disable check
   for a LocationMatch regex to set base path.


Modified: trunk/Catalyst-Engine-Apache/Changes
===================================================================
--- trunk/Catalyst-Engine-Apache/Changes	2008-02-19 20:39:34 UTC (rev 7443)
+++ trunk/Catalyst-Engine-Apache/Changes	2008-02-20 13:49:52 UTC (rev 7444)
@@ -1,10 +1,15 @@
 This file documents the revision history for Catalyst::Engine::Apache.
 
-1.12
+1.12    2008-02-20 09:00:00
         - Fixed bug where %2b in query parameter is doubly decoded to ' ', instead of '+' 
           (Gavin Henry, Tatsuhiko Miyagawa)
         - Fixed bug where req->base and req->uri would include a port number when running 
           in SSL mode.
+        - Fixed warning when a non-trivial regex is used in a LocationMatch block.
+          (Steffen Schwigon)
+        - Clear the value of $c->engine->return() before each request.
+        - Added support for 'PerlSetVar CatalystDisableLocationMatch 1' to disable check
+          for a LocationMatch regex to set base path.
 
 1.11    2007-05-18 08:30:00
         - Don't 'use mod_perl;' as this may not work on some mod_perl installations.

Modified: trunk/Catalyst-Engine-Apache/lib/Catalyst/Engine/Apache.pm
===================================================================
--- trunk/Catalyst-Engine-Apache/lib/Catalyst/Engine/Apache.pm	2008-02-19 20:39:34 UTC (rev 7443)
+++ trunk/Catalyst-Engine-Apache/lib/Catalyst/Engine/Apache.pm	2008-02-20 13:49:52 UTC (rev 7444)
@@ -21,6 +21,7 @@
 sub prepare_request {
     my ( $self, $c, $r ) = @_;
     $self->apache( $r );
+    $self->return( undef );
 }
 
 sub prepare_connection {
@@ -131,15 +132,21 @@
         ($path, $qs)            = split /\?/, $path_query, 2;
     }
     
+    # Don't check for LocationMatch blocks if requested
+    # http://rt.cpan.org/Ticket/Display.html?id=26921
+    if ( $self->apache->dir_config('CatalystDisableLocationMatch') ) {
+        $base_path = '';
+    }
+        
     # Check if $base_path appears to be a regex (contains invalid characters),
     # meaning we're in a LocationMatch block
-    if ( $base_path =~ m/[^$URI::uric]/o ) {
+    elsif ( $base_path =~ m/[^$URI::uric]/o ) {
         # Find out what part of the URI path matches the LocationMatch regex,
         # that will become our base
         my $match = qr/($base_path)/;
         my ($base_match) = $path =~ $match;
         
-        $base_path = $base_match;
+        $base_path = $base_match || '';
     }
 
     # Strip leading slash
@@ -276,6 +283,24 @@
     use Apache2::Const -compile => qw(DECLINED);
     $c->engine->return( Apache2::Const::DECLINED );
 
+=head2 NOTES ABOUT LOCATIONMATCH
+
+The Apache engine tries to figure out the correct base path if your app is
+running within a LocationMatch block.  For example:
+
+    <LocationMatch ^/match/(this|that)*>
+        SetHandler          modperl
+        PerlResponseHandler MyApp
+    </LocationMatch>
+
+This will correctly set the base path to '/match/this/' or '/match/that/' depending
+on which path was used for the request.
+
+In some cases this may not be what you want, so you can disable this behavior
+by adding this to your configuration:
+
+    PerlSetVar CatalystDisableLocationMatch 1
+
 =head1 OVERLOADED METHODS
 
 This class overloads some methods from C<Catalyst::Engine>.




More information about the Catalyst-commits mailing list