You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2006/12/08 03:11:51 UTC

svn commit: r483776 - in /tomcat: connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt

Author: markt
Date: Thu Dec  7 18:11:48 2006
New Revision: 483776

URL: http://svn.apache.org/viewvc?view=rev&rev=483776
Log:
Ensure Accept-Language headers are valid

Modified:
    tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java
    tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt

Modified: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java?view=diff&rev=483776&r1=483775&r2=483776
==============================================================================
--- tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java (original)
+++ tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java Thu Dec  7 18:11:48 2006
@@ -2077,6 +2077,10 @@
                 }
             }
 
+            if (!isAlpha(language) || !isAlpha(country) || !isAlpha(variant)) {
+                continue;
+            }
+
             // Add a new Locale to the list of Locales for this quality level
             Locale locale = new Locale(language, country, variant);
             Double key = new Double(-quality);  // Reverse the order
@@ -2104,5 +2108,13 @@
 
     }
 
-
+    protected static final boolean isAlpha(String value) {
+        for (int i = 0; i < value.length(); i++) {
+            char c = value.charAt(i);
+            if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) {
+                return false;
+            }
+        }
+        return true;
+    }
 }

Modified: tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt
URL: http://svn.apache.org/viewvc/tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt?view=diff&rev=483776&r1=483775&r2=483776
==============================================================================
--- tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt (original)
+++ tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt Thu Dec  7 18:11:48 2006
@@ -1890,6 +1890,10 @@
 [4.1.33] JK Connector
          Connectors configured for AJP always used HTTP
 
+[4.1.35] CoyoteConnector
+         Ensure Accept-Language headers conform to RFC 2616 and ignore them
+         if they do not.
+
 
 ----------------
 Jasper Bug Fixes:



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org