You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/02/13 13:16:47 UTC

[Bug 54556] New: New flag to add default rule in rule chain

https://issues.apache.org/bugzilla/show_bug.cgi?id=54556

            Bug ID: 54556
           Summary: New flag to add default rule in rule chain
           Product: Apache httpd-2
           Version: 2.4.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_rewrite
          Assignee: bugs@httpd.apache.org
          Reporter: david@ols.es
    Classification: Unclassified

Created attachment 29946
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29946&action=edit
Patch that add CDEF new RewriteRule flag

The CDEF flag marks the rule as the default rule for a rule chain.

If the rule does not match it acts as if it has the CHAIN flag and makes the
engine skip all chained rules.

If the rule matches the result is saved as the default result for the rule
chain and the rule is ignored as if it didn't match, then engine continues
testing rules in the chain. If one of the chain rules matches then the default
is discarded and the matching rule is used. If none of the chained rules
matches, then the default is used.

It converts the rule tagged with CDEF as a sort of RewriteCond that can be used
with more than one rule and provides a default result, but it also actually
prevents the chained rules to be tested if it does not match:

For example:

RewriteRule ^example$    /index.php?action=foo [L,NS,QSA]
RewriteRule ^(login|lostpw|logout|expired)$    /index.php?page=$1 [L,NS,QSA]
RewriteRule ^([a-z]+)$ /index.php?section=$1 [L,NS,QSA]

The first two rules are exceptions to the last one and in a normal setup a uri
that does not match any of this rules will triger a test on every rule. Using
CDEF it can be written that way;

RewriteRule ^([a-z]+)$ /index.php?section=$1 [L,NS,QSA,CDEF]
RewriteRule ^example$    /index.php?action=foo [L,NS,QSA,C]
RewriteRule ^(login|lostpw|logout|expired)$    /index.php?page=$1 [L,NS,QSA]

this way non-matching uri's will only trigger a test on the first rule and all
the other two will be skipped

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54556] New flag to add default rule in rule chain

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54556

David Saez <da...@ols.es> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29946|0                           |1
        is obsolete|                            |

--- Comment #1 from David Saez <da...@ols.es> ---
Created attachment 29947
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29947&action=edit
Patch that add CDEF new RewriteRule flag

is the same patch, is just that submitting it when opening the request does not
allow to see the diff

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54556] New flag to add default rule in rule chain

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54556

David Saez <da...@ols.es> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org