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/server/apache2 mod_jk.c
Date Wed, 12 Dec 2001 22:07:25 GMT
costin      01/12/12 14:07:25

  Modified:    jk/native2/server/apache2 mod_jk.c
  Log:
  JkMounts will be added to the config, but no actual call is made before init().
  
  ( the same model that is used on the java side in both 3.x and 4.0 - first we
  set properties, then we properly start the object )
  No distinction is made between JkMounts or uriworkers.properties or even
  properties in workers.properties ( or any other properties file ).
  
  During the config stage, we'll collect properties from various sources:
  - workers.properties.
  - native server config ( both specialized JkMount or specific options, or
  JkWorker foo bar which is equivalent with foo=bar in workers.properties ).
  - urimap.properties
  
  That means the config file to be used is entirely matter of taste.
  
  Few more fixes to the code that detects the 'first config' done by
  apache and doesn't initialize on it.
  
  Revision  Changes    Path
  1.9       +32 -55    jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- mod_jk.c	2001/12/07 23:05:45	1.8
  +++ mod_jk.c	2001/12/12 22:07:25	1.9
  @@ -59,7 +59,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    *                 Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.8 $                                           *
  + * Version:     $Revision: 1.9 $                                           *
    ***************************************************************************/
   
   /*
  @@ -69,6 +69,8 @@
   #include "ap_config.h"
   #include "apr_lib.h"
   #include "apr_date.h"
  +#include "apr_strings.h"
  +
   #include "httpd.h"
   #include "http_config.h"
   #include "http_request.h"
  @@ -76,14 +78,8 @@
   #include "http_protocol.h"
   #include "http_main.h"
   #include "http_log.h"
  -#include "util_script.h"
   
  -/* moved to apr since http-2.0.19-dev */
  -#if (MODULE_MAGIC_NUMBER_MAJOR < 20010523)
  -#include "util_date.h"
  -#endif
  -
  -#include "apr_strings.h"
  +#include "util_script.h"
   /*
    * Jakarta (jk_) include files
    */
  @@ -97,9 +93,9 @@
   #include "jk_uriMap.h"
   #include "jk_requtil.h"
   
  -#define JK_WORKER_ID        ("jakarta.worker")
   #define JK_HANDLER          ("jakarta-servlet")
   #define JK_MAGIC_TYPE       ("application/x-jakarta-servlet")
  +
   #define NULL_FOR_EMPTY(x)   ((x && !strlen(x)) ? NULL : x) 
   
   module AP_MODULE_DECLARE_DATA jk_module;
  @@ -332,22 +328,10 @@
       s->remote_host  = NULL_FOR_EMPTY(s->remote_host);
       s->remote_addr  = NULL_FOR_EMPTY(r->connection->remote_ip);
   
  -    if( l->level <= JK_LOG_DEBUG_LEVEL ) {
  -        l->jkLog(l, JK_LOG_DEBUG, 
  -               "agsp=%u agsn=%s hostn=%s shostn=%s cbsport=%d sport=%d \n",
  -               ap_get_server_port( r ),
  -               ap_get_server_name( r ),
  -               r->hostname,
  -               r->server->server_hostname,
  -               r->connection->base_server->port,
  -               r->server->port);
  -    }
  -    
       /* get server name */
       s->server_name= (char *)(r->hostname ? r->hostname :
                    r->server->server_hostname);
   
  -
       /* get the real port (otherwise redirect failed) */
       apr_sockaddr_port_get(&port,r->connection->local_addr);
       s->server_port = port;
  @@ -561,8 +545,7 @@
    *
    * JkMount URI(context) worker
    */
  -static const char *jk_mount_context(cmd_parms *cmd, 
  -                                    void *dummy, 
  +static const char *jk_mount_context(cmd_parms *cmd, void *dummy, 
                                       const char *context,
                                       const char *worker,
                                       const char *maybe_cookie)
  @@ -570,21 +553,11 @@
       server_rec *s = cmd->server;
       jk_workerEnv_t *workerEnv =
           (jk_workerEnv_t *)ap_get_module_config(s->module_config, &jk_module);
  -    char *old;
  -    jk_uriMap_t *uriMap=workerEnv->uriMap;
  -    jk_uriEnv_t *uriEnv;
       
  -    if (context[0]!='/')
  -        return "Context should start with /";
  +    if (context[0]!='/') return "Context must start with /";
   
  -    /*
  -     * Add the new worker to the alias map. XXX host ?
  -     */
  -    uriEnv=uriMap->addMapping( uriMap, NULL, context, worker );
  -    if( uriEnv==NULL ) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 
  -                     NULL, "mod_jk: Error mounting %s %s \n", context, worker  );
  -    }
  +    map_put( workerEnv->init_data, context, worker, NULL );
  +
       return NULL;
   }
   
  @@ -594,8 +567,7 @@
    *
    * JkWorkersFile file
    */
  -static const char *jk_set_worker_file(cmd_parms *cmd, 
  -                                      void *dummy, 
  +static const char *jk_set_worker_file(cmd_parms *cmd, void *dummy, 
                                         const char *worker_file)
   {
       server_rec *s = cmd->server;
  @@ -1286,9 +1258,8 @@
       for( i=0; i<10; i++ ) {
           tmpPool=apr_pool_get_parent( gPool );
           if( tmpPool == NULL ) {
  -            workerEnv->l->jkLog(workerEnv->l, JK_LOG_INFO,
  -                                "mod_jk.post_config() found global at %d\n",i);
  -            printf("XXX found global at %d\n", i );
  +            /*             workerEnv->l->jkLog(workerEnv->l, JK_LOG_INFO, */
  +            /*               "mod_jk.post_config() found global at %d\n",i); */
               break;
           }
           gPool=tmpPool;
  @@ -1299,14 +1270,14 @@
           apr_pool_userdata_get( &data, "mod_jk_init", gPool );
           if( data==NULL ) {
               workerEnv->l->jkLog(workerEnv->l, JK_LOG_INFO,
  -                                "mod_jk.post_config() validation, no key %d\n",i);
  -            printf("XXX No key\n");
  +                                "mod_jk.post_config() first invocation\n",i);
               apr_pool_userdata_set( "INITOK", "mod_jk_init", NULL, gPool );
               return OK;
           }
       }
           
  -    workerEnv->l->jkLog(workerEnv->l, JK_LOG_INFO, "mod_jk.post_config()\n" );

  +    workerEnv->l->jkLog(workerEnv->l, JK_LOG_INFO,
  +                        "mod_jk.post_config() second invocation\n" ); 
       if(!workerEnv->was_initialized) {
           workerEnv->was_initialized = JK_TRUE;        
           init_jk( pconf, workerEnv, s );
  @@ -1342,9 +1313,10 @@
       uriEnv=ap_get_module_config( r->request_config, &jk_module );
   
       /* not for me, try next handler */
  -    if(uriEnv==NULL && strcmp(r->handler,JK_HANDLER))
  +    if(uriEnv==NULL ||
  +       strcmp(r->handler,JK_HANDLER)!= 0 )
         return DECLINED;
  -
  +    
       /* If this is a proxy request, we'll notify an error */
       if(r->proxyreq) {
           return HTTP_INTERNAL_SERVER_ERROR;
  @@ -1356,6 +1328,8 @@
   
       /* Set up r->read_chunked flags for chunked encoding, if present */
       if(rc = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) {
  +        l->jkLog(l, JK_LOG_INFO,
  +                 "mod_jk.handler() Can't setup client block %d\n", rc);
           return rc;
       }
   
  @@ -1389,7 +1363,7 @@
           s->response_started = JK_FALSE;
           s->read_body_started = JK_FALSE;
           s->ws_private = r;
  -        s->pool=end->pool;
  +        s->pool=end->cPool;
           
           rc=init_ws_service(s, workerEnv);
           
  @@ -1402,6 +1376,11 @@
                * If the servlet engine didn't consume all of the
                * request data, consume and discard all further
                * characters left to read from client
  +             *
  +             *  XXX Is it the right thing to do ????? Why spend the
  +             *  bandwith, the servlet decided not to read the POST then
  +             *  jk shouldn't do it instead, and the user should get the
  +             *  error message !
                */
               char *buff = apr_palloc(r->pool, 2048);
               if (buff != NULL) {
  @@ -1415,7 +1394,7 @@
   
       end->done(&end, l); 
   
  -    if(rc) {
  +    if(rc==JK_TRUE) {
           return OK;    /* NOT r->status, even if it has changed. */
       }
   
  @@ -1475,14 +1454,14 @@
       ap_set_module_config( r->request_config, &jk_module, uriEnv );
       
       l->jkLog(l, JK_LOG_INFO, 
  -             "mod_jk.translate(): map %s %s\n", r->uri, uriEnv->webapp->worker->name);
  +             "mod_jk.translate(): map %s %s\n",
  +             r->uri, uriEnv->webapp->worker->name);
   
       return OK;
   }
   
   /* XXX Can we use type checker step to set our stuff ? */
   
  -#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
   /* bypass the directory_walk and file_walk for non-file requests */
   static int jk_map_to_storage(request_rec *r)
   {
  @@ -1490,13 +1469,13 @@
   
       if( env != NULL ) {
           r->filename = (char *)apr_filename_of_pathname(r->uri);
  -        printf( "XXX (httpd -X): map to storage %s %s \n",
  -                r->handler, r->filename);
  +        env->workerEnv->l->jkLog(env->workerEnv->l, JK_LOG_INFO, 
  +                                 "mod_jk.map_to_storage(): map %s %s\n",
  +                                 r->uri, r->filename);
           return OK;
       }
       return DECLINED;
   }
  -#endif
   
   static void jk_register_hooks(apr_pool_t *p)
   {
  @@ -1504,9 +1483,7 @@
       ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE);
       ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE);
       ap_hook_translate_name(jk_translate,NULL,NULL,APR_HOOK_FIRST);
  -#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
       ap_hook_map_to_storage(jk_map_to_storage, NULL, NULL, APR_HOOK_MIDDLE);
  -#endif
   }
   
   module AP_MODULE_DECLARE_DATA jk_module =
  
  
  

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