Author: markt
Date: Wed Dec  6 18:51:40 2006
New Revision: 483329

URL: http://svn.apache.org/viewvc?view=rev&rev=483329
Log:
Ensure accept-language header conforms to RFC 2616 and ignore it if it doesn't

Modified:
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/Request.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/Request.java?view=diff&rev=483329&r1=483328&r2=483329
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/Request.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/Request.java
 Wed Dec  6 18:51:40 2006
@@ -161,6 +161,12 @@
 
 
     /**
+     * The pattern to match locale language and country components against
+     */
+    protected static String localeRegex = "[a-zA-Z]{1,8}";
+
+
+    /**
      * The default Locale if none are specified.
      */
     protected static Locale defaultLocale = Locale.getDefault();
@@ -2482,6 +2488,9 @@
             String variant = null;
             int dash = entry.indexOf('-');
             if (dash < 0) {
+                if (!entry.matches(localeRegex)) {
+                    continue;
+                }
                 language = entry;
                 country = "";
                 variant = "";
@@ -2495,6 +2504,12 @@
                     country = cTemp;
                 } else {
                     variant = "";
+                }
+                if (!language.matches(localeRegex)) {
+                    continue;
+                }
+                if (!country.matches(localeRegex)) {
+                    continue;
                 }
             }
 

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=483329&r1=483328&r2=483329
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Dec  6 18:51:40 2006
@@ -140,6 +140,10 @@
         fails to load. Also remove requirement that custom error report Valves
         extend ValveBase. (markt)
       </fix>
+      <fix>
+        Ensure Accept-Language headers conform to RFC 2616. Ignore them if
+        they do not. (markt)
+      </fix>
     </changelog>
   </subsection> 
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to