ASF Bugzilla – Attachment 37241 Details for
Bug 64432
RewriteValve does not work with multiple rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch with simple tests and potential fix
Tests_for_multiline_RewriteValve_configuration_initial_fix_for_broken_multiline_RewriteVal.patch (text/plain), 2.43 KB, created by
Jj!
on 2020-05-13 17:09:50 UTC
(
hide
)
Description:
patch with simple tests and potential fix
Filename:
MIME Type:
Creator:
Jj!
Created:
2020-05-13 17:09:50 UTC
Size:
2.43 KB
patch
obsolete
>Index: java/org/apache/catalina/valves/rewrite/RewriteRule.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- java/org/apache/catalina/valves/rewrite/RewriteRule.java (revision b5dc2dd2396c6cdeaf5a8d422cd659812d0734e7) >+++ java/org/apache/catalina/valves/rewrite/RewriteRule.java (date 1589389087219) >@@ -26,7 +26,7 @@ > > protected RewriteCond[] conditions = new RewriteCond[0]; > >- protected static ThreadLocal<Pattern> pattern = new ThreadLocal<>(); >+ protected ThreadLocal<Pattern> pattern = new ThreadLocal<>(); > protected Substitution substitution = null; > > protected String patternString = null; >@@ -86,7 +86,7 @@ > * @return <code>null</code> if no rewrite took place > */ > public CharSequence evaluate(CharSequence url, Resolver resolver) { >- Pattern pattern = RewriteRule.pattern.get(); >+ Pattern pattern = this.pattern.get(); > if (pattern == null) { > // Parse the pattern > int flags = 0; >@@ -94,7 +94,7 @@ > flags |= Pattern.CASE_INSENSITIVE; > } > pattern = Pattern.compile(patternString, flags); >- RewriteRule.pattern.set(pattern); >+ this.pattern.set(pattern); > } > Matcher matcher = pattern.matcher(url); > // Use XOR >Index: test/org/apache/catalina/valves/rewrite/TestRewriteValve.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- test/org/apache/catalina/valves/rewrite/TestRewriteValve.java (revision b5dc2dd2396c6cdeaf5a8d422cd659812d0734e7) >+++ test/org/apache/catalina/valves/rewrite/TestRewriteValve.java (date 1589388337564) >@@ -605,6 +605,15 @@ > doTestRewrite("RewriteRule !^/c/.* /b/", "/c/d", "/c/d"); > } > >+ @Test >+ public void testMultiLine001() throws Exception { >+ doTestRewrite("RewriteRule /dummy /anotherDummy [L]\nRewriteRule ^/a /c [L]", "/a", "/c"); >+ } >+ >+ @Test >+ public void testMultiLine002() throws Exception { >+ doTestRewrite("RewriteRule /dummy /a\nRewriteRule /a /c [L]", "/dummy", "/c"); >+ } > > private void doTestRewrite(String config, String request, String expectedURI) throws Exception { > doTestRewrite(config, request, expectedURI, null);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 64432
: 37241