From 579ab2277553c94b98c4706a11e2e3a9fc0e10a6 Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Fri, 27 Aug 2010 10:46:02 +0000 Subject: [PATCH] PR49809: Allow DirectoryMatch to match the EOL character ($). and stop applying to subdirectories (that don't also match the regex) implicitly. The manual already uses DirectoryMatch syntax that assumes this in other places! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@990091 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ docs/manual/mod/core.html.en | 22 ++++++++++++++++++---- docs/manual/mod/core.xml | 23 ++++++++++++++++++----- server/request.c | 2 +- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index a0cced613c..b7cea31f4a 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.9 + *) core: DirectoryMatch can now match on the end of line character ($), + and sub-directories of matched directories are no longer implicitly + matched. PR49809 [Eric Covener] Changes with Apache 2.3.8 diff --git a/docs/manual/mod/core.html.en b/docs/manual/mod/core.html.en index 9658c43124..6cca6ed13d 100644 --- a/docs/manual/mod/core.html.en +++ b/docs/manual/mod/core.html.en @@ -742,10 +742,10 @@ subdirectories

<DirectoryMatch> and </DirectoryMatch> are used to enclose a group - of directives which will apply only to the named directory and - sub-directories of that directory, the same as <Directory>. However, it - takes as an argument a regular - expression. For example:

+ of directives which will apply only to the named directory, + the same as <Directory>. + However, it takes as an argument a + regular expression. For example:

<DirectoryMatch "^/www/(.+/)?[0-9]{3}"> @@ -754,6 +754,20 @@ subdirectories

would match directories in /www/ that consisted of three numbers.

+

Compatability

+ Prior to 2.3.9, this directive implicitly applied to sub-directories + (like <Directory>) and + could not match the end of line symbol ($). In 2.3.9 and later, + only directories that match the expression are affected by the enclosed + directives. +
+ +

Trailing Slash

+ This directive applies to requests for directories that may or may + not end in a trailing slash, so expressions that are anchored to the + end of line ($) must be written with care. +
+

See also

  • <Directory> for diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index 820d9146c1..4165dbd87f 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -698,11 +698,10 @@ subdirectories

    DirectoryMatch and </DirectoryMatch> are used to enclose a group - of directives which will apply only to the named directory and - sub-directories of that directory, the same as Directory. However, it - takes as an argument a regular - expression. For example:

    + of directives which will apply only to the named directory, + the same as Directory. + However, it takes as an argument a + regular expression. For example:

    <DirectoryMatch "^/www/(.+/)?[0-9]{3}"> @@ -710,6 +709,20 @@ subdirectories

    would match directories in /www/ that consisted of three numbers.

    + + Compatability + Prior to 2.3.9, this directive implicitly applied to sub-directories + (like Directory) and + could not match the end of line symbol ($). In 2.3.9 and later, + only directories that match the expression are affected by the enclosed + directives. + + + Trailing Slash + This directive applies to requests for directories that may or may + not end in a trailing slash, so expressions that are anchored to the + end of line ($) must be written with care. +
    Directory for a description of how regular expressions are mixed in with normal diff --git a/server/request.c b/server/request.c index a5fbcde998..612b09eb2f 100644 --- a/server/request.c +++ b/server/request.c @@ -1169,7 +1169,7 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) continue; } - if (ap_regexec(entry_core->r, r->filename, 0, NULL, AP_REG_NOTEOL)) { + if (ap_regexec(entry_core->r, r->filename, 0, NULL, 0)) { continue; } -- 2.50.1