You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2008/06/12 07:29:47 UTC

svn commit: r666959 - in /tomcat/connectors/trunk/jk/native/common: jk_uri_worker_map.c jk_util.c jk_util.h

Author: mturk
Date: Wed Jun 11 22:29:47 2008
New Revision: 666959

URL: http://svn.apache.org/viewvc?rev=666959&view=rev
Log:
Make wildchar_match function public

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
    tomcat/connectors/trunk/jk/native/common/jk_util.c
    tomcat/connectors/trunk/jk/native/common/jk_util.h

Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c?rev=666959&r1=666958&r2=666959&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Wed Jun 11 22:29:47 2008
@@ -155,37 +155,6 @@
 
 }
 
-/* Match = 0, NoMatch = 1, Abort = -1
- * Based loosely on sections of wildmat.c by Rich Salz
- */
-static int wildchar_match(const char *str, const char *exp, int icase)
-{
-    int x, y;
-
-    for (x = 0, y = 0; exp[y]; ++y, ++x) {
-        if (!str[x] && exp[y] != '*')
-            return -1;
-        if (exp[y] == '*') {
-            while (exp[++y] == '*');
-            if (!exp[y])
-                return 0;
-            while (str[x]) {
-                int ret;
-                if ((ret = wildchar_match(&str[x++], &exp[y], icase)) != 1)
-                    return ret;
-            }
-            return -1;
-        }
-        else if (exp[y] != '?') {
-            if (icase && (tolower(str[x]) != tolower(exp[y])))
-                return 1;
-            else if (!icase && str[x] != exp[y])
-                return 1;
-        }
-    }
-    return (str[x] != '\0');
-}
-
 int uri_worker_map_alloc(jk_uri_worker_map_t **uw_map_p,
                          jk_map_t *init_data, jk_logger_t *l)
 {
@@ -815,7 +784,7 @@
 
         if (uwr->match_type & MATCH_TYPE_WILDCHAR_PATH) {
             /* Map is already sorted by context_len */
-            if (wildchar_match(url, uwr->context,
+            if (jk_wildchar_match(url, uwr->context,
 #ifdef WIN32
                                0
 #else
@@ -868,7 +837,7 @@
             continue;
         if (uwr->match_type & MATCH_TYPE_WILDCHAR_PATH) {
             /* Map is already sorted by context_len */
-            if (wildchar_match(uri, uwr->context,
+            if (jk_wildchar_match(uri, uwr->context,
 #ifdef WIN32
                                0
 #else

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=666959&r1=666958&r2=666959&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Wed Jun 11 22:29:47 2008
@@ -1899,6 +1899,37 @@
     s->vhost_to_uw_map = NULL;
 }
 
+/* Match = 0, NoMatch = 1, Abort = -1
+ * Based loosely on sections of wildmat.c by Rich Salz
+ */
+int jk_wildchar_match(const char *str, const char *exp, int icase)
+{
+    int x, y;
+
+    for (x = 0, y = 0; exp[y]; ++y, ++x) {
+        if (!str[x] && exp[y] != '*')
+            return -1;
+        if (exp[y] == '*') {
+            while (exp[++y] == '*');
+            if (!exp[y])
+                return 0;
+            while (str[x]) {
+                int ret;
+                if ((ret = jk_wildchar_match(&str[x++], &exp[y], icase)) != 1)
+                    return ret;
+            }
+            return -1;
+        }
+        else if (exp[y] != '?') {
+            if (icase && (tolower(str[x]) != tolower(exp[y])))
+                return 1;
+            else if (!icase && str[x] != exp[y])
+                return 1;
+        }
+    }
+    return (str[x] != '\0');
+}
+
 #ifdef _MT_CODE_PTHREAD
 jk_uint32_t jk_gettid()
 {

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?rev=666959&r1=666958&r2=666959&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.h Wed Jun 11 22:29:47 2008
@@ -211,6 +211,8 @@
 int is_http_status_fail(unsigned int http_status_fail_num,
                         int *http_status_fail, int status);
 
+int jk_wildchar_match(const char *str, const char *exp, int icase);
+
 #define TC32_BRIDGE_TYPE    32
 #define TC33_BRIDGE_TYPE    33
 #define TC40_BRIDGE_TYPE    40



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