truk 2004/02/27 11:10:07 Modified: jk/native2/common jk_uriEnv.c jk_uriMap.c Log: Use apache pcre functions when HAVE_AP_PCRE is defined. From Guenter Knauf. Revision Changes Path 1.54 +16 -2 jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c Index: jk_uriEnv.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- jk_uriEnv.c 24 Feb 2004 08:44:40 -0000 1.53 +++ jk_uriEnv.c 27 Feb 2004 19:10:07 -0000 1.54 @@ -28,10 +28,14 @@ #include "jk_uriMap.h" #include "jk_registry.h" +#ifdef HAS_AP_PCRE +#include "httpd.h" +#else #ifdef HAS_PCRE #include "pcre.h" #include "pcreposix.h" #endif +#endif /* return non-zero if pattern has any glob chars in it */ @@ -65,7 +69,7 @@ int pcre = 0; if (*name == '$') { -#ifdef HAS_PCRE +#if defined(HAS_PCRE) || defined(HAS_AP_PCRE) ++name; uriEnv->uri = uriEnv->pool->pstrdup(env, uriEnv->pool, name); uriEnv->match_type = MATCH_TYPE_REGEXP; @@ -73,8 +77,13 @@ "uriEnv.parseName() parsing %s regexp\n", name); { +#ifdef HAS_AP_PCRE + regex_t *preg = ap_pregcomp((apr_pool_t *)uriEnv->pool->_private, uriEnv->uri, REG_EXTENDED); + if (!preg) { +#else regex_t *preg = (regex_t *)uriEnv->pool->calloc( env, uriEnv->pool, sizeof(regex_t)); if (regcomp(preg, uriEnv->uri, REG_EXTENDED)) { +#endif env->l->jkLog(env, env->l, JK_LOG_DEBUG, "uriEnv.parseName() error compiling regexp %s\n", uri); @@ -132,14 +141,19 @@ if (pcre) { ++uri; uriEnv->match_type = MATCH_TYPE_REGEXP; -#ifdef HAS_PCRE +#if defined(HAS_PCRE) || defined(HAS_AP_PCRE) uriEnv->uri = uriEnv->pool->pstrdup(env, uriEnv->pool, uri); env->l->jkLog(env, env->l, JK_LOG_DEBUG, "uriEnv.parseName() parsing regexp %s\n", uri); { +#ifdef HAS_AP_PCRE + regex_t *preg = ap_pregcomp((apr_pool_t *)uriEnv->pool->_private, uriEnv->uri, REG_EXTENDED); + if (!preg) { +#else regex_t *preg = (regex_t *)uriEnv->pool->calloc( env, uriEnv->pool, sizeof(regex_t)); if (regcomp(preg, uriEnv->uri, REG_EXTENDED)) { +#endif env->l->jkLog(env, env->l, JK_LOG_DEBUG, "uriEnv.parseName() error compiling regexp %s\n", uri); 1.68 +8 -2 jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c Index: jk_uriMap.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- jk_uriMap.c 24 Feb 2004 08:44:40 -0000 1.67 +++ jk_uriMap.c 27 Feb 2004 19:10:07 -0000 1.68 @@ -34,9 +34,15 @@ #include "jk_uriMap.h" #include "jk_registry.h" +#ifdef HAS_AP_PCRE +#include "httpd.h" +#define REGEXEC ap_regexec +#else #ifdef HAS_PCRE #include "pcre.h" #include "pcreposix.h" +#define REGEXEC regexec +#endif #endif static INLINE const char *jk2_findExtension(jk_env_t *env, const char *uri); @@ -304,7 +310,7 @@ return uriMap->vhosts->get(env, uriMap->vhosts, "*"); } -#ifdef HAS_PCRE +#if defined(HAS_PCRE) || defined(HAS_AP_PCRE) static jk_uriEnv_t *jk2_uriMap_regexpMap(jk_env_t *env, jk_uriMap_t *uriMap, jk_map_t *mapTable, const char *uri) { @@ -317,7 +323,7 @@ if (uwr->regexp) { regex_t *r = (regex_t *)uwr->regexp; regmatch_t regm[10]; - if (!regexec(r, uri, r->re_nsub + 1, regm, 0)) { + if (!REGEXEC(r, uri, r->re_nsub + 1, regm, 0)) { return uwr; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]