Re: Fixing Apache::ReadConfig limitations

Mithun Bhattacharya <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAHTPV9Krz4E1z=VXLouQCfp8R4cfwqZDx4JHyN98q8az9msZkg@mail.gmail.com>
Doesnt it accept array of array refs for this purpose ?

On Fri, Apr 16, 2021 at 1:10 PM John A. <[email protected]> wrote:

> Presently, Apache::ReadConfig doesn't seem to provide a way to represent
> the order of directives, which limits its usefulness when used with
> modules like mod_rewrite that rely on the order of certain directives:
>
> <VirtualHost "*:80">
>     ServerName example.com
>     DirectoryRoot /www
>     <Directory "/www">
>         RewriteEngine On
>         RewriteCond %{REQUEST_FILENAME} !-f
>         RewriteCond %{REQUEST_FILENAME} !-d
>         RewriteRule (.*) cgit.cgi/$1 [END,QSA]
>     </Directory>
> </VirtualHost>
>
> This piece of configuration is (AFAIK?) impossible to create using
> Apache::ReadConfig, because %VirtualHost and %Directory are unordered
> hashes.
>
> Assuming I'm correct about the problem, what could be done to fix it?
>
> My personal idea is to create an additional module created
> Apache::ReadConfig::Full (or something), which allows the following:
>
> $Config->push(['VirtualHost', '*:80'] => block(
>     ServerName => 'example.com',
>     DirectoryRoot => '/www',
>         ['Directory', '/www'] => block(
>         RewriteEngine => On,
>         RewriteCond => '%{REQUEST_FILENAME} !-f',
>         RewriteCond => '%{REQUEST_FILENAME} !-d',
>         RewriteRule => '(.*) cgit.cgi/$1 [END,QSA]'
>     )
> );
>
> The `block' function creates an object that amounts to an ordered,
> multi-value hash a la Hash::MultiValue. (The global $Config variable is
> the same type of object.)
>
> Before I start looking into the possibility of creating such an
> interface, I thought I'd ask here whether my assumptions about
> Apache::ReadConfig's limitations are correct.
>
> Best regards
> John
>
>
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.