diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java index c6680b6cb1d1..d0f5efde17a1 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 that will be parsed for a request. - * Use a value less than zero for no limit. Defaults to 10. + * Use a value less than zero for no limit. Defaults to 20. */ - private int maxLocaleCount = 10; + private int maxLocaleCount = 20; /** * The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 1000 by @@ -526,8 +526,8 @@ public void setMaxCookieCount(int maxCookieCount) { /** - * Returns the maximum number of locales that are permitted for a request. Requests that exceed this limit will be - * rejected when the locales are parsed. A value of less than zero means no limit. + * Returns the maximum number of locales that will be parsed for a request. A value of less than zero means no + * limit. * @return the maximum locale count */ public int getMaxLocaleCount() { @@ -536,8 +536,7 @@ public int getMaxLocaleCount() { /** - * Sets the maximum number of locales that are permitted for a request. Requests that exceed this limit will be - * rejected when the locales are parsed. A value of less than zero means no limit. + * Sets the maximum number of locales that will be parsed for a request. A value of less than zero means no limit. * * @param maxLocaleCount the new maximum locale count */ diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index 25500521d461..b241cba76fd9 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -68,7 +68,7 @@ coyoteRequest.sendfileNotCanonical=Unable to determine canonical name of file [{ coyoteRequest.sessionCreateCommitted=Cannot create a session after the response has been committed coyoteRequest.sessionEndAccessFail=Exception triggered ending access to session while recycling request coyoteRequest.setAttribute.namenull=Cannot call setAttribute with a null name -coyoteRequest.tooManyLocales=More than the maximum allowed number of locales, [{0}], were detected. Use the maxLocaleCount attribute of the connector to resolve this if the application should accept more locales. +coyoteRequest.tooManyLocales=More than the maximum number of locales for a single request ([{0}]) were detected. Any locales beyond this limit have been ignored. To change this limit, set the maxLocaleCount attribute on the Connector. coyoteRequest.trailersNotReady=It is illegal to call getTrailerFields() before isTrailerFieldsReady() has returned true coyoteRequest.upgradeAfterAsync=Unable to upgrade the request because async processing has been started coyoteRequest.upgradeAfterCommit=Unable to upgrade the request because the response has been committed diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 43e7d28fc157..040269326cc1 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -443,8 +443,8 @@ public org.apache.coyote.Request getCoyoteRequest() { private int maxPartHeaderSize = -1; /** - * The maximum number of locales permitted for a request. The Accept-Language header value is untrusted input - * bounded only by the maximum header size so the number of locales is bounded by default to limit the + * The maximum number of locales that will be parsed for a request. The Accept-Language header value is untrusted + * input bounded only by the maximum header size so the number of locales is bounded by default to limit the * per-request processing and the number of distinct locales exposed to web applications and internal components. * A value of less than zero means no limit. */ @@ -3183,7 +3183,7 @@ protected void parseLocalesHeader(String value, TreeMap // Determine how many more entries are of interest. One more than the // maximum is parsed so that a header that exceeds the limit is - // rejected rather than silently truncated. Parsing no further entries + // logged rather than silently truncated. Parsing no further entries // once the limit is reached avoids creating Locale objects for entries // that can never be used. int maxElements = -1; diff --git a/java/org/apache/catalina/connector/mbeans-descriptors.xml b/java/org/apache/catalina/connector/mbeans-descriptors.xml index 00d66a893970..c02303da04e4 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"/> 1148 provided by Arturo Bernal. (markt) + + Increase the default value of the maxLocaleCount attribute + of the Connector from 10 to 20. + diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml index 16c672a72b10..288b9b777e3e 100644 --- a/webapps/docs/config/ajp.xml +++ b/webapps/docs/config/ajp.xml @@ -175,10 +175,10 @@

The maximum number of locales (obtained from the - Accept-Language header(s)) that are permitted for a request. + Accept-Language header(s)) that will be parsed for a request. 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.

+ limit. If not specified, a default of 20 is used.

diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml index 75b70220e338..5dd10eef1413 100644 --- a/webapps/docs/config/http.xml +++ b/webapps/docs/config/http.xml @@ -171,10 +171,10 @@

The maximum number of locales (obtained from the - Accept-Language header(s)) that are permitted for a request. + Accept-Language header(s)) that will be parsed for a request. 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.

+ limit. If not specified, a default of 20 is used.