From 429cd00c128511d96e855631a39997fa97945928 Mon Sep 17 00:00:00 2001
From: Enric Pou
Date: Tue, 20 Oct 2026 13:04:25 +0200
Subject: [PATCH] Restore unlimited maxLocaleCount by default
---
java/org/apache/catalina/connector/Connector.java | 4 ++--
java/org/apache/catalina/connector/Request.java | 2 +-
java/org/apache/catalina/connector/mbeans-descriptors.xml | 2 +-
test/org/apache/catalina/connector/TestRequest.java | 6 +++---
webapps/docs/config/ajp.xml | 2 +-
webapps/docs/config/http.xml | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index bef2aab8a6f5..4a73cdc4cb87 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -246,9 +246,9 @@ public Connector(ProtocolHandler protocolHandler) {
/**
* 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 locales are parsed. Use a value less than zero for no limit. Defaults to -1.
*/
- private int maxLocaleCount = 10;
+ private int maxLocaleCount = -1;
/**
* The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 1000 by
diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java
index a5bb569defdd..72c70eb96dc4 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -134,7 +134,7 @@ public class Request implements HttpServletRequest {
* The default value of the maximum number of locales to parse from the Accept-Language header(s). Must match the
* default of the maxLocaleCount attribute of the Connector with which a Request is associated.
*/
- private static final int DEFAULT_MAX_LOCALE_COUNT = 10;
+ private static final int DEFAULT_MAX_LOCALE_COUNT = -1;
/*
* Use AcceptLanguage2 parser rather than the StandardAcceptLanguageParser.
diff --git a/java/org/apache/catalina/connector/mbeans-descriptors.xml b/java/org/apache/catalina/connector/mbeans-descriptors.xml
index da13e4a11d52..5a84eb6c66d0 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"/>
Accept-Language 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.
+ default of -1 is used.
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 98607caa227b..b6c62673af84 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -174,7 +174,7 @@
Accept-Language 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.
+ default of -1 is used.