You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jf...@apache.org on 2001/09/06 19:00:54 UTC

cvs commit: jakarta-tomcat-connectors/webapp/apache-2.0 mod_webapp.c

jfclere     01/09/06 10:00:54

  Modified:    jk/native/apache-2.0 mod_jk.c
               webapp/apache-2.0 mod_webapp.c
  Log:
  Arrange apache-2.0 support (like in mod_jk.c).
  Submitted by:	Ryan Bloom, rbb@covalent.net
  
  Revision  Changes    Path
  1.23      +2 -2      jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_jk.c	2001/09/06 13:39:29	1.22
  +++ mod_jk.c	2001/09/06 17:00:54	1.23
  @@ -60,7 +60,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    *                 Henri Gomez <hg...@slib.fr>                               *
  - * Version:     $Revision: 1.22 $                                           *
  + * Version:     $Revision: 1.23 $                                           *
    ***************************************************************************/
   
   /*
  @@ -1329,7 +1329,7 @@
   static int jk_map_to_storage(request_rec *r)
   {
       if (apr_table_get(r->notes, JK_WORKER_ID)) {
  -        r->filename = apr_filename_of_pathname(r->uri);
  +        r->filename = (char *)apr_filename_of_pathname(r->uri);
           return OK;
       }
       return DECLINED;
  
  
  
  1.2       +18 -1     jakarta-tomcat-connectors/webapp/apache-2.0/mod_webapp.c
  
  Index: mod_webapp.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-2.0/mod_webapp.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_webapp.c	2001/08/21 16:20:58	1.1
  +++ mod_webapp.c	2001/09/06 17:00:54	1.2
  @@ -57,7 +57,7 @@
   
   /**
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: mod_webapp.c,v 1.1 2001/08/21 16:20:58 pier Exp $
  + * @version $Id: mod_webapp.c,v 1.2 2001/09/06 17:00:54 jfclere Exp $
    */
   
   #include <httpd.h>
  @@ -413,6 +413,9 @@
   
       /* The uri path is matched: set the handler and return */
       r->handler=apr_pstrdup(r->pool,"webapp-handler");
  +#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
  +    apr_table_setn(r->notes,"webapp-handler", "webapp-handler");
  +#endif
   
       /* Set the webapp request structure into Apache's request structure */
       ap_set_module_config(r->request_config, &webapp_module, appl);
  @@ -507,12 +510,26 @@
       return(OK);
   }
   
  +#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
  +/* bypass the directory_walk and file_walk for non-file requests */
  +static int wam_map_to_storage(request_rec *r)
  +{
  +    if (apr_table_get(r->notes, "webapp-handler")) {
  +        r->filename = (char *)apr_filename_of_pathname(r->uri);
  +        return OK;
  +    }
  +    return DECLINED;
  +}
  +#endif
   
   static void register_hooks(apr_pool_t *p)
   {
       ap_hook_handler(wam_invoke, NULL, NULL, APR_HOOK_MIDDLE);
       ap_hook_translate_name(wam_match, NULL, NULL, APR_HOOK_MIDDLE);
       ap_hook_child_init(wam_startup, NULL, NULL, APR_HOOK_MIDDLE);
  +#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
  +    ap_hook_map_to_storage(wam_map_to_storage, NULL, NULL, APR_HOOK_MIDDLE);
  +#endif
   }
   
   /* Apache module declaration */
  
  
  

Re: cvs commit: jakarta-tomcat-connectors/webapp/apache-2.0 mod_webapp.c

Posted by Pier Fumagalli <pi...@betaversion.org>.
"jfclere@apache.org" <jf...@apache.org> wrote:

> +#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808)
> +/* bypass the directory_walk and file_walk for non-file requests */
> +static int wam_map_to_storage(request_rec *r)
> +{
> +    if (apr_table_get(r->notes, "webapp-handler")) {
> +        r->filename = (char *)apr_filename_of_pathname(r->uri);
> +        return OK;
> +    }
> +    return DECLINED;
> +}
> +#endif

This will need to change when my next patches in the webapp library go in,
as Apache will be able to serve static files when possible...

Also, since Apache 2.0 is not final yet, I would remove all
MODULE_MAGIC_NUMBER checks, and _require_ for the module to be built with
the latest HEAD out of CVS... I don't care at this point about 2.0 backward
compatibility....

I'd do something like at the top of the file, and move the version to check
against accordingly, until 2.0 doesn't get final.

#if (MODULE_MAGIC_NUBER_MAJOR < 20010808)
#error ERROR: You need the latest Apache 2.0 code to compile
#endif

    Pier