[jboss-jira] [JBoss JIRA] Commented: (JBWEB-67) Patch to fix usabillity issues with the rewrite valve

Rob Hughes (JIRA) jira-events at jboss.com
Mon Aug 7 12:58:12 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBWEB-67?page=comments#action_12340765 ] 
            
Rob Hughes commented on JBWEB-67:
---------------------------------

I am unsure where to have a discussion about this if you don't want the report reopened, so I won't reopen it but am adding this comment.

I guess I have misstated what the problem is due to the fact that the example I provided had an issue with the RewriteCond and the query string and not the rule itself.

With mod_rewrite and the rewrite valve the pattern is always matched against the full TestString.  I am not disagreeing with that statement.  What I am disagreeing with is by using Matcher.matches() you force the pattern to match the entire TestString.  There is a subtle difference between matching the pattern to the entire string and forcing the pattern to match the entire string.  Mod_rewrite does not do this, in the documentation it states that the URL or TestString is matched against the pattern.  Nowhere does it state that the pattern must match the entire string and in actual usage you will find that it doesn't have to.

For Example Given
RewriteCond %{QUERY_STRING} name=([^&;]*)
and Input name=about&test=param

Mod_rewrite will process this condition as true while the current rewrite valve will process it as false.  I would have to change the pattern to be .*name=([^&;]*).* to get it to match.

If you are not aiming to provide a rewrite module that functions similar to mod_rewrite that this is a moot point and you can leave it as is, but it should be documented to state that the pattern must match the TestString in it's entirety.

> Patch to fix usabillity issues with the rewrite valve
> -----------------------------------------------------
>
>                 Key: JBWEB-67
>                 URL: http://jira.jboss.com/jira/browse/JBWEB-67
>             Project: JBoss Web
>          Issue Type: Patch
>      Security Level: Public(Everyone can see) 
>          Components: Rewrite Valve
>    Affects Versions: JBoss Web Server 1.0.0 GA
>            Reporter: Rob Hughes
>         Assigned To: Remy Maucherat
>             Fix For: JBoss Web Server 1.0.0 GA
>
>         Attachments: rewrite_valve.patch
>
>
> I'm providing this patch which fixes the following issues with the rewrite valve and makes it's behavior more consistent with mod_rewrite.
> 1: Rewrite conditions were not being processed
> 2: Case insensitive pattern matches were not working
> 3: Send redirect with an arbitrary code now works and uses reflection to see if the method is available so the valve will still work with standalone tomcat
> 4: Patterns are no longer forced to match the whole input for conditions and rules
> 5: The server variable HTTP_HOST included the port if the server wasn't running on the standard ones (80/443)
> 6: QSA is how handled and query strings are appended where appropriate
> 7: Comments are now allowed in the rewrite.properties file
> The patch is against the jbossweb trunk.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list