Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java/org/apache/catalina/connector/Connector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/connector/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/connector/mbeans-descriptors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="The maximum number of locales that are permitted for a request. Requests that exceed this limit will be rejected when the locales are parsed. -1 by default. A value of less than 0 means no limit."
type="int"/>

<attribute name="maxParameterCount"
Expand Down
6 changes: 3 additions & 3 deletions test/org/apache/catalina/connector/TestRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ public void testAcceptLanguageLocaleLimit() throws Exception {
*/
@Test
public void testAcceptLanguageLocaleLimitConfigurable() throws Exception {
// Connector default of 10 permits exactly 10 locales
// Connector of 10 permits exactly 10 locales
Assert.assertEquals(10, localeCount(new Connector(), buildAcceptLanguage(10)));

// Explicit limit is enforced
Expand Down Expand Up @@ -878,7 +878,7 @@ private static int localeCount(Connector connector, String acceptLanguage) {
public void testAcceptLanguageLocaleLimitHeaderFlood() throws Exception {
Connector connector = new Connector();

// Default limit of 10. A header with far more tags than the
// Limit of 10. A header with far more tags than the
// limit is rejected.
try {
localeCount(connector, buildAcceptLanguage(5000));
Expand All @@ -898,7 +898,7 @@ public void testAcceptLanguageLocaleLimitHeaderFlood() throws Exception {
*/
@Test
public void testAcceptLanguageLocaleLimitMultipleHeaders() throws Exception {
// 5 + 5 = 10, within the default limit
// 5 + 5 = 10, within the limit
Assert.assertEquals(10, localeCount(new Connector(), "aa-000,aa-001,aa-002,aa-003,aa-004",
"aa-005,aa-006,aa-007,aa-008,aa-009"));

Expand Down
2 changes: 1 addition & 1 deletion webapps/docs/config/ajp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<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>
default of -1 is used.</p>
</attribute>

<attribute name="maxParameterCount" required="false">
Expand Down
2 changes: 1 addition & 1 deletion webapps/docs/config/http.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<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>
default of -1 is used.</p>
</attribute>

<attribute name="maxParameterCount" required="false">
Expand Down