tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_uriMap.c
Date Tue, 24 Sep 2002 16:54:31 GMT
mturk       2002/09/24 09:54:31

  Modified:    jk/native2/common jk_uriMap.c
  Log:
  Create the missing vhosts.
  Fix the hostname resolution already containing colon and port.
  
  Revision  Changes    Path
  1.42      +22 -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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- jk_uriMap.c	23 Sep 2002 17:38:04 -0000	1.41
  +++ jk_uriMap.c	24 Sep 2002 16:54:31 -0000	1.42
  @@ -238,16 +238,20 @@
   {
       int i, j;
       char *name;
  -    char vs[1024];
  -    char vv[1024];
  +    char vs[1024] = {0};
  +    char vv[1024] = {0};
   
       int n = uriMap->vhosts->size(env, uriMap->vhosts);
       if (port) {
  -        sprintf(vs, "%s:%d", vhost ? vhost : "*", port);
  -        sprintf(vs, "*:%d", port);
  +        if (vhost && strchr(vhost, ':'))
  +            strcpy(vs, vhost);
  +        else
  +            sprintf(vs, "%s:%d", vhost ? vhost : "*", port);
  +        sprintf(vv, "*:%d", port);
       }
       else
           strcpy(vs, vhost ? vhost : "*"); 
  +
       for (i = 0 ; i < n ; i++) {
           jk_uriEnv_t *uriEnv = uriMap->vhosts->valueAt(env, uriMap->vhosts, i);
           name = uriMap->vhosts->nameAt(env, uriMap->vhosts, i);
  @@ -273,7 +277,6 @@
       return uriMap->vhosts->get(env, uriMap->vhosts, "*");
   }
   
  -
   static int jk2_uriMap_init(jk_env_t *env, jk_uriMap_t *uriMap)
   {
       int rc = JK_OK;
  @@ -290,6 +293,7 @@
               return JK_ERR;
           }
       }
  +
       /* Initialize the context table */
       for (i = 0; i < uriMap->maps->size(env, uriMap->maps); i++) {
           jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);
  @@ -302,6 +306,19 @@
                                       uriEnv->virtual, uriEnv, NULL);
               }
           }
  +        /* Create the missing vhosts */
  +        else if (uriEnv->virtual != NULL && strlen(uriEnv->virtual)) {
  +            if (!uriMap->vhosts->get(env, uriMap->vhosts,
  +                                     uriEnv->virtual)) {
  +                jk2_map_default_create(env, &uriEnv->webapps, uriMap->pool);
  +                uriMap->vhosts->put(env, uriMap->vhosts,
  +                                    uriEnv->virtual, uriEnv, NULL);
  +
  +                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriMap.init() Fixing Host %s\n", 
  +                              uriEnv->virtual);
  +            }
  +        }
       }
   
       /** Make sure each vhost has a default context
  @@ -504,7 +521,6 @@
                         "uriMap.mapUri() uri must start with /\n");
           return NULL;
       }
  -
       hostEnv = jk2_uriMap_hostMap(env, uriMap, vhost, port);
       if (!hostEnv) {
           env->l->jkLog(env, env->l, JK_LOG_INFO,
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message