This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 30783270df Simplify
30783270df is described below
commit 30783270df5b935f5771bae7634078580446683c
Author: remm <[email protected]>
AuthorDate: Fri Oct 23 13:39:22 2026 +0200
Simplify
Add missing updates for the behavior to some places too.
Based on a PR by DaZuiZui.
---
java/org/apache/catalina/connector/Connector.java | 4 ++--
java/org/apache/catalina/connector/Request.java | 3 +--
java/org/apache/catalina/connector/mbeans-descriptors.xml | 2 +-
webapps/docs/config/ajp.xml | 6 +++---
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/catalina/connector/Connector.java
b/java/org/apache/catalina/connector/Connector.java
index d51146f3ac..ff59ebdaa7 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -246,8 +246,8 @@ public class Connector extends LifecycleMBeanBase {
private int maxCookieCount = 200;
/**
- * The maximum number of locales permitted for a request. Requests that
exceed this limit will be rejected when
- * the locales are parsed. Use a value less than zero for no limit.
Defaults to 10.
+ * The maximum number of locales that will be parsed for a request.
+ * Use a value less than zero for no limit. Defaults to 10.
*/
private int maxLocaleCount = 10;
diff --git a/java/org/apache/catalina/connector/Request.java
b/java/org/apache/catalina/connector/Request.java
index 4f8c81d023..822ab9a73e 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -3348,9 +3348,8 @@ public class Request implements HttpServletRequest {
for (ArrayList<Locale> list : locales.values()) {
for (Locale locale : list) {
if (maxLocaleCount > -1 && this.locales.size() >=
maxLocaleCount) {
- // Remove the last element
- this.locales.remove(this.locales.size() - 1);
log.info(sm.getString("coyoteRequest.tooManyLocales",
Integer.valueOf(maxLocaleCount)));
+ return;
}
addLocale(locale);
}
diff --git a/java/org/apache/catalina/connector/mbeans-descriptors.xml
b/java/org/apache/catalina/connector/mbeans-descriptors.xml
index ed603b28d3..dfcec45dcd 100644
--- a/java/org/apache/catalina/connector/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/connector/mbeans-descriptors.xml
@@ -107,7 +107,7 @@
type="int"/>
<attribute name="maxLocaleCount"
- description="The maximum number of locales that are permitted for a
request. Requests that exceed this limit will be rejected when the locales are
parsed. 10 by default. A value of less than 0 means no limit."
+ description="description="The maximum number of locales that are
parsed for a request. 10 by default. A value of less than 0 means no limit."
type="int"/>
<attribute name="maxParameterCount"
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 1dddb3903a..85b05278ef 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -177,9 +177,9 @@
<attribute name="maxLocaleCount" required="false">
<p>The maximum number of locales (obtained from the
<code>Accept-Language</code> header(s)) that are permitted for a request.
- Requests that exceed this limit will be rejected when the locales are
- parsed. A value of less than 0 means no limit. If not specified, a
- default of 10 is used.</p>
+ Locales above this limit will be ignored when the locales are
+ parsed and an info will be logged. A value of less than 0 means no
+ limit. If not specified, a default of 10 is used.</p>
</attribute>
<attribute name="maxParameterCount" required="false">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]