You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/09/30 19:20:39 UTC
[tomcat] branch 10.0.x updated: Update RewriteValve to use dotall mode
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new 239aa9f5f5 Update RewriteValve to use dotall mode
239aa9f5f5 is described below
commit 239aa9f5f5a7239e3e3c13871424d01792f9488d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 30 20:19:42 2022 +0100
Update RewriteValve to use dotall mode
---
java/org/apache/catalina/valves/rewrite/RewriteCond.java | 2 +-
java/org/apache/catalina/valves/rewrite/RewriteRule.java | 4 ++--
webapps/docs/changelog.xml | 9 +++++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/catalina/valves/rewrite/RewriteCond.java b/java/org/apache/catalina/valves/rewrite/RewriteCond.java
index 47a904c1e0..90bdc5289a 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteCond.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteCond.java
@@ -151,7 +151,7 @@ public class RewriteCond {
this.condition = ncondition;
} else {
PatternCondition ncondition = new PatternCondition();
- int flags = 0;
+ int flags = Pattern.DOTALL;
if (isNocase()) {
flags |= Pattern.CASE_INSENSITIVE;
}
diff --git a/java/org/apache/catalina/valves/rewrite/RewriteRule.java b/java/org/apache/catalina/valves/rewrite/RewriteRule.java
index ca29223deb..d055882a13 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteRule.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteRule.java
@@ -47,7 +47,7 @@ public class RewriteRule {
positive = false;
patternString = patternString.substring(1);
}
- int flags = 0;
+ int flags = Pattern.DOTALL;
if (isNocase()) {
flags |= Pattern.CASE_INSENSITIVE;
}
@@ -89,7 +89,7 @@ public class RewriteRule {
Pattern pattern = this.pattern.get();
if (pattern == null) {
// Parse the pattern
- int flags = 0;
+ int flags = Pattern.DOTALL;
if (isNocase()) {
flags |= Pattern.CASE_INSENSITIVE;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b49a0d8ccb..405eb15bc8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,15 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 10.0.27 (markt)" rtext="in development">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ Update the <code>RewriteValve</code> to perform pattern matching using
+ dotall mode to avoid unexpected behaviour if the URL includes encoded
+ line terminators. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Coyote">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org