httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: [users@httpd] allow autoindex for a directory, but not for its subdirectories
Date Mon, 23 Aug 2010 20:58:12 GMT
On Mon, Aug 23, 2010 at 4:55 PM, Freek Dijkstra <public@macfreek.nl> wrote:
> Eric Covener wrote:
>
>> The patch is very easy, but I am afraid it might not be suitable to
>> backport to 2.2.x.
>>
>> I struggled with finding some fancy PCRE feature that would make this
>> work as most people expect it to -- \Z or negative lookahead, but
>> AFAICT they all fail to simulate the $ due to the PCRE flag being
>> passed.
>
> I had a quick look at the code in trunk, and it seems that the regexps
> are compiled on line 1749 and 1775:
>> ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
>
> This regexp does not contain AP_REG_NOTEOL/PCRE_NOTEOL.
>
> The only place NOTEOL is added is in ap_directory_walk() in line 1172 of
> request.c.
> I presume it adds that this function walks through a bunch of regular
> expression and its to _all_ regular expression, including the
> DirectoryMatch where it should not be added.
>
> Right now I don't understand why ap_directory_walk() adds this flag, but
> aside for that, would it be an option to remove the AP_REG_NOTEOL from
> request.c, and instead add it to the places where all these regexps are
> compiled (thus add them to the ap_pregcomp() calls) instead?
> It's probably more work (making sure you miss no ap_pregcomp()), but
> that would work, and is probably a better solution than some \Z hack (of
> which I'm not sure it works).

I didn't realize that was an option, or that it would help matters.
AP_REG_NOTEOL applies to the "subject" of the pcre match, not the
expression itself.

I had planned to simply drop the flag from the regexec and update the
manual to say DirectoryMatch doesn't implitly apply to subdirectories
(just the match which is trivially extended by altering the regex)

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message