This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 1665d6b107 Simplify
1665d6b107 is described below
commit 1665d6b1078d878d2fbe9fe97ddbfaf82bfd0a57
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 bef2aab8a6..c6680b6cb1 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -245,8 +245,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 b244676901..b3df130fc1 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -3119,9 +3119,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.removeLast();
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 da13e4a11d..6974652255 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 00d2f20adf..16c672a72b 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -176,9 +176,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]