Author: rjung
Date: Thu Aug 30 07:10:35 2007
New Revision: 571175

URL: http://svn.apache.org/viewvc?rev=571175&view=rev
Log:
Match header names exactly against pre defined constants. Avoid
possible confusion with custom header names using a standard header name
as a prefix.
Ported from a patch against mod_proxy_ajp proposed by Martin Kraemer.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=571175&r1=571174&r2=571175&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Thu Aug 30 
07:10:35 2007
@@ -246,7 +246,7 @@
     const char *p = header_name;
     int i = 0;
 
-    /* ACCEPT-LANGUAGE is the longest headeer
+    /* ACCEPT-LANGUAGE is the longest header
      * that is of interest.
      */
     if (len < 4 || len > 15)
@@ -267,11 +267,11 @@
                     return SC_ACCEPT;
                 else if (header[6] == '-') {
                     p += 6;
-                    if (memcmp(p, "CHARSET", 7) == 0)
+                    if (strcmp(p, "CHARSET") == 0)
                         return SC_ACCEPT_CHARSET;
-                    else if (memcmp(p,  "ENCODING", 8) == 0)
+                    else if (strcmp(p,  "ENCODING") == 0)
                         return SC_ACCEPT_ENCODING;
-                    else if (memcmp(p, "LANGUAGE", 8) == 0)
+                    else if (strcmp(p, "LANGUAGE") == 0)
                         return SC_ACCEPT_LANGUAGE;
                     else
                         return UNKNOWN_METHOD;
@@ -279,45 +279,45 @@
                 else
                     return UNKNOWN_METHOD;
             }
-            else if (memcmp(p, "UTHORIZATION", 12) == 0)
+            else if (strcmp(p, "UTHORIZATION") == 0)
                 return SC_AUTHORIZATION;
             else
                 return UNKNOWN_METHOD;
         break;
         case 'C':
-            if(memcmp(p, "OOKIE2", 6) == 0)
+            if(strcmp(p, "OOKIE2") == 0)
                 return SC_COOKIE2;
-            else if (memcmp(p, "OOKIE", 5) == 0)
+            else if (strcmp(p, "OOKIE") == 0)
                 return SC_COOKIE;
-            else if(memcmp(p, "ONNECTION", 9) == 0)
+            else if(strcmp(p, "ONNECTION") == 0)
                 return SC_CONNECTION;
-            else if(memcmp(p, "ONTENT-TYPE", 11) == 0)
+            else if(strcmp(p, "ONTENT-TYPE") == 0)
                 return SC_CONTENT_TYPE;
-            else if(memcmp(p, "ONTENT-LENGTH", 13) == 0)
+            else if(strcmp(p, "ONTENT-LENGTH") == 0)
                 return SC_CONTENT_LENGTH;
             else
                 return UNKNOWN_METHOD;
         break;
         case 'H':
-            if(memcmp(p, "OST", 3) == 0)
+            if(strcmp(p, "OST") == 0)
                 return SC_HOST;
             else
                 return UNKNOWN_METHOD;
         break;
         case 'P':
-            if(memcmp(p, "RAGMA", 5) == 0)
+            if(strcmp(p, "RAGMA") == 0)
                 return SC_PRAGMA;
             else
                 return UNKNOWN_METHOD;
         break;
         case 'R':
-            if(memcmp(p, "EFERER", 6) == 0)
+            if(strcmp(p, "EFERER") == 0)
                 return SC_REFERER;
             else
                 return UNKNOWN_METHOD;
         break;
         case 'U':
-            if(memcmp(p, "SER-AGENT", 9) == 0)
+            if(strcmp(p, "SER-AGENT") == 0)
                 return SC_USER_AGENT;
             else
                 return UNKNOWN_METHOD;

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=571175&r1=571174&r2=571175&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Thu Aug 30 
07:10:35 2007
@@ -27,6 +27,11 @@
   <br />
   <subsection name="Native">
     <changelog>
+      <fix>
+        AJP13: Match header names exactly against pre defined constants. Avoid
+        possible confusion with custom header names using a standard header 
name
+        as a prefix. (rjung)
+      </fix>
     </changelog>
   </subsection>
 </section>



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

Reply via email to