cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_uriEnv.c jk_uriMap.c
truk2004/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 ChangesPath 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 - 1.53 +++ jk_uriEnv.c 27 Feb 2004 19:10:07 - 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 - 1.67 +++ jk_uriMap.c 27 Feb 2004 19:10:07 - 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]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_uriEnv.c jk_uriMap.c
costin 02/05/01 10:23:14 Modified:jk/native2/common jk_uriEnv.c jk_uriMap.c Log: Reduce verbosity of messages. Fix a mapping bug for prefix mappings ( it is in jk1 too, but there you get around by using the 'general prefix mapping' - /examples* or by mapping both /examples and /examples/* ). ( the bug was that /examples/* did matched the ending / ). After I get the web.xml-jk converter I'll start watchdog-ing. ( I just added filter support ) Revision ChangesPath 1.14 +18 -16jakarta-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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_uriEnv.c 30 Apr 2002 06:44:57 - 1.13 +++ jk_uriEnv.c 1 May 2002 17:23:14 - 1.14 @@ -82,8 +82,8 @@ { char *n=name; char *slash=strchr( name, '/' ); - -fprintf( stderr, XXX parseURI %s\n, name ); + +/* fprintf( stderr, XXX parseURI %s\n, name ); */ if( slash==NULL ) { /* That's a virtual host definition ( no actual mapping, just global @@ -214,16 +214,17 @@ uriEnv-workerName=uriEnv-uriMap-workerEnv-defaultWorker-mbean-name;; uriEnv-worker=uriEnv-uriMap-workerEnv-defaultWorker; -env-l-jkLog(env, env-l, JK_LOG_DEBUG, - uriMap.init() map %s %s\n, - uriEnv-uri, uriEnv-uriMap-workerEnv-defaultWorker-mbean-name); +if( uriEnv-debug 0 ) +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + uriEnv.init() map %s %s\n, + uriEnv-uri, uriEnv-uriMap-workerEnv-defaultWorker-mbean-name); } if( uriEnv-workerName != NULL uriEnv-worker==NULL ) { uriEnv-worker= env-getByName( env, wname ); if( uriEnv-worker==NULL ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, - uriMap.init() map to invalid worker %s %s\n, + uriEnv.init() map to invalid worker %s %s\n, uriEnv-uri, uriEnv-workerName); /* XXX that's allways a 'lb' worker, create it */ } @@ -240,7 +241,7 @@ * not arrive here when using Apache. */ env-l-jkLog(env, env-l, JK_LOG_ERROR, - uriMap.addMapping() context must start with '/' in %s\n, + uriEnv.init() context must start with '/' in %s\n, uri); return JK_ERR; } @@ -261,16 +262,16 @@ if( uriEnv-debug 0 ) { if( uriEnv-match_type == MATCH_TYPE_CONTEXT ) { env-l-jkLog(env, env-l, JK_LOG_INFO, - uriMap.addMapping() context mapping %s=%s \n, + uriEnv.init() context mapping %s=%s \n, uriEnv-prefix, uriEnv-workerName); } else if( uriEnv-match_type == MATCH_TYPE_HOST ) { env-l-jkLog(env, env-l, JK_LOG_INFO, - uriMap.addMapping() host mapping %s=%s \n, + uriEnv.init() host mapping %s=%s \n, uriEnv-virtual, uriEnv-workerName); } else { env-l-jkLog(env, env-l, JK_LOG_INFO, - uriMap.addMapping() exact mapping %s=%s \n, + uriEnv.init() exact mapping %s=%s \n, uriEnv-prefix, uriEnv-workerName); } } @@ -312,7 +313,7 @@ uriEnv-match_type = MATCH_TYPE_SUFFIX; if( uriEnv-debug 0 ) { env-l-jkLog(env, env-l, JK_LOG_INFO, - uriMap.addMapping() suffix mapping %s .%s=%s was added\n, + uriEnv.init() suffix mapping %s .%s=%s was added\n, uriEnv-prefix, uriEnv-suffix, uriEnv-workerName); } } else if ('\0' != asterisk[2]) { @@ -324,19 +325,20 @@ uriEnv-match_type = MATCH_TYPE_GENERAL_SUFFIX; if( uriEnv-debug 0 ) { env-l-jkLog(env, env-l, JK_LOG_INFO, - uriMap.addMapping() general suffix mapping %s.%s=%s\n, + uriEnv.init() general suffix mapping %s.%s=%s\n, uri, asterisk + 2, uriEnv-workerName); } } else { -/* context based /context/prefix/ASTERISK */ +/* context based /context/prefix/ASTERISK */ asterisk[1] = '\0'; +asterisk[0] = '\0';
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_uriEnv.c jk_uriMap.c
costin 02/03/25 19:03:01 Modified:jk/native2/common jk_uriEnv.c jk_uriMap.c Log: Update, remove excessive debugging. Revision ChangesPath 1.6 +3 -5 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_uriEnv.c 24 Mar 2002 19:24:26 - 1.5 +++ jk_uriEnv.c 26 Mar 2002 03:03:01 - 1.6 @@ -79,7 +79,7 @@ if( slash==NULL ) { env-l-jkLog( env, env-l, JK_LOG_ERROR, - At least a '/' must be included %s\n, name); + uriEnv.parseUri(): At least a '/' must be included %s\n, name); return JK_FALSE; } @@ -102,8 +102,8 @@ uriEnv-uri=uriEnv-pool-pstrdup(env, uriEnv-pool, n); jk2_uriEnv_init(env, uriEnv); -env-l-jkLog( env, env-l, JK_LOG_INFO, - Setting path %s for %s\n, n, name); +/* env-l-jkLog( env, env-l, JK_LOG_INFO, */ +/*uriEnv.parseUri() Setting path %s for %s\n, n, name); */ return JK_TRUE; } @@ -267,8 +267,6 @@ jk_pool_t *uriPool; int err; jk_uriEnv_t *uriEnv; - -env-l-jkLog(env, env-l, JK_LOG_INFO, uriEnv: Create URI %s %s \n, type, name ); uriPool=(jk_pool_t *)pool-create( env, pool, HUGE_POOL_SIZE); 1.20 +8 -6 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.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- jk_uriMap.c 23 Mar 2002 17:27:13 - 1.19 +++ jk_uriMap.c 26 Mar 2002 03:03:01 - 1.20 @@ -67,7 +67,7 @@ * servlet container. * * Author: Gal Shachor [EMAIL PROTECTED] - * Version: $Revision: 1.19 $ + * Version: $Revision: 1.20 $ */ #include jk_pool.h @@ -194,19 +194,21 @@ int err; jk_uriEnv_t *uriEnv; char *uriName; +jk_bean_t *jkb; uriName=(char *)uriMap-pool-calloc( env, uriMap-pool, (vhost==NULL ? 0 : strlen( vhost )) + (path==NULL ? 0 : strlen( path )) + + 10); -strcpy( uriName, uri: ); +strcpy( uriName, ); if( vhost != NULL ) strcat( uriName, vhost ); if( path != NULL ) strcat( uriName, path ); - -uriEnv=env-createInstance( env, uriMap-pool, uriEnv, uriName ); -if( uriEnv==NULL ) + +jkb=env-createBean2( env, uriMap-pool, uri, uriName ); +if( jkb==NULL || jkb-object==NULL ) return NULL; - +uriEnv=jkb-object; + uriEnv-workerEnv=uriMap-workerEnv; uriEnv-mbean-setAttribute( env, uriEnv-mbean, path, path ); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]