Hi all,

A long standing problem in httpd has been the behaviour of the 
LocationMatch/DirectoryMatch with respect to the path passed to the per 
directory configuration. The problem is summed up by the following comment in 
http_config.h:

    /** If configuring for a directory, pathname of that directory.
     *  NOPE!  That's what it meant previous to the existence of <Files>,
     * <Location> and regex matching.  Now the only usefulness that can be
     * derived from this field is whether a command is being called in a
     * server context (path == NULL) or being called in a dir context
     * (path != NULL).  */
    char *path;

In the case of LocationMatch and DirectoryMatch, the value of path is simply 
the raw regular expression.

The problem is that some modules - mod_dav and mod_dav_svn in particular, *do* 
use this path, and right now it means that if “DAV on” or “DAV svn” finds 
itself in a LocationMatch container, the regex is used as the base path, and 
the request fails.

I have created a patch that adds an optional path in front of the regular 
expression in LocationMatch/DirectoryMatch/FileMatch, so you can do this:

    <DirectoryMatch /path/to/dav/ ^/path/to/dav/(?<CUSTOMERNAME>[^/]+)/>
       DAV on
    </Directory>

This gives mod_dav the option to receive a valid path, and so work inside 
DirectoryMatch (and mod_dav_svn has the option to receive a valid path, and so 
work inside LocationMatch, more on that in follow messages).

The above config does have a limitation though, in that all possible matches on 
CUSTOMERNAME all end up sharing the same dav filesystem. What if you want one 
dedicated dav filesystem per customer? Next patch addresses that.

Regards,
Graham
—

Attachment: httpd-core-regex3.patch
Description: Binary data

Reply via email to