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_ajp14_worker.c jk_channel_socket.c jk_endpoint.c jk_env.c jk_handler_discovery.c jk_handler_logon.c jk_handler_request.c jk_handler_response.c jk_jni_worker.c jk_map.c jk_pool.c jk_registry.c jk_uriMap.c jk_workerEnv.c
Date Wed, 05 Dec 2001 20:48:21 GMT
costin      01/12/05 12:48:21

  Modified:    jk/native2/common jk_ajp14_worker.c jk_channel_socket.c
                        jk_endpoint.c jk_env.c jk_handler_discovery.c
                        jk_handler_logon.c jk_handler_request.c
                        jk_handler_response.c jk_jni_worker.c jk_map.c
                        jk_pool.c jk_registry.c jk_uriMap.c jk_workerEnv.c
  Log:
  Get rid of most compile warnings.
  
  We still have the handler to resolve ( it'll be a generic interface, similar with
  the workers )
  
  Revision  Changes    Path
  1.4       +114 -107  jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_ajp14_worker.c	2001/12/04 18:40:42	1.3
  +++ jk_ajp14_worker.c	2001/12/05 20:48:20	1.4
  @@ -72,30 +72,85 @@
   #include "jk_service.h"
   #include "jk_env.h"
   
  -/* Ajp14 methods - XXX move to handler abstraction */
  -int logon(jk_endpoint_t *ae,
  -          jk_logger_t    *l);
  -
  -int discovery(jk_endpoint_t *ae,
  -              jk_workerEnv_t *we,
  -              jk_logger_t    *l);
  +int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  +                                       char *type, char *name);
   
  -/*
  - * Functions
  - */
  -static int validate(jk_worker_t *pThis,
  -             jk_map_t    *props,
  -             jk_workerEnv_t *we,
  -             jk_logger_t *l );
  +static int JK_METHOD
  +jk_worker_ajp14_service(jk_endpoint_t   *e, jk_ws_service_t *s,
  +                        jk_logger_t     *l, int *is_recoverable_error);
  +
  +static int JK_METHOD
  +jk_worker_ajp14_validate(jk_worker_t *pThis, jk_map_t    *props,
  +                         jk_workerEnv_t *we, jk_logger_t *l );
   
  -int JK_METHOD ajp_done(jk_endpoint_t **e,
  -                       jk_logger_t    *l);
  +static int JK_METHOD
  +jk_worker_ajp14_done(jk_endpoint_t **e, jk_logger_t    *l);
   
  +static int JK_METHOD
  +jk_worker_ajp14_getEndpoint(jk_worker_t *_this, jk_endpoint_t **e,
  +                            jk_logger_t    *l);
   
  +static int JK_METHOD
  +jk_worker_ajp14_init(jk_worker_t *_this, jk_map_t    *props, 
  +                     jk_workerEnv_t *we, jk_logger_t *l);
   
  -/* -------------------- Method -------------------- */
  +static int JK_METHOD
  +jk_worker_ajp14_destroy(jk_worker_t **pThis, jk_logger_t *l);
  +
  +
   #define	JK_RETRIES 3
   
  +/* -------------------- Impl -------------------- */
  +
  +int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  +                                       char *type, char *name)
  +{
  +    jk_logger_t *l=env->logger;
  +    jk_worker_t *w=(jk_worker_t *)malloc(sizeof(jk_worker_t));
  +   
  +    l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_worker_factory\n");
  +
  +    if (name == NULL || w == NULL) {
  +        l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, NULL parameters\n");
  +        return JK_FALSE;
  +    }
  +
  +    w->name = strdup(name);
  +    
  +    w->proto= AJP14_PROTO;
  +
  +    w->login= (jk_login_service_t *)malloc(sizeof(jk_login_service_t));
  +
  +    if (w->login == NULL) {
  +        l->jkLog(l, JK_LOG_ERROR,
  +               "In ajp14_worker_factory, malloc failed for login area\n");
  +        return JK_FALSE;
  +    }
  +	
  +    memset(w->login, 0, sizeof(jk_login_service_t));
  +    
  +    w->login->negociation=
  +        (AJP14_CONTEXT_INFO_NEG | AJP14_PROTO_SUPPORT_AJP14_NEG);
  +    w->login->web_server_name=NULL; /* must be set in init */
  +    
  +    w->ep_cache_sz= 0;
  +    w->ep_cache= NULL;
  +    w->connect_retry_attempts= AJP_DEF_RETRY_ATTEMPTS;
  +
  +    w->channel= NULL;
  +   
  +    w->validate= jk_worker_ajp14_validate;
  +    w->init= jk_worker_ajp14_init;
  +    w->get_endpoint= jk_worker_ajp14_getEndpoint;
  +    w->destroy=jk_worker_ajp14_destroy;
  +
  +    w->logon= NULL; 
  +
  +    *result = w;
  +
  +    return JK_TRUE;
  +}
  +
   /*
    * service is now splitted in ajp_send_request and ajp_get_reply
    * much more easier to do errors recovery
  @@ -103,10 +158,11 @@
    * We serve here the request, using AJP13/AJP14 (e->proto)
    *
    */
  -int JK_METHOD ajp_service(jk_endpoint_t   *e, 
  -                          jk_ws_service_t *s,
  -                          jk_logger_t     *l,
  -                          int             *is_recoverable_error)
  +static int JK_METHOD
  +jk_worker_ajp14_service(jk_endpoint_t   *e, 
  +                        jk_ws_service_t *s,
  +                        jk_logger_t     *l,
  +                        int  *is_recoverable_error)
   {
       int i;
       int err;
  @@ -215,10 +271,11 @@
   /*
    * Validate the worker (ajp13/ajp14)
    */
  -static int validate(jk_worker_t *pThis,
  -                    jk_map_t    *props,
  -                    jk_workerEnv_t *we,
  -                    jk_logger_t *l)
  +static int JK_METHOD
  +jk_worker_ajp14_validate(jk_worker_t *pThis,
  +                         jk_map_t    *props,
  +                         jk_workerEnv_t *we,
  +                         jk_logger_t *l)
   {
       int    port;
       char * host;
  @@ -278,15 +335,9 @@
   }
   
   
  -int ajp_destroy(jk_worker_t **pThis,
  -                jk_logger_t *l,
  -                int          proto)
  +static int JK_METHOD
  +jk_worker_ajp14_done(jk_endpoint_t **e,jk_logger_t    *l)
   {
  -}
  -
  -int JK_METHOD ajp_done(jk_endpoint_t **e,
  -                       jk_logger_t    *l)
  -{
       l->jkLog(l, JK_LOG_DEBUG, "Into jk_endpoint_t::done\n");
   
       if (e && *e ) {
  @@ -301,7 +352,7 @@
                   int rc;
                   JK_ENTER_CS(&w->cs, rc);
                   if(rc) {
  -                    unsigned i;
  +                    int i;
   
                       for(i = 0 ; i < w->ep_cache_sz ; i++) {
                           if(!w->ep_cache[i]) {
  @@ -328,9 +379,10 @@
       return JK_FALSE;
   }
   
  -static int JK_METHOD get_endpoint(jk_worker_t *_this,
  -                                  jk_endpoint_t **e,
  -                                  jk_logger_t    *l)
  +static int JK_METHOD
  +jk_worker_ajp14_getEndpoint(jk_worker_t *_this,
  +                            jk_endpoint_t **e,
  +                            jk_logger_t    *l)
   {
       jk_endpoint_t *ae = NULL;
   
  @@ -343,7 +395,7 @@
           int rc;
           JK_ENTER_CS(&_this->cs, rc);
           if (rc) {
  -            unsigned i;
  +            int i;
               
               for (i = 0 ; i < _this->ep_cache_sz ; i++) {
                   if (_this->ep_cache[i]) {
  @@ -372,16 +424,17 @@
       ae->worker = _this;
       ae->proto = _this->proto;
       ae->channelData = NULL;
  -    ae->service = ajp_service;
  -    ae->done = ajp_done;
  +    ae->service = jk_worker_ajp14_service;
  +    ae->done = jk_worker_ajp14_done;
       *e = ae;
       return JK_TRUE;
   }
   
  -static int JK_METHOD init(jk_worker_t *_this,
  -                          jk_map_t    *props, 
  -                          jk_workerEnv_t *we,
  -                          jk_logger_t *l)
  +static int JK_METHOD
  +jk_worker_ajp14_init(jk_worker_t *_this,
  +                     jk_map_t    *props, 
  +                     jk_workerEnv_t *we,
  +                     jk_logger_t *l)
   {
       jk_endpoint_t *ae;
       int             rc;
  @@ -436,26 +489,29 @@
           l->jkLog(l, JK_LOG_ERROR, "can't malloc web_server_name\n");
           return JK_FALSE;
       }
  -    
  -    if (get_endpoint(_this, &ae, l) == JK_FALSE)
  -        return JK_FALSE;
       
  -    if (ajp_connect_to_endpoint(ae, l) == JK_TRUE) {
  +/*     if (get_endpoint(_this, &ae, l) == JK_FALSE) */
  +/*         return JK_FALSE; */
  +
  +    /* Temporary commented out. Will be added back after fixing
  +       few more things ( like what happens if apache is started before tomcat).
  +     */
  +/*     if (ajp_connect_to_endpoint(ae, l) == JK_TRUE) { */
           
  -	/* connection stage passed - try to get context info
  -	 * this is the long awaited autoconf feature :)
  -	 */
  -        rc = discovery(ae, we, l);
  -        ajp_close_endpoint(ae, l);
  -        return rc;
  -    }
  + 	/* connection stage passed - try to get context info 
  + 	 * this is the long awaited autoconf feature :) 
  + 	 */ 
  +/*         rc = discovery(ae, we, l); */
  +/*         ajp_close_endpoint(ae, l); */
  +/*         return rc; */
  +/*     } */
       
       return JK_TRUE;
   }
   
   
  -static int JK_METHOD destroy(jk_worker_t **pThis,
  -                             jk_logger_t *l)
  +static int JK_METHOD
  +jk_worker_ajp14_destroy(jk_worker_t **pThis, jk_logger_t *l)
   {
       jk_worker_t *aw = *pThis;
       
  @@ -485,7 +541,7 @@
                aw->ep_cache_sz);
   
       if(aw->ep_cache_sz > 0 ) {
  -        unsigned i;
  +        int i;
           for(i = 0 ; i < aw->ep_cache_sz ; i++) {
               if(aw->ep_cache[i]) {
                   ajp_close_endpoint(aw->ep_cache[i], l);
  @@ -501,54 +557,5 @@
       }
   
       free(aw);
  -    return JK_TRUE;
  -}
  -
  -int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  -                                       char *type, char *name)
  -{
  -    jk_logger_t *l=env->logger;
  -    jk_worker_t *w=(jk_worker_t *)malloc(sizeof(jk_worker_t));
  -   
  -    l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_worker_factory\n");
  -
  -    if (name == NULL || w == NULL) {
  -        l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, NULL parameters\n");
  -        return JK_FALSE;
  -    }
  -
  -    w->name = strdup(name);
  -    
  -    w->proto= AJP14_PROTO;
  -
  -    w->login= (jk_login_service_t *)malloc(sizeof(jk_login_service_t));
  -
  -    if (w->login == NULL) {
  -        l->jkLog(l, JK_LOG_ERROR,
  -               "In ajp14_worker_factory, malloc failed for login area\n");
  -        return JK_FALSE;
  -    }
  -	
  -    memset(w->login, 0, sizeof(jk_login_service_t));
  -    
  -    w->login->negociation=
  -        (AJP14_CONTEXT_INFO_NEG | AJP14_PROTO_SUPPORT_AJP14_NEG);
  -    w->login->web_server_name=NULL; /* must be set in init */
  -    
  -    w->ep_cache_sz= 0;
  -    w->ep_cache= NULL;
  -    w->connect_retry_attempts= AJP_DEF_RETRY_ATTEMPTS;
  -
  -    w->channel= NULL;
  -   
  -    w->validate= validate;
  -    w->init= init;
  -    w->get_endpoint= get_endpoint;
  -    w->destroy=destroy;
  -
  -    w->logon= logon; 
  -
  -    *result = w;
  -
       return JK_TRUE;
   }
  
  
  
  1.4       +6 -2      jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
  
  Index: jk_channel_socket.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_channel_socket.c	2001/12/04 19:04:48	1.3
  +++ jk_channel_socket.c	2001/12/05 20:48:20	1.4
  @@ -107,9 +107,13 @@
   
   int JK_METHOD jk_channel_socket_factory(jk_env_t *env, void **result,
   					char *type, char *name);
  +
   static int JK_METHOD jk_channel_socket_resolve(char *host, short port,
   				     struct sockaddr_in *rc);
   
  +static int JK_METHOD jk_channel_socket_close(jk_channel_t *_this,
  +                                      jk_endpoint_t *endpoint);
  +
   static int JK_METHOD jk_channel_socket_getProperty(jk_channel_t *_this, 
   					 char *name, char **value)
   {
  @@ -290,8 +294,8 @@
   
   /** close the socket  ( was: jk_close_socket )
   */
  -int JK_METHOD jk_channel_socket_close(jk_channel_t *_this,
  -                                      jk_endpoint_t *endpoint)
  +static int JK_METHOD jk_channel_socket_close(jk_channel_t *_this,
  +                                             jk_endpoint_t *endpoint)
   {
       int sd;
       jk_channel_socket_data_t *chD=endpoint->channelData;
  
  
  
  1.3       +29 -36    jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c
  
  Index: jk_endpoint.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_endpoint.c	2001/12/04 23:56:07	1.2
  +++ jk_endpoint.c	2001/12/05 20:48:20	1.3
  @@ -59,7 +59,7 @@
    * Description: common stuff for bi-directional protocols ajp13/ajp14.     *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.2 $                                           *
  + * Version:     $Revision: 1.3 $                                           *
    ***************************************************************************/
   
   
  @@ -68,6 +68,18 @@
   #include "jk_env.h"
   #include "jk_requtil.h"
   
  +/* Private methods */
  +
  +static int ajp_read_fully_from_server(jk_ws_service_t *s,
  +                                      unsigned char   *buf,
  +                                      unsigned         len);
  +
  +static int ajp_process_callback(jk_msg_buf_t *msg, 
  +                                jk_msg_buf_t *pmsg,
  +                                jk_endpoint_t *ae,
  +                                jk_ws_service_t *r, 
  +                                jk_logger_t *l);
  +
   /*
    * Reset the endpoint (clean buf)
    */
  @@ -80,7 +92,6 @@
   /*
    * Close the endpoint (clean buf and close socket)
    */
  -
   void ajp_close_endpoint(jk_endpoint_t *ae,
                           jk_logger_t    *l)
   {
  @@ -98,7 +109,7 @@
   int ajp_connect_to_endpoint(jk_endpoint_t *ae,
                               jk_logger_t    *l)
   {
  -    unsigned attempt;
  +    int attempt;
   
       for(attempt = 0 ; attempt < ae->worker->connect_retry_attempts ; attempt++) {
   	jk_channel_t *channel=ae->worker->channel;
  @@ -120,7 +131,6 @@
   /*
    * Send a message to endpoint, using corresponding PROTO HEADER
    */
  -
   int ajp_connection_tcp_send_message(jk_endpoint_t *ae,
                                       jk_msg_buf_t   *msg,
                                       jk_logger_t    *l)
  @@ -216,9 +226,9 @@
    * read, so we must loop up to all awaited data are received 
    */
   
  -int ajp_read_fully_from_server(jk_ws_service_t *s,
  -                               unsigned char   *buf,
  -                               unsigned         len)
  +static int ajp_read_fully_from_server(jk_ws_service_t *s,
  +                                      unsigned char   *buf,
  +                                      unsigned         len)
   {
       unsigned rdlen = 0;
       unsigned padded_len = len;
  @@ -384,7 +394,7 @@
   	 * doing a read (not yet) 
   	 */
   	if (s->is_chunked || e->left_bytes_to_send > 0) {
  -	    unsigned len = e->left_bytes_to_send;
  +	    int len = e->left_bytes_to_send;
   	    if (len > AJP13_MAX_SEND_BODY_SZ) 
   		len = AJP13_MAX_SEND_BODY_SZ;
               len = ajp_read_into_msg_buff(e, s, e->post, len, l);
  @@ -408,46 +418,29 @@
    * What to do with incoming data (dispatcher)
    */
   
  -int ajp_process_callback(jk_msg_buf_t *msg, 
  -                         jk_msg_buf_t *pmsg,
  -                         jk_endpoint_t *ae,
  -                         jk_ws_service_t *r, 
  -                         jk_logger_t *l) 
  +static int ajp_process_callback(jk_msg_buf_t *msg, 
  +                                jk_msg_buf_t *pmsg,
  +                                jk_endpoint_t *ae,
  +                                jk_ws_service_t *r, 
  +                                jk_logger_t *l) 
   {
       int code = (int)jk_b_get_byte(msg);
  +    int err;
   
       switch(code) {
       case JK_AJP13_SEND_HEADERS:
  -        {
  -            if (!ajp_unmarshal_response(msg, r, ae, l)) {
  -                l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - ajp_unmarshal_response failed\n");
  -                return JK_AJP13_ERROR;
  -            }
  -            if (!r->start_response(r, 
  -                                   r->status, 
  -                                   r->msg, 
  -                                   (const char * const *)r->out_header_names,
  -                                   (const char * const *)r->out_header_values,
  -                                   r->out_headers)) {
  -                l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - start_response failed\n");
  -                return JK_CLIENT_ERROR;
  -            }
  -        }
  +        err=ajp_handle_response( msg, r, ae, l );
  +        return err;
           break;
           
       case JK_AJP13_SEND_BODY_CHUNK:
  -        {
  -            unsigned len = (unsigned)jk_b_get_int(msg);
  -            if(!r->write(r, jk_b_get_buff(msg) + jk_b_get_pos(msg), len)) {
  -                l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - write failed\n");
  -                return JK_CLIENT_ERROR;
  -            }
  -        }
  +        return ajp_handle_sendChunk( msg, r, ae, l);
           break;
           
       case JK_AJP13_GET_BODY_CHUNK:
           {
  -            unsigned len = (unsigned)jk_b_get_int(msg);
  +            /* XXX Is it signed or not ? */
  +            int len = jk_b_get_int(msg);
               
               if(len > AJP13_MAX_SEND_BODY_SZ) {
                   len = AJP13_MAX_SEND_BODY_SZ;
  
  
  
  1.3       +2 -2      jakarta-tomcat-connectors/jk/native2/common/jk_env.c
  
  Index: jk_env.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_env.c	2001/12/02 01:05:25	1.2
  +++ jk_env.c	2001/12/05 20:48:20	1.3
  @@ -62,7 +62,7 @@
   
   /* Private methods 
   */
  -static jk_env_initEnv( jk_env_t *env, char *id );
  +static void jk_env_initEnv( jk_env_t *env, char *id );
   
   /* XXX We should have one env per thread to avoid sync problems. 
      The env will provide access to pools, etc 
  @@ -144,7 +144,7 @@
     map_put( env->_registry, typeName, fact, &old );
   }
   
  -static jk_env_initEnv( jk_env_t *env, char *id ) {
  +static void jk_env_initEnv( jk_env_t *env, char *id ) {
     /*   env->logger=NULL; */
     /*   map_alloc( & env->properties ); */
     env->getFactory= jk_env_getFactory; 
  
  
  
  1.5       +67 -18    jakarta-tomcat-connectors/jk/native2/common/jk_handler_discovery.c
  
  Index: jk_handler_discovery.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_discovery.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_handler_discovery.c	2001/12/04 23:56:07	1.4
  +++ jk_handler_discovery.c	2001/12/05 20:48:20	1.5
  @@ -58,14 +58,16 @@
   /**
    * Description: AJP14 Discovery handler
    * Author:      Henri Gomez <hgomez@slib.fr>
  - * Version:     $Revision: 1.4 $                                          
  + * Version:     $Revision: 1.5 $                                          
    */
   
   #include "jk_global.h"
   #include "jk_pool.h"
  +#include "jk_env.h"
   #include "jk_msg_buff.h"
   #include "jk_logger.h"
   #include "jk_service.h"
  +#include "jk_handler.h"
   
   #define CBASE_INC_SIZE   (8)    /* Allocate memory by step of 8 URIs : ie 8 URI by context */
   #define URI_INC_SIZE (8)        /* Allocate memory by step of 8 CONTEXTs : ie 8 contexts by worker */
  @@ -137,6 +139,35 @@
   
   int context_add_uri(jk_context_t *c, char *cbase, char *uri);
   
  +static int jk_handler_discovery_init( jk_worker_t *w );
  +
  +static int jk_handler_discovery_discovery(jk_endpoint_t *ae,jk_workerEnv_t *we,
  +                                          jk_logger_t *l);
  +
  +static int ajp14_marshal_context_query_into_msgb(jk_msg_buf_t *msg,
  +                                                 char         *virtual,
  +                                                 jk_logger_t  *l);
  +
  +static int ajp14_unmarshal_context_info(jk_msg_buf_t *msg,
  +                                        jk_context_t *c,
  +                                        jk_logger_t  *l);
  +
  +static int ajp14_marshal_context_state_into_msgb(jk_msg_buf_t *msg,
  +                                                 jk_context_t *c,
  +                                                 char         *cname,
  +                                                 jk_logger_t  *l);
  +
  +static int ajp14_unmarshal_context_state_reply(jk_msg_buf_t *msg,
  +                                               jk_context_t *c,
  +                                               jk_logger_t  *l);
  +
  +static int ajp14_unmarshal_context_update_cmd(jk_msg_buf_t *msg,
  +                                              jk_context_t *c,
  +                                              jk_logger_t  *l);
  +
  +int JK_METHOD jk_handler_discovery_factory( jk_env_t *env, void **result,
  +                                            char *type, char *name);
  +
   /*
    * Context Query (web server -> servlet engine), which URI are handled by servlet engine ?
    */
  @@ -163,6 +194,24 @@
    */
   #define AJP14_CONTEXT_STATE_REP_CMD	(unsigned char)0x1D
   
  +/* ==================== Constructor and impl. ==================== */
  +
  +int JK_METHOD jk_handler_discovery_factory( jk_env_t *env, void **result,
  +                                            char *type, char *name)
  +{
  +    jk_handler_t *h=(jk_handler_t *)malloc( sizeof( jk_handler_t));
  +
  +    h->init=jk_handler_discovery_init;
  +    *result=h;
  +    return JK_TRUE;
  +}
  +
  +
  +static int jk_handler_discovery_init( jk_worker_t *w ) {
  +    return JK_TRUE;
  +}
  +
  +
   static int context_realloc(jk_context_t *c)
   {
       if (c->size == c->capacity) {
  @@ -331,7 +380,7 @@
       return JK_TRUE;
   }
    
  -int discovery(jk_endpoint_t *ae,
  +static int jk_handler_discovery_discovery(jk_endpoint_t *ae,
                 jk_workerEnv_t *we,
                 jk_logger_t    *l)
   {
  @@ -360,9 +409,9 @@
    * +--------------------------+---------------------------------+
    *
    */
  -int ajp14_marshal_context_query_into_msgb(jk_msg_buf_t *msg,
  -                                          char         *virtual,
  -                                          jk_logger_t  *l)
  +static int ajp14_marshal_context_query_into_msgb(jk_msg_buf_t *msg,
  +                                                 char         *virtual,
  +                                                 jk_logger_t  *l)
   {
       l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_marshal_context_query_into_msgb\n");
       
  @@ -404,9 +453,9 @@
    *-------------------+-------------------------------+-----------+
    */
   
  -int ajp14_unmarshal_context_info(jk_msg_buf_t *msg,
  -                                 jk_context_t *c,
  -                                 jk_logger_t  *l)
  +static int ajp14_unmarshal_context_info(jk_msg_buf_t *msg,
  +                                        jk_context_t *c,
  +                                        jk_logger_t  *l)
   {
       char *vname;
       char *cname;
  @@ -505,10 +554,10 @@
    * +----------------------------+----------------------------------+----------
    *
    */
  -int ajp14_marshal_context_state_into_msgb(jk_msg_buf_t *msg,
  -                                          jk_context_t *c,
  -                                          char         *cname,
  -                                          jk_logger_t  *l)
  +static int ajp14_marshal_context_state_into_msgb(jk_msg_buf_t *msg,
  +                                                 jk_context_t *c,
  +                                                 char         *cname,
  +                                                 jk_logger_t  *l)
   {
       jk_context_item_t *ci;
       int                i;
  @@ -594,9 +643,9 @@
    *CONTEXT NAME (CString (*)) | UP/DOWN (1 byte) | .. |
    * ------------------------+------------------+----+
    */
  -int ajp14_unmarshal_context_state_reply(jk_msg_buf_t *msg,
  -                                        jk_context_t *c,
  -                                        jk_logger_t  *l)
  +static int ajp14_unmarshal_context_state_reply(jk_msg_buf_t *msg,
  +                                               jk_context_t *c,
  +                                               jk_logger_t  *l)
   {
       char                *vname;
       char                *cname;
  @@ -666,9 +715,9 @@
    * ----------------------+------------------+
    * 
    */
  -int ajp14_unmarshal_context_update_cmd(jk_msg_buf_t *msg,
  -                                       jk_context_t *c,
  -                                       jk_logger_t  *l)
  +static int ajp14_unmarshal_context_update_cmd(jk_msg_buf_t *msg,
  +                                              jk_context_t *c,
  +                                              jk_logger_t  *l)
   {
       return (ajp14_unmarshal_context_state_reply(msg, c, l));
   }
  
  
  
  1.4       +32 -3     jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c
  
  Index: jk_handler_logon.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_handler_logon.c	2001/12/04 19:04:48	1.3
  +++ jk_handler_logon.c	2001/12/05 20:48:20	1.4
  @@ -58,7 +58,7 @@
   /**
    * Description: AJP14 Login handler
    * Author:      Henri Gomez <hgomez@slib.fr>
  - * Version:     $Revision: 1.3 $                                          
  + * Version:     $Revision: 1.4 $                                          
    */
   
   #include "jk_global.h"
  @@ -67,6 +67,8 @@
   #include "jk_md5.h"
   #include "jk_logger.h"
   #include "jk_service.h"
  +#include "jk_env.h"
  +#include "jk_handler.h"
   
   /* Private definitions */
   
  @@ -95,7 +97,10 @@
    */
   #define AJP14_LOGNOK_CMD	(unsigned char)0x14
   
  +int JK_METHOD jk_handler_logon_factory( jk_env_t *env, void **result,
  +                                        char *type, char *name);
   
  +
   /* Private functions */
   
   static void ajp14_compute_md5(jk_login_service_t *s, 
  @@ -121,6 +126,28 @@
                                      jk_logger_t *l);
   
   
  +static int jk_handler_logon_logon(jk_endpoint_t *ae, jk_logger_t    *l);
  +static int jk_handler_logon_init( jk_worker_t *w );
  +
  +/* ==================== Impl =================== */
  +
  +int JK_METHOD jk_handler_logon_factory( jk_env_t *env, void **result,
  +                                       char *type, char *name)
  +{
  +    jk_handler_t *h=(jk_handler_t *)malloc( sizeof( jk_handler_t));
  +
  +    h->init=jk_handler_logon_init;
  +    *result=h;
  +    return JK_TRUE;
  +}
  +
  +
  +static int jk_handler_logon_init( jk_worker_t *w ) {
  +    w->logon= jk_handler_logon_logon; 
  +    return JK_TRUE;
  +}
  +
  +
   /* 
    * AJP14 Logon Phase 
    *
  @@ -192,9 +219,10 @@
       
       return JK_FALSE;
   }
  +
   
  -int logon(jk_endpoint_t *ae,
  -          jk_logger_t    *l)
  +static int jk_handler_logon_logon(jk_endpoint_t *ae,
  +                           jk_logger_t    *l)
   {
       jk_pool_t     *p = &ae->pool;
       jk_msg_buf_t  *msg;
  @@ -210,6 +238,7 @@
       
       return rc;
   }
  +
   
   /* -------------------- private utils/marshaling -------------------- */
   
  
  
  
  1.2       +5 -0      jakarta-tomcat-connectors/jk/native2/common/jk_handler_request.c
  
  Index: jk_handler_request.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_request.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_handler_request.c	2001/12/04 18:37:13	1.1
  +++ jk_handler_request.c	2001/12/05 20:48:20	1.2
  @@ -87,6 +87,11 @@
   #define SC_A_SSL_KEY_SIZE       (unsigned char)11		/* only in if JkOptions +ForwardKeySize */
   #define SC_A_ARE_DONE           (unsigned char)0xFF
   
  +int jk_handler_request_marshal(jk_msg_buf_t    *msg,
  +                               jk_ws_service_t *s,
  +                               jk_logger_t     *l,
  +                               jk_endpoint_t  *ae);
  +
   /**
     Message structure
    
  
  
  
  1.3       +103 -4    jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c
  
  Index: jk_handler_response.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_handler_response.c	2001/12/04 23:56:07	1.2
  +++ jk_handler_response.c	2001/12/05 20:48:20	1.3
  @@ -60,7 +60,106 @@
   #include "jk_msg_buff.h"
   #include "jk_env.h"
   #include "jk_requtil.h"
  +#include "jk_env.h"
  +#include "jk_handler.h"
  +#include "jk_endpoint.h"
  +
  +static int ajp_unmarshal_response(jk_msg_buf_t   *msg,
  +                                  jk_ws_service_t  *s,
  +                                  jk_endpoint_t *ae,
  +                                  jk_logger_t    *l);
  +
  +int ajp_handle_sendChunk(jk_msg_buf_t   *msg,
  +                         jk_ws_service_t  *r,
  +                         jk_endpoint_t *ae,
  +                         jk_logger_t    *l);
  +
  +
  +int ajp_handle_startResponse(jk_msg_buf_t   *msg,
  +                             jk_ws_service_t  *r,
  +                             jk_endpoint_t *ae,
  +                             jk_logger_t    *l);
  +
  +int ajp_handle_getChunk(jk_msg_buf_t   *msg,
  +                         jk_ws_service_t  *r,
  +                         jk_endpoint_t *ae,
  +                         jk_logger_t    *l);
   
  +/** SEND_HEADERS handler
  + */
  +int ajp_handle_startResponse(jk_msg_buf_t   *msg,
  +                             jk_ws_service_t  *r,
  +                             jk_endpoint_t *ae,
  +                             jk_logger_t    *l)
  +{
  +    int err;
  +    
  +    err=ajp_unmarshal_response(msg, r, ae, l);
  +    if( err!=JK_TRUE ) {
  +        l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - ajp_unmarshal_response failed\n");
  +        return JK_AJP13_ERROR;
  +    }
  +    err=r->start_response(r, r->status, r->msg, 
  +                          (const char * const *)r->out_header_names,
  +                          (const char * const *)r->out_header_values,
  +                          r->out_headers);
  +    if( err!=JK_TRUE ) {
  +        l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - start_response failed\n");
  +        return JK_CLIENT_ERROR;
  +    }
  +    return JK_TRUE;
  +}
  +
  +/** SEND_BODY_CHUNK handler
  + */
  +int ajp_handle_sendChunk(jk_msg_buf_t   *msg,
  +                         jk_ws_service_t  *r,
  +                         jk_endpoint_t *ae,
  +                         jk_logger_t    *l)
  +{
  +    int err;
  +    unsigned len = (unsigned)jk_b_get_int(msg);
  +
  +    err=r->write(r, jk_b_get_buff(msg) + jk_b_get_pos(msg), len);
  +    if( err!= JK_TRUE ) {
  +        l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - write failed\n");
  +        return JK_CLIENT_ERROR;
  +    }
  +
  +    return JK_TRUE;
  +}
  +
  +/** SEND_BODY_CHUNK handler
  + */
  +int ajp_handle_getChunk(jk_msg_buf_t   *msg,
  +                        jk_ws_service_t  *r,
  +                        jk_endpoint_t *ae,
  +                        jk_logger_t    *l)
  +{
  +    int len = jk_b_get_int(msg);
  +    
  +    if(len > AJP13_MAX_SEND_BODY_SZ) {
  +        len = AJP13_MAX_SEND_BODY_SZ;
  +    }
  +    if(len > ae->left_bytes_to_send) {
  +        len = ae->left_bytes_to_send;
  +    }
  +    if(len < 0) {
  +        len = 0;
  +    }
  +            
  +    /* the right place to add file storage for upload */
  +    if ((len = ajp_read_into_msg_buff(ae, r, msg, len, l)) >= 0) {
  +        r->content_read += len;
  +        return JK_AJP13_HAS_RESPONSE;
  +    }                  
  +            
  +    l->jkLog(l, JK_LOG_ERROR, "Error ajp_process_callback - ajp_read_into_msg_buff failed\n");
  +    return JK_INTERNAL_ERROR;	    
  +}
  +
  +
  +
   
   /*
   AJPV13_RESPONSE/AJPV14_RESPONSE:=
  @@ -86,10 +185,10 @@
       body    length*(var binary)
   
    */
  -int ajp_unmarshal_response(jk_msg_buf_t   *msg,
  -                           jk_ws_service_t  *s,
  -                           jk_endpoint_t *ae,
  -                           jk_logger_t    *l)
  +static int ajp_unmarshal_response(jk_msg_buf_t   *msg,
  +                                  jk_ws_service_t  *s,
  +                                  jk_endpoint_t *ae,
  +                                  jk_logger_t    *l)
   {
       jk_pool_t * p = &ae->pool;
   
  
  
  
  1.6       +24 -17    jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c
  
  Index: jk_jni_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_jni_worker.c	2001/12/04 23:52:43	1.5
  +++ jk_jni_worker.c	2001/12/05 20:48:20	1.6
  @@ -59,7 +59,7 @@
    * Description: In process JNI worker                                      *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.5 $                                           *
  + * Version:     $Revision: 1.6 $                                           *
    ***************************************************************************/
   
   #if !defined(WIN32) && !defined(NETWARE)
  @@ -193,6 +193,8 @@
   };
   typedef struct jni_endpoint jni_endpoint_t;
   
  +int JK_METHOD jk_worker_jni_factory(jk_env_t *env, void **result,
  +                                    char *type, char *name);
   
   static int load_jvm_dll(jni_worker_t *p,
                           jk_logger_t *l);
  @@ -228,7 +230,15 @@
   static void detach_from_jvm(jni_worker_t *p, 
                               jk_logger_t *l);
   
  +static char **jk_parse_sysprops(jk_pool_t *p, 
  +                                const char *sysprops);
  +
  +static int jk_file_exists(const char *f);
  +
  +static void jk_append_libpath(jk_pool_t *p, 
  +                              const char *libpath);
   
  +
   #if defined LINUX && defined APACHE2_SIGHACK
   static void linux_signal_hack() 
   {
  @@ -254,9 +264,8 @@
       printf( "\n");
   }
   #endif
  -
   
  -char **jk_parse_sysprops(jk_pool_t *p, 
  +static char **jk_parse_sysprops(jk_pool_t *p, 
                            const char *sysprops)
   {
       char **rc = NULL;
  @@ -290,8 +299,7 @@
       return rc;
   }
   
  -
  -int jk_file_exists(const char *f)
  +static int jk_file_exists(const char *f)
   {
       if(f) {
           struct stat st;
  @@ -303,8 +311,8 @@
   }
   
   
  -void jk_append_libpath(jk_pool_t *p, 
  -                       const char *libpath)
  +static void jk_append_libpath(jk_pool_t *p, 
  +                              const char *libpath)
   {
       char *env = NULL;
       char *current = getenv(PATH_ENV_VARIABLE);
  @@ -703,22 +711,21 @@
                                       char *type, char *name)
   {
       jk_logger_t *l=env->logger;
  -    jk_worker_t **w=result;
       jni_worker_t *private_data;
   
       l->jkLog(l, JK_LOG_DEBUG, "Into jni_worker_factory\n");
   
  -    if(!name || !w) {
  +    if(!name) {
   	    l->jkLog(l, JK_LOG_EMERG, 
                  "In jni_worker_factory, assert failed - invalid parameters\n");
   	    return JK_FALSE;
       }
   
       if(the_singleton_jni_worker) {
  -	    l->jkLog(l, JK_LOG_DEBUG, 
  -               "In jni_worker_factory, instance already created\n");
  -        *w = the_singleton_jni_worker;
  -	    return JK_TRUE;
  +        l->jkLog(l, JK_LOG_DEBUG, 
  +                 "In jni_worker_factory, instance already created\n");
  +        *result = the_singleton_jni_worker;
  +        return JK_TRUE;
       }
   
       private_data = (jni_worker_t *)malloc(sizeof(jni_worker_t ));
  @@ -730,15 +737,15 @@
       }
   
       jk_open_pool(&private_data->p,
  -	             private_data->buf,
  +                 private_data->buf,
                    sizeof(jk_pool_atom_t) * TINY_POOL_SIZE);
   
       private_data->name = private_data->p.pstrdup(&private_data->p, name);
   
       if(!private_data->name) {
           l->jkLog(l, JK_LOG_ERROR, 
  -               "In jni_worker_factory, memory allocation error\n");
  -	    private_data->p.close(&private_data->p);
  +                 "In jni_worker_factory, memory allocation error\n");
  +        private_data->p.close(&private_data->p);
           free(private_data);
           return JK_FALSE;
       }
  @@ -771,7 +778,7 @@
       private_data->worker.get_endpoint   = get_endpoint;
       private_data->worker.destroy        = destroy;
   
  -    *w = &private_data->worker;
  +    *result = &private_data->worker;
       the_singleton_jni_worker = &private_data->worker;
   
       l->jkLog(l, JK_LOG_DEBUG, "Done jni_worker_factory\n");
  
  
  
  1.4       +41 -2     jakarta-tomcat-connectors/jk/native2/common/jk_map.c
  
  Index: jk_map.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_map.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_map.c	2001/12/04 23:56:07	1.3
  +++ jk_map.c	2001/12/05 20:48:20	1.4
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: General purpose map object                                 *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.3 $                                           *
  + * Version:     $Revision: 1.4 $                                           *
    ***************************************************************************/
   
   #include "jk_global.h"
  @@ -512,7 +512,7 @@
                        const char *objType,
                        const char *objName,
                        const char *pname,
  -                     const char *def)
  +                     char *def)
   {
       char buf[1024];
   
  @@ -544,5 +544,44 @@
   
       sprintf(buf, "%s.%s.%s", objType, objName, pname);
       return map_get_int(m, buf, def);
  +}
  +
  +double map_getDoubleProp(jk_map_t *m,
  +                         const char *objType,
  +                         const char *objName,
  +                         const char *pname,
  +                         const double def)
  +{
  +    char buf[1024];
  +
  +    if( m==NULL ||
  +        objType==NULL ||
  +        objName==NULL ||
  +        pname==NULL ) {
  +        return def;
  +    }
  +
  +    sprintf(buf, "%s.%s.%s", objType, objName, pname);
  +    return map_get_double(m, buf, def);
  +}
  +
  +char **map_getListProp(jk_map_t *m,
  +                    const char *objType,
  +                    const char *objName,
  +                    const char *pname, 
  +                    unsigned *size)
  +{
  +    char buf[1024];
  +
  +    if( m==NULL ||
  +        objType==NULL ||
  +        objName==NULL ||
  +        pname==NULL ) {
  +        return NULL;
  +    }
  +
  +    sprintf(buf, "%s.%s.%s", objType, objName, pname);
  +
  +    return map_get_string_list(m, buf, size, NULL);
   }
   
  
  
  
  1.3       +22 -6     jakarta-tomcat-connectors/jk/native2/common/jk_pool.c
  
  Index: jk_pool.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_pool.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_pool.c	2001/12/04 23:56:07	1.2
  +++ jk_pool.c	2001/12/05 20:48:20	1.3
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: Simple memory pool                                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.2 $                                           *
  + * Version:     $Revision: 1.3 $                                           *
    ***************************************************************************/
   
   #include "jk_pool.h"
  @@ -66,11 +66,19 @@
   
   #define DEFAULT_DYNAMIC 10
   
  +int JK_METHOD jk_pool_factory( jk_env_t *env, void **result,
  +                               char *type, char *name);
   
   static void *jk_pool_dyn_alloc(jk_pool_t *p, 
                                  size_t size);
   
  +static void jk_reset_pool(jk_pool_t *p);
  +
  +static void jk_close_pool(jk_pool_t *p);
   
  +static void *jk_pool_alloc(jk_pool_t *p, 
  +                           size_t size);
  +
   static void jk_close_pool(jk_pool_t *p)
   {
       if(p) {
  @@ -168,13 +176,13 @@
   static void jk_dump_pool(jk_pool_t *p, 
                     FILE *f)
   {
  -    fprintf(f, "Dumping for pool [%x]\n", p);
  +    fprintf(f, "Dumping for pool [%p]\n", p);
       fprintf(f, "size             [%d]\n", p->size);
       fprintf(f, "pos              [%d]\n", p->pos);
  -    fprintf(f, "buf              [%x]\n", p->buf);  
  +    fprintf(f, "buf              [%p]\n", p->buf);  
       fprintf(f, "dyn_size         [%d]\n", p->dyn_size);
       fprintf(f, "dyn_pos          [%d]\n", p->dyn_pos);
  -    fprintf(f, "dynamic          [%x]\n", p->dynamic);
  +    fprintf(f, "dynamic          [%p]\n", p->dynamic);
   
       fflush(f);
   }
  @@ -212,8 +220,15 @@
   }
   
   /* Not implemented yet */
  -int jk_pool_create( jk_pool_t **newPool, jk_pool_t *parent ) {
  +int jk_pool_create( jk_pool_t **newPool, jk_pool_t *parent, int size ) {
  +    jk_pool_t *_this=(jk_pool_t *)malloc( sizeof( jk_pool_t ));
   
  +    /* XXX strange, but I assume the size is in bytes, not atom_t */
  +    _this->buf=(jk_pool_atom_t *)malloc( size );
  +    jk_open_pool( _this, _this->buf, size );
  +    _this->own_buffer = JK_TRUE;
  +    *newPool = _this;
  +    
       return JK_TRUE;
   }
   
  @@ -247,11 +262,12 @@
   {
       _this->pos  = 0;
       _this->size = size;
  -    _this->buf  = (char *)buf;
  +    _this->buf  = buf;
   
       _this->dyn_pos = 0;
       _this->dynamic = NULL;
       _this->dyn_size = 0;
  +    _this->own_buffer = JK_FALSE;
       init_methods( _this );
   }
   
  
  
  
  1.3       +18 -18    jakarta-tomcat-connectors/jk/native2/common/jk_registry.c
  
  Index: jk_registry.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_registry.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_registry.c	2001/12/02 01:05:25	1.2
  +++ jk_registry.c	2001/12/05 20:48:20	1.3
  @@ -62,7 +62,7 @@
   
   /***************************************************************************
    * Description: Worker list                                                *
  - * Version:     $Revision: 1.2 $                                           *
  + * Version:     $Revision: 1.3 $                                           *
    ***************************************************************************/
   
   /** Static declarations for all 'hardcoded' modules. This is a hack, 
  @@ -85,33 +85,33 @@
    */
   
   int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  -                                       char *type, char *name);
  +                                       const char *type, const char *name);
   
                                      
   int JK_METHOD jk_worker_lb_factory(jk_env_t *env, void **result,
  -                                   char *type, char *name);
  +                                   const char *type, const char *name);
   
   
   int JK_METHOD jk_worker_jni_factory(jk_env_t *env, void **result,
  -                                    char *type, char *name);
  +                                    const char *type, const char *name);
   
   int JK_METHOD jk_worker_ajp12_factory(jk_env_t *env, void **result,
  -                                    char *type, char *name);
  +                                      const char *type, const char *name);
   
   /* Factories for 'new' types. We use the new factory interface,
    *  workers will be updated later 
    */
   int JK_METHOD jk_channel_socket_factory(jk_env_t *env, void **result,
  -					char *type, char *name);
  +					const char *type, const char *name);
   
   int JK_METHOD jk_workerEnv_factory(jk_env_t *env, void **result,
  -                                   char *type, char *name);
  +                                   const char *type, const char *name);
   
   int JK_METHOD jk_uriMap_factory(jk_env_t *env, void **result,
  -                                   char *type, char *name);
  +                                const char *type, const char *name);
   
   int JK_METHOD jk_logger_file_factory(jk_env_t *env, void **result,
  -                                     char *type, char *name);
  +                                     const char *type, const char *name);
   
   
   /**
  @@ -134,21 +134,21 @@
      * and because the MetroWerks compiler (used for NetWare) treats this as an
      * error, I'm casting the function pointers to (void *) - mmanders
      */
  -  env->registerFactory( env, "logger", "file",   &jk_logger_file_factory );
  -  env->registerFactory( env, "workerEnv", "default", &jk_workerEnv_factory );
  -  env->registerFactory( env, "uriMap", "default",    &jk_uriMap_factory );
  -  env->registerFactory( env, "worker", "ajp13", &jk_worker_ajp14_factory );
  -  env->registerFactory( env, "worker", "ajp14", &jk_worker_ajp14_factory );
  -  env->registerFactory( env, "worker", "lb",    &jk_worker_lb_factory );
  -  env->registerFactory( env, "channel", "socket", &jk_channel_socket_factory );
  +  env->registerFactory( env, "logger", "file",   jk_logger_file_factory );
  +  env->registerFactory( env, "workerEnv", "default", jk_workerEnv_factory );
  +  env->registerFactory( env, "uriMap", "default",    jk_uriMap_factory );
  +  env->registerFactory( env, "worker", "ajp13", jk_worker_ajp14_factory );
  +  env->registerFactory( env, "worker", "ajp14", jk_worker_ajp14_factory );
  +  env->registerFactory( env, "worker", "lb",    jk_worker_lb_factory );
  +  env->registerFactory( env, "channel", "socket", jk_channel_socket_factory );
   
     /* Optional objects */
   
   #ifdef HAVE_JNI
  -  env->registerFactory( env, "worker", "jni",   &jk_worker_jni_factory );
  +  env->registerFactory( env, "worker", "jni",   jk_worker_jni_factory );
   #endif
   #ifdef AJP12
  -  env->registerFactory( env, "worker", "ajp12", &jk_worker_ajp12_factory );
  +  env->registerFactory( env, "worker", "ajp12", jk_worker_ajp12_factory );
   #endif
   
   
  
  
  
  1.6       +52 -31    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_uriMap.c	2001/12/04 23:56:07	1.5
  +++ jk_uriMap.c	2001/12/05 20:48:20	1.6
  @@ -55,25 +55,46 @@
    *                                                                           *
    * ========================================================================= */
   
  -/***************************************************************************
  - * Description: URI to worker map object.                                  *
  - * Maps can be                                                             *
  - *                                                                         *
  - * Exact Context -> /exact/uri=worker e.g. /examples/do*=ajp12             *
  - * Context Based -> /context/*=worker e.g. /examples/*=ajp12               *
  - * Context and suffix ->/context/*.suffix=worker e.g. /examples/ *.jsp=ajp12*
  - *                                                                         *
  - * This lets us either partition the work among the web server and the     *
  - * servlet container.                                                      *
  - *                                                                         *
  - * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.5 $                                           *
  - ***************************************************************************/
  +/**
  + * Description: URI to worker map object.                          
  + * Maps can be                                                     
  + *                                                                 
  + * Exact Context -> /exact/uri=worker e.g. /examples/do[STAR]=ajp12
  + * Context Based -> /context/[STAR]=worker e.g. /examples/[STAR]=ajp12
  + * Context and suffix ->/context/[STAR].suffix=worker e.g. /examples/[STAR].jsp=ajp12
  + *                                                                         
  + * This lets us either partition the work among the web server and the     
  + * servlet container.                                                      
  + *                                                                         
  + * Author:      Gal Shachor <shachor@il.ibm.com>                           
  + * Version:     $Revision: 1.6 $                                           
  + */
   
   #include "jk_pool.h"
   #include "jk_env.h"
   #include "jk_uriMap.h"
   
  +int JK_METHOD jk_uriMap_factory( jk_env_t *env, void **result,
  +                                 const char *type, const char *name);
  +
  +static int jk_uriMap_init(jk_uriMap_t *_this,
  +                          jk_workerEnv_t *workerEnv,
  +                          jk_map_t *init_data );
  +
  +static jk_uriEnv_t *jk_uriMap_addMapping(jk_uriMap_t *_this,
  +                                         const char *vhost,
  +                                         const char *puri, 
  +                                         const char *pworker );
  +
  +static INLINE const char *findExtension( const char *uri );
  +
  +static jk_uriEnv_t *jk_uriMap_mapUri(jk_uriMap_t *_this,
  +                                     const char *vhost,
  +                                     const char *uri );
  +
  +static int jk_uriMap_checkUri(jk_uriMap_t *_this, 
  +                              const char *uri );
  +
   /*
    * We are now in a security nightmare, it maybe that somebody sent 
    * us a uri that looks like /top-secret.jsp. and the web server will 
  @@ -88,7 +109,7 @@
   static int jk_uriMap_checkUri(jk_uriMap_t *_this, 
                                 const char *uri )
   {
  -    unsigned i;    
  +    int i;    
   
       for(i = 0 ; i < _this->size ; i++) {
           if(MATCH_TYPE_SUFFIX == _this->maps[i]->match_type) {
  @@ -163,9 +184,9 @@
   }
   
   static jk_uriEnv_t *jk_uriMap_addMapping(jk_uriMap_t *_this,
  -                                         char *vhost,
  -                                         char *puri, 
  -                                         char *pworker )
  +                                         const char *vhost,
  +                                         const char *puri, 
  +                                         const char *pworker )
   {
       jk_logger_t *l=_this->workerEnv->l;
       jk_uriEnv_t *uwr;
  @@ -235,8 +256,8 @@
       }
   
       /*
  -     * Now, lets check that the pattern is /context/*.suffix
  -     * or /context/*
  +     * Now, lets check that the pattern is /context/STAR.suffix
  +     * or /context/STAR
        * we need to have a '/' then a '*' and the a '.' or a
        * '/' then a '*'
        */
  @@ -287,9 +308,9 @@
       return uwr;
   }
   
  -int jk_uriMap_init(jk_uriMap_t *_this,
  -                   jk_workerEnv_t *workerEnv,
  -                   jk_map_t *init_data )
  +static int jk_uriMap_init(jk_uriMap_t *_this,
  +                          jk_workerEnv_t *workerEnv,
  +                          jk_map_t *init_data )
   {
       int rc=JK_TRUE;
       int sz;
  @@ -365,7 +386,7 @@
      we check only the last component, as required by
      servlet spec
   */
  -INLINE const char *findExtension( const char *uri ) {
  +static INLINE const char *findExtension( const char *uri ) {
       int suffix_start;
       const char *suffix;
       
  @@ -386,13 +407,13 @@
       return suffix;
   }
   
  -jk_uriEnv_t *jk_uriMap_mapUri(jk_uriMap_t *_this,
  -                              const char *vhost,
  -                              const char *uri )
  +static jk_uriEnv_t *jk_uriMap_mapUri(jk_uriMap_t *_this,
  +                                     const char *vhost,
  +                                     const char *uri )
   {
  -    unsigned i;
  -    unsigned best_match = -1;
  -    unsigned longest_match = 0;
  +    int i;
  +    int best_match = -1;
  +    int longest_match = 0;
       char * clean_uri = NULL;
       char *url_rewrite;
       const char *suffix;
  @@ -507,7 +528,7 @@
   }
   
   int JK_METHOD jk_uriMap_factory( jk_env_t *env, void **result,
  -                                 char *type, char *name)
  +                                 const char *type, const char *name)
   {
       jk_uriMap_t *_this;
       jk_map_t *init_data;
  
  
  
  1.4       +18 -28    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_workerEnv.c	2001/12/04 19:10:04	1.3
  +++ jk_workerEnv.c	2001/12/05 20:48:20	1.4
  @@ -59,7 +59,7 @@
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.3 $                                           *
  + * Version:     $Revision: 1.4 $                                           *
    ***************************************************************************/
   
   #include "jk_workerEnv.h" 
  @@ -68,25 +68,10 @@
   
   #define DEFAULT_WORKER              ("ajp13")
   
  -int jk_get_worker_list(jk_map_t *m,
  -                       char ***list,
  -                       unsigned *num_of_wokers)
  -{
  -    if(m && list && num_of_wokers) {
  -        char **ar = map_get_string_list(m, 
  -                                        "worker.list", 
  -                                        num_of_wokers, 
  -                                        DEFAULT_WORKER );
  -        if(ar)  {
  -            *list = ar;     
  -            return JK_TRUE;
  -        }
  -        *list = NULL;   
  -        *num_of_wokers = 0;
  -    }
  +int JK_METHOD jk_workerEnv_factory( jk_env_t *env, void **result,
  +                                    const char *type, const char *name);
   
  -    return JK_FALSE;
  -}
  +static void jk_workerEnv_close(jk_workerEnv_t *_this);
   
   /**
    *  Init the workers, prepare the we.
  @@ -98,14 +83,17 @@
       jk_map_t *init_data=_this->init_data;
       char **worker_list  = NULL;
       jk_logger_t *l=_this->l;
  -    unsigned i;
  +    int i;
       int err;
   
       /*     _this->init_data=init_data; */
  -    
  -    if(!jk_get_worker_list(init_data, 
  -                           &worker_list, 
  -                           &_this->num_of_workers)) {
  +
  +    worker_list = map_get_string_list(init_data, 
  +                                      "worker.list", 
  +                                      &_this->num_of_workers, 
  +                                      DEFAULT_WORKER );
  +    if(worker_list==NULL || _this->num_of_workers<= 0 ) {
  +        /* assert() - we pass default worker, we should get something back */
           return JK_FALSE;
       }
   
  @@ -143,9 +131,9 @@
   }
   
   
  -void jk_workerEnv_close(jk_workerEnv_t *_this)
  +static void jk_workerEnv_close(jk_workerEnv_t *_this)
   {
  -    jk_logger_t *l;
  +    jk_logger_t *l=_this->l;
       int sz;
       int i;
       
  @@ -210,6 +198,8 @@
   
       w->name=(char *)name;
       w->workerEnv=_this;
  +
  +    jk_pool_create( & w->pool, NULL, 1024 );
       
       err=w->validate(w, init_data, _this, l);
       
  @@ -237,7 +227,7 @@
   }
   
   int JK_METHOD jk_workerEnv_factory( jk_env_t *env, void **result,
  -                                    char *type, char *name)
  +                                    const char *type, const char *name)
   {
       jk_logger_t *l=env->logger;
       jk_workerEnv_t *_this;
  @@ -311,7 +301,7 @@
   
       if( _this->uriMap==NULL ) {
           l->jkLog(l, JK_LOG_ERROR, "Error getting uriMap implementation\n");
  -        return;
  +        return JK_FALSE;
       }
   
       _this->uriMap->workerEnv = _this;
  
  
  

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