tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_workerEnv.c
Date Mon, 31 Dec 2001 19:18:48 GMT
costin      01/12/31 11:18:48

  Modified:    jk/native2/common jk_workerEnv.c
  Log:
  Moved some of the code that was duplicated in all server adapters.
  The initialization of jk is common for all servers, no need to
  cut&paste it.
  
  Revision  Changes    Path
  1.12      +110 -3    jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c
  
  Index: jk_workerEnv.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_workerEnv.c	17 Dec 2001 07:17:08 -0000	1.11
  +++ jk_workerEnv.c	31 Dec 2001 19:18:48 -0000	1.12
  @@ -59,7 +59,7 @@
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.11 $                                           *
  + * Version:     $Revision: 1.12 $                                           *
    ***************************************************************************/
   
   #include "jk_workerEnv.h" 
  @@ -73,13 +73,117 @@
   
   static void jk_workerEnv_close(jk_env_t *env, jk_workerEnv_t *_this);
   static void jk_workerEnv_initHandlers(jk_env_t *env, jk_workerEnv_t *_this);
  +static int jk_workerEnv_init1(jk_env_t *env, jk_workerEnv_t *_this);
  +
  +static int jk_workerEnv_init(jk_env_t *env, jk_workerEnv_t *workerEnv)
  +{
  +    int err;
  +    char *opt;
  +    int options;
  +
  +    opt=jk_map_getString( env, workerEnv->init_data, "workerFile", NULL );
  +    if( opt != NULL ) {
  +        struct stat statbuf;
  +        
  +        /* we need an absolut path (ap_server_root_relative does the ap_pstrdup) */
  +        workerEnv->worker_file = opt;
  +        /* We should make it relative to JK_HOME or absolute path.
  +           ap_server_root_relative(cmd->pool,opt); */
  +
  +        if (workerEnv->worker_file == NULL) {
  +            env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                          "JkWorkersFile file_name invalid %s", workerEnv->worker_file);
  +            return JK_FALSE;
  +        }
  +        
  +        if (stat(workerEnv->worker_file, &statbuf) == -1) {
  +            env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                          "Can't find the workers file specified");
  +            return JK_FALSE;
  +        }
  +        /** Read worker files
  +         */
  +        env->l->jkLog(env, env->l, JK_LOG_DEBUG, "Reading map %s %d\n",
  +                      workerEnv->worker_file,
  +                      workerEnv->init_data->size(env, workerEnv->init_data) );
  +        
  +        err=jk_map_readFileProperties(env, workerEnv->init_data,
  +                                          workerEnv->worker_file);
  +        if( err==JK_TRUE ) {
  +            env->l->jkLog(env, env->l, JK_LOG_INFO, 
  +                          "mod_jk.initJk() Reading worker properties %s %d\n", workerEnv->worker_file,
  +                          workerEnv->init_data->size( env, workerEnv->init_data
) );
  +        } else {
  +            env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                          "mod_jk.initJk() Error reading worker properties %s %d\n",
  +                          workerEnv->worker_file,
  +                          workerEnv->init_data->size( env, workerEnv->init_data
) );
  +        }
  +    }
  +        
  +    opt=jk_map_getString( env, workerEnv->init_data, "logLevel", "Error" );
  +
  +    if(0 == strcasecmp(opt, JK_LOG_INFO_VERB)) {
  +        env->l->level=JK_LOG_INFO_LEVEL;
  +    }
  +    if(0 == strcasecmp(opt, JK_LOG_DEBUG_VERB)) {
  +        env->l->level=JK_LOG_DEBUG_LEVEL;
  +    }
  +    opt=jk_map_getString( env, workerEnv->init_data, "logFile", NULL );
  +
  +    env->l->jkLog(env, env->l, JK_LOG_INFO, "mod_jk.init_jk()\n" ); 
  +    env->l->open( env, env->l, workerEnv->init_data );
  +
  +    opt=jk_map_getString( env, workerEnv->init_data, "sslEnable", NULL );
  +    workerEnv->ssl_enable = JK_TRUE;
  +    opt=jk_map_getString( env, workerEnv->init_data, "httpsIndicator", NULL );
  +    workerEnv->https_indicator = opt;
  +    opt=jk_map_getString( env, workerEnv->init_data, "certsIndicator", NULL );
  +    workerEnv->certs_indicator = opt;
  +    opt=jk_map_getString( env, workerEnv->init_data, "cipherIndicator", NULL );
  +    workerEnv->cipher_indicator = opt;
  +    opt=jk_map_getString( env, workerEnv->init_data, "sessionIndicator", NULL );
  +    workerEnv->session_indicator = opt;
  +    opt=jk_map_getString( env, workerEnv->init_data, "keySizeIndicator", NULL );
  +    workerEnv->key_size_indicator = opt;
  +
  +    /* Small change in how we treat options: we have a default,
  +       and assume that any option declared by user has the intention
  +       of overriding the default ( "-Option == no option, leave the
  +       default
  +    */
  +    if ( jk_map_getBool(env, workerEnv->init_data,
  +                        "ForwardKeySize", NULL)) {
  +        workerEnv->options |= JK_OPT_FWDKEYSIZE;
  +    } else if(jk_map_getBool(env, workerEnv->init_data,
  +                             "ForwardURICompat", NULL)) {
  +        workerEnv->options &= ~JK_OPT_FWDURIMASK;
  +        workerEnv->options |=JK_OPT_FWDURICOMPAT;
  +    } else if(jk_map_getBool(env, workerEnv->init_data,
  +                             "ForwardURICompatUnparsed", NULL)) {
  +        workerEnv->options &= ~JK_OPT_FWDURIMASK;
  +        workerEnv->options |=JK_OPT_FWDURICOMPATUNPARSED;
  +    } else if (jk_map_getBool(env, workerEnv->init_data,
  +                              "ForwardURIEscaped", NULL)) {
  +        workerEnv->options &= ~JK_OPT_FWDURIMASK;
  +        workerEnv->options |= JK_OPT_FWDURIESCAPED;
  +    }
  +
  +    /* Init() - post-config initialization ( now all options are set ) */
  +    jk_workerEnv_init1( env, workerEnv );
  +
  +    err=workerEnv->uriMap->init(env, workerEnv->uriMap,
  +                                workerEnv,
  +                                workerEnv->init_data );
  +    return JK_TRUE;
  +}
   
   /**
    *  Init the workers, prepare the we.
    * 
    *  Replaces wc_open
    */
  -static int jk_workerEnv_init(jk_env_t *env, jk_workerEnv_t *_this)
  +static int jk_workerEnv_init1(jk_env_t *env, jk_workerEnv_t *_this)
   {
       jk_map_t *init_data=_this->init_data;
       char **worker_list  = NULL;
  @@ -90,7 +194,7 @@
       /*     _this->init_data=init_data; */
   
       tmp = jk_map_getString(env, init_data, "worker.list",
  -                                   DEFAULT_WORKER );
  +                           DEFAULT_WORKER );
       worker_list=jk_map_split( env, init_data, init_data->pool,
                                 tmp, &_this->num_of_workers );
   
  @@ -397,6 +501,7 @@
       type=jk_map_getStrProp( env, init_data,"worker",name,"type",NULL );
   
       /* Each worker has it's own pool */
  +    if( type == NULL ) type="ajp13";
       
   
       w=(jk_worker_t *)env->getInstance(env, workerPool, "worker",
  @@ -536,6 +641,8 @@
       _this->processCallbacks=&jk_workerEnv_processCallbacks;
   
       _this->rootWebapp=_this->createWebapp( env, _this, NULL, "/", NULL );
  +
  +    _this->globalEnv=env;
       
       return JK_TRUE;
   }
  
  
  

--
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