Skip to content

Commit 3e31c41

Browse files
committed
Update RewriteValve to use dotall mode
1 parent fd17920 commit 3e31c41

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

java/org/apache/catalina/valves/rewrite/RewriteCond.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void parse(Map<String, RewriteMap> maps) {
151151
this.condition = ncondition;
152152
} else {
153153
PatternCondition ncondition = new PatternCondition();
154-
int flags = 0;
154+
int flags = Pattern.DOTALL;
155155
if (isNocase()) {
156156
flags |= Pattern.CASE_INSENSITIVE;
157157
}

java/org/apache/catalina/valves/rewrite/RewriteRule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void parse(Map<String, RewriteMap> maps) {
4747
positive = false;
4848
patternString = patternString.substring(1);
4949
}
50-
int flags = 0;
50+
int flags = Pattern.DOTALL;
5151
if (isNocase()) {
5252
flags |= Pattern.CASE_INSENSITIVE;
5353
}
@@ -89,7 +89,7 @@ public CharSequence evaluate(CharSequence url, Resolver resolver) {
8989
Pattern pattern = this.pattern.get();
9090
if (pattern == null) {
9191
// Parse the pattern
92-
int flags = 0;
92+
int flags = Pattern.DOTALL;
9393
if (isNocase()) {
9494
flags |= Pattern.CASE_INSENSITIVE;
9595
}

webapps/docs/changelog.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@
105105
issues do not "pop up" wrt. others).
106106
-->
107107
<section name="Tomcat 9.0.68 (remm)" rtext="in development">
108+
<subsection name="Catalina">
109+
<changelog>
110+
<fix>
111+
Update the <code>RewriteValve</code> to perform pattern matching using
112+
dotall mode to avoid unexpected behaviour if the URL includes encoded
113+
line terminators. (markt)
114+
</fix>
115+
</changelog>
116+
</subsection>
108117
<subsection name="Coyote">
109118
<changelog>
110119
<fix>

0 commit comments

Comments
 (0)