nacho 2002/09/21 19:50:42 Modified: jk/native2/common jk_uriEnv.c jk_uriMap.c jk/native2/server/apache2 mod_jk2.c Log: Bug#11364 - jk2 appears to forward all virtual host requests to Tomcat Reported by Simon Stewart Revision Changes Path 1.26 +0 -1 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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jk_uriEnv.c 15 Aug 2002 09:24:03 -0000 1.25 +++ jk_uriEnv.c 22 Sep 2002 02:50:42 -0000 1.26 @@ -100,7 +100,6 @@ /* If it doesn't start with /, it must have a vhost */ if( *name != '/' ) { - /* char *portIdx=strchr( n, ':' ); */ uriEnv->virtual=uriEnv->pool->calloc( env, uriEnv->pool, slash - name + 2 ); strncpy( uriEnv->virtual, name, slash-name ); } 1.39 +14 -4 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.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- jk_uriMap.c 1 Sep 2002 20:32:07 -0000 1.38 +++ jk_uriMap.c 22 Sep 2002 02:50:42 -0000 1.39 @@ -355,7 +355,8 @@ if( uriMap->mbean->debug > 5 ) env->l->jkLog(env, env->l, JK_LOG_DEBUG, "uriMap.init() set default host\n"); - + /* XXX Initializes vhosts from uris */ + jk2_uriMap_correctHosts(env,uriMap); /* Initialize the vhosts table */ for(i = 0 ; i < uriMap->maps->size( env, uriMap->maps ) ; i++) { uriEnv=uriMap->maps->valueAt( env, uriMap->maps, i ); @@ -622,7 +623,10 @@ /* As per Servlet spec, do exact match first */ match=jk2_uriMap_exactMap( env, uriMap, ctxEnv->exactMatch, uri, uriLen, reverse ); - if( match != NULL ) { + if( match != NULL && + (( match->virtual==NULL && hostEnv->virtual==NULL ) || + ( hostEnv->virtual!=NULL && strcasecmp(match->virtual,hostEnv->virtual)==0 )) + ) { /* restore */ if( url_rewrite ) *url_rewrite=origChar; if( uriMap->mbean->debug > 0 ) @@ -634,7 +638,10 @@ /* Then prefix match */ match=jk2_uriMap_prefixMap( env, uriMap, ctxEnv->prefixMatch, uri, uriLen, reverse ); - if( match != NULL ) { + if( match != NULL && + (( match->virtual==NULL && hostEnv->virtual==NULL ) || + ( hostEnv->virtual!=NULL && strcasecmp(match->virtual,hostEnv->virtual)==0 )) + ) { char c=uri[match->prefix_len]; /* XXX Filter prefix matches to allow only exact matches with an optional path_info or query string at end. @@ -658,7 +665,10 @@ if( suffix!=NULL ) { match=jk2_uriMap_suffixMap( env, uriMap, ctxEnv->suffixMatch, suffix, strlen( suffix ), reverse); - if( match != NULL ) { + if( match != NULL && + (( match->virtual==NULL && hostEnv->virtual==NULL ) || + ( hostEnv->virtual!=NULL && strcasecmp(match->virtual,hostEnv->virtual)==0 )) + ) { /* restore */ if( url_rewrite ) *url_rewrite=origChar; if( uriMap->mbean->debug > 0 ) 1.51 +4 -3 jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c Index: mod_jk2.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- mod_jk2.c 21 Sep 2002 09:45:27 -0000 1.50 +++ mod_jk2.c 22 Sep 2002 02:50:42 -0000 1.51 @@ -629,7 +629,7 @@ { jk_uriEnv_t *uriEnv; jk_env_t *env; - + if(r->proxyreq || workerEnv==NULL) { return DECLINED; } @@ -677,8 +677,9 @@ If positive, we'll fill a ws_service_t and do the rewrite and the real mapping. */ + uriEnv = workerEnv->uriMap->mapUri(env, workerEnv->uriMap, - r->server->is_virtual ? r->server->server_hostname : NULL, + apr_psprintf(r->pool,"%s:%d",r->hostname,r->server->port), r->uri ); if( uriEnv== NULL || uriEnv->workerName == NULL) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>