Custom directive and <Location> - bug?

"Alex J. G. Burzyński" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hi,

I've noticed that when using custom directives within nested <Location>
the result of $r->location reports the parent one only, instead of the
subdir.

However if I add PerlSetVar the $r->location will report the correct one.

The way to replicate:
please follow the example
http://perl.apache.org/docs/2.0/user/config/custom.html#Merging_at_Work

and now add:

--- httpd.conf-orig    2010-11-30 12:06:57.491843181 +0000
+++ httpd.conf    2010-11-30 12:07:39.217629859 +0000
@@ -18,6 +18,7 @@
         PerlResponseHandler MyApache2::CustomDirectivesTest
     </Location>
     <Location /custom_directives_test/subdir>
+        PerlSetVar fix "problem"
         MyPlus 1
         MyList     "SubDir"
         MyAppend   "SubDir"


--- MyApache2-orig/CustomDirectivesTest.pm    2010-11-30
12:03:13.430774397 +0000
+++ MyApache2/CustomDirectivesTest.pm    2010-11-30 12:04:58.655364262 +0000
@@ -39,6 +39,8 @@
 
     $r->printf("Processing by %s.\n",
         $s->is_virtual ? "virtual host" : "main server");
+    $r->printf("\$r->$_: %s\n", $r->$_)
+        for qw( uri location path_info );
 
     for my $sec (sort keys %secs) {
         $r->print("\nSection $sec\n");


So when run the output with PerlSetVar is:
# r->uri: /custom_directives_test/subdir
# r->location: /custom_directives_test/subdir
# r->path_info: /subdir

while without:
# r->uri: /custom_directives_test/subdir
# r->location: /custom_directives_test
# r->path_info: /subdir


This has been tested on perl 5.12.2:
Apache/2.2.16 + mod_perl/2.0.4
Apache/2.2.17 + mod_perl/2.0.5-dev (20101111091957)
Apache/2.2.17 + mod_perl/2.0.5-dev (20101130091946)


Cheers,
Alex
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.