hi,

as I asked for help to this list to configure and use regular expressions
into uri in mod_jk2, I found and resolved some bugs in the code. I think its
nice to send you (I don't know exactly who can evalauate and accept my
suggestions).

The bugs are 2.

1. Cant't use metacharacter ']' in rex because this char is used to
terminate the [uri:...] declaration.

2. Can't use rex in uri without prepending a host, it cause a segmentation
fault.


The solution I found:

1.
Change the file <jk2-src>/jk/native2/common/jk_config_file.c

187     /* Support windows-style 'sections' - for cleaner config
188      */
189     if( (prp[0] == '[') ) {
190 #ifdef HAS_PCRE
191         v=strrchr(prp, ']' );
192 #else
193         v=strchr(prp, ']' );
194 #endif
195         *v='\0';
196         jk2_trim( v );
197         prp++;


2.
Change file <jk2-src>/jk/native2/common/jk_uriEnv.c near line 91 adding

if (*name == '$') {
    ++name;
    uriEnv->match_type = MATCH_TYPE_REGEXP;
#ifdef HAS_PCRE
    uriEnv->uri = uriEnv->pool->pstrdup(env, uriEnv->pool, name);
    env->l->jkLog(env, env->l, JK_LOG_INFO,
                  "uriEnv.parseName() parsing %s regexp\n", name);
    {
        int errcode;
        regex_t *preg = (regex_t *)uriEnv->pool->calloc( env,
                                      uriEnv->pool, sizeof(regex_t));
        if( errcode = regcomp(preg, uriEnv->name, REG_EXTENDED) ) {
            char errbuf[1024];
            env->l->jkLog(env, env->l, JK_LOG_DEBUG,
                          "uriEnv.parseName() error #%d compiling regexp
%s\n",
                          errcode, name);
            return JK_ERR;
        }
        uriEnv->regexp = preg;
        uriEnv->virtual = "*";
    }
#else
    env->l->jkLog(env, env->l, JK_LOG_INFO,
       "uriEnv.parseName() parsing regexp %s not supported\n", name);
#endif
    return JK_OK;
}
--------------------------------------


Hope this could help someone. For any more info feel free to contact me.

by

max



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

Reply via email to