On Wednesday 01 March 2006 23:20, Glenn Martin wrote:
> Sounds great, but how would i do something simular to:
>
> $r->add_config([sprintf('<LocationMatch
> "%s/?">', $uripath),
> 'DirectoryIndex .',
> 'Options +Indexes',
> 'Dav svn',
> sprintf("SVNPath %s",
> $localpath),
> '</LocationMatch>']);
>
>
> and
>
> $r->add_config([sprintf('<Directory "%s">',
> $localpath), 'DirectoryIndex .', 'Options +Indexes',
> 'Dav On', '</Directory>']);
That leads to an error saying that "<Directory" is not allowed at that point.
In your case I think you don't need the "Directory" around your
configuration, I think. But, let me explain how the configuration is applied
to a request. After startup when the configuration has been parsed you have a
server/vhost-specific default configuration. That is everything outside
"Directory", "Location" and so on. Just before MapToStorage a copy of this
config is made. Then the core-MapToStorage handler applies "Location",
"Directory" etc blocks to that copy. At the end of the request this copy is
thrown away.
The mod_perl MapToStorage handler comes in after the server-specific config is
loaded but before the core handler. In fact if the mp-handler returns OK the
core-handler is skipped.
When $r->add_config([EMAIL PROTECTED], $override) is applied in MapToStorage it
is very
similar to
AllowOverride $override
<Location />
@lines
</Location>
Only this location block is applied *before* any Directory block.
That means
1) If your mp-handler returns DECLINED, your current configuration can be
overridden by the core-handler, because it comes after you.
2) Anything you apply to the config in MapToStorage applies to a copy. Hence,
nothing is needed to undo the changes.
3) Your config can be applied by
$r->add_config([
'DirectoryIndex .',
'Options Indexes',
'Dav svn',
sprintf("SVNPath %s", $localpath),
], ~0) # ~0 == AllowOverride All
But, a few thing cannot be applied by means of $r->add_config. For example
"AllowOverride" needs a "Directory" block or "ProxyPassReverse" does
different things if it appears outside or inside a "Location" block. Further,
mod_perl-2.0.2 cannot apply "Options" if working under Apache 2.2. For these
situations I have posted a patch a few days ago (last Friday I think). I hope
it will make it into mod_perl 2.0.3 see
http://www.gossamer-threads.com/lists/modperl/modperl/87401
In fact, I am currently working on a module that can read the configuration
from a database and apply it on the fly. It already works pretty good. If you
want I can send you a current copy. I think of releasing it on CPAN later
this week or early next week.
Torsten
pgpgj8cFugBNI.pgp
Description: PGP signature
