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 2016/09/23 12:52:02 UTC

svn commit: r1762057 - in /tomcat/jk/trunk: native/common/jk_uri_worker_map.c xdocs/miscellaneous/changelog.xml

Author: markt
Date: Fri Sep 23 12:52:02 2016
New Revision: 1762057

URL: http://svn.apache.org/viewvc?rev=1762057&view=rev
Log:
Minor code clean-up and optimization

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

Modified: tomcat/jk/trunk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_uri_worker_map.c?rev=1762057&r1=1762056&r2=1762057&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/jk/trunk/native/common/jk_uri_worker_map.c Fri Sep 23 12:52:02 2016
@@ -429,6 +429,7 @@ static void extension_fix_fail_on_status
     unsigned int i;
     int j;
     int cnt = 1;
+    size_t status_len;
     char *status;
 #ifdef _MT_CODE_PTHREAD
     char *lasts;
@@ -436,7 +437,8 @@ static void extension_fix_fail_on_status
 
     JK_TRACE_ENTER(l);
 
-    for (i = 0; i < (unsigned int)strlen(extensions->fail_on_status_str); i++) {
+    status_len = strlen(extensions->fail_on_status_str);
+    for (i = 0; i < status_len; i++) {
         if (extensions->fail_on_status_str[i] == ',' ||
             extensions->fail_on_status_str[i] == ' ')
             cnt++;
@@ -1073,6 +1075,8 @@ const char *map_uri_to_worker_ext(jk_uri
     unsigned int vhost_len;
     int reject_unsafe;
     int collapse_slashes;
+    size_t uri_len;
+    size_t remain;
     int rv = -1;
     char  url[JK_MAX_URI_LEN+1];
 
@@ -1142,11 +1146,13 @@ const char *map_uri_to_worker_ext(jk_uri
     /* Make the copy of the provided uri and strip
      * everything after the first ';' char.
      */
-    for (i = 0; i < strlen(uri); i++) {
-        if (i == JK_MAX_URI_LEN) {
+    uri_len = strlen(uri);
+    remain = JK_MAX_URI_LEN - vhost_len;
+    for (i = 0; i < uri_len; i++) {
+        if (i == remain) {
             jk_log(l, JK_LOG_WARNING,
                    "URI %s is invalid. URI must be smaller than %d chars",
-                   uri, JK_MAX_URI_LEN);
+                   uri, remain);
             JK_TRACE_EXIT(l);
             return NULL;
         }

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1762057&r1=1762056&r2=1762057&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Fri Sep 23 12:52:02 2016
@@ -121,6 +121,9 @@
         configured with an invalid value for JkShmFile. This causes the server
         startup to fail. (markt)
       </fix>
+      <fix>
+        Minor code clean-up and optimization. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>



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