mturk       2002/09/22 02:58:16

  Modified:    jk/native2/common jk_uriMap.c
  Log:
  Each host has to be defined in the workers2.properties, so if the
  host is provided in the request but non found in the uriMap return
  NULL instead using default host (uri:/). Further more I reverted the
  Natcho's patches for checking virtual hosts, cause all mappings are
  allready in the correct uriMap.
  
  Revision  Changes    Path
  1.40      +14 -15    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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- jk_uriMap.c       22 Sep 2002 02:50:42 -0000      1.39
  +++ jk_uriMap.c       22 Sep 2002 09:58:16 -0000      1.40
  @@ -260,7 +260,8 @@
                   return uriMap->vhosts->valueAt( env, uriMap->vhosts, i);
               }
           }
  -        /* Can't find vhost, return default */
  +        /* Can't find vhost */
  +        return NULL;
       }
       return uriMap->defaultVhost;
   }
  @@ -357,6 +358,7 @@
           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 );
  @@ -441,7 +443,8 @@
           if( uri!=NULL && context!=NULL && strcmp( uri, context ) == 0 ) {
               char *vhost= uriEnv->virtual;
               jk_uriEnv_t *hostEnv=jk2_uriMap_hostMap( env, uriMap, vhost );
  -
  +            if (!hostEnv)
  +                continue;
               if( uriMap->mbean->debug > 5 ) 
                   env->l->jkLog(env, env->l, JK_LOG_DEBUG,
                                 "uriMap.init() loaded context %s %s %#lx %#lx %#lx\n",
  @@ -478,6 +481,7 @@
           char *uri= uriEnv->uri;
           jk_uriEnv_t *ctxEnv;
   
  +        if( hostEnv==NULL ) continue;
           if( uri==NULL ) continue;
           uriEnv->uriMap=uriMap;
           uriEnv->init( env, uriEnv );
  @@ -591,7 +595,11 @@
       }
   
       hostEnv=jk2_uriMap_hostMap( env, uriMap, vhost );
  -
  +    if (!hostEnv) {
  +        env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                      "uriMap.mapUri() cannot find host %s/\n", vhost);
  +        return NULL;
  +    }
       if( uriMap->mbean->debug > 1 )
           env->l->jkLog(env, env->l, JK_LOG_DEBUG,
                         "uriMap.mapUri() found host %s\n", hostEnv->virtual);    
  @@ -623,10 +631,7 @@
   
       /* As per Servlet spec, do exact match first */
       match=jk2_uriMap_exactMap( env, uriMap, ctxEnv->exactMatch, uri, uriLen, 
reverse );
  -    if( match != NULL && 
  -            (( match->virtual==NULL && hostEnv->virtual==NULL ) || 
  -             ( hostEnv->virtual!=NULL && 
strcasecmp(match->virtual,hostEnv->virtual)==0 ))
  -       ) {
  +    if( match != NULL ) {
           /* restore */
           if( url_rewrite ) *url_rewrite=origChar;
           if( uriMap->mbean->debug > 0 )
  @@ -638,10 +643,7 @@
       
       /* Then prefix match */
       match=jk2_uriMap_prefixMap( env, uriMap, ctxEnv->prefixMatch, uri, uriLen, 
reverse );
  -    if( match != NULL && 
  -            (( match->virtual==NULL && hostEnv->virtual==NULL ) || 
  -             ( hostEnv->virtual!=NULL && 
strcasecmp(match->virtual,hostEnv->virtual)==0 ))
  -       ) {
  +    if( match != NULL ) {
           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.
  @@ -665,10 +667,7 @@
       if( suffix!=NULL ) {
           match=jk2_uriMap_suffixMap( env, uriMap, ctxEnv->suffixMatch,
                                       suffix, strlen( suffix ), reverse);
  -        if( match != NULL && 
  -                (( match->virtual==NULL && hostEnv->virtual==NULL ) || 
  -                 ( hostEnv->virtual!=NULL && 
strcasecmp(match->virtual,hostEnv->virtual)==0 ))
  -           ) {
  +        if( match != NULL ) {
               /* restore */
               if( url_rewrite ) *url_rewrite=origChar;
               if( uriMap->mbean->debug > 0 )
  
  
  

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

Reply via email to