tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien OIX <julien....@presidence.univ-nantes.fr>
Subject mod_webapp problem
Date Thu, 04 Apr 2002 15:17:32 GMT
hi everyone,


I'm using Tomcat4 and Apache (mod_webapp connector) on a Linux RedHat
7.1;

to build my connector, I do a snapshot from CVS repository:

cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout
jakarta-tomcat-connectors/webapp
cd jakarta-tomcat-connectors/webapp/
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout apr

then,

./support/buildconf.sh
./configure --with-apxs=/usr/sbin/apxs --with-apr=./apr/
make

and I move my mod_webapp.so to my apache module directory

if I stop here, access control directives from apache can't work (
<Directory> sections and .htaccess ); I can't accept that, that's one of
the reasons why I'm using Tomcat AND apache

I had a solution, which was to apply before compiling a patch (see
attached file); the effect of it should be the capacity to add
WebAppIgnore directives to my httpd.conf, but a second effect was that
my control directives worked !!

this solution (CVS + patch) worked fine last week, but now with the same
protocol, when I try a jsp, I have the source code in my browser, and
when I call a servlet in a .html, here's what I get in my error_log:

[Thu Apr  4 11:10:01 2002] [error] [client 193.52.112.79] File does not
exist: /var/tomcat4/webapps/univ/servlet/com.jsbsoft.jtf.core.SG


in first case, can I consider there's a bug in CVS sources ?

any ideas are welcome 

thanks in advance.

Julien OIX
Service Informatique de Gestion
Tél: 02 40 99 83 65
mail: julien.oix@presidence.univ-nantes.fr


###################################### mod_webapp.patch
###################################################
--- apache-1.3/mod_webapp.c Wed Feb 13 17:53:58 2002
+++ apache-1.3/mod_webapp.c.new Sat Mar 23 17:30:05 2002
@@ -227,6 +227,16 @@
     return(NULL);
 }
 
+/* Allow the option to override certain urls */
+static const char *wam_directive_ignore(cmd_parms *parms, void
*mconfig, char *w) {
+ wa_virtualhost *vhost = NULL;
+ vhost = (wa_virtualhost
*)ap_get_module_config(parms->server->module_config, &webapp_module);
+ if(wa_ignore(vhost, w) != NULL) {
+  ap_log_error(APLOG_MARK,APLOG_NOERRNO|APLOG_ERR,
parms->server,"Cannot add new ignore url");
+ }
+ return NULL;
+}
+
 /* The list of Directives for the WebApp module */
 static const command_rec wam_directives[] = {
     {
@@ -250,7 +260,14 @@
         RSRC_CONF,                  /* where available */
         TAKE3,                      /* arguments */
         "<name> <connection> <uri-path>"
-    }, {NULL}
+    }, {
+ "WebAppIgnore", 
+ wam_directive_ignore,
+ NULL,
+ RSRC_CONF,
+ ITERATE,
+ "<ignore pattern>"
+ }, {NULL}
 
 };
 
@@ -410,7 +427,7 @@
 
     /* Set the webapp request structure into Apache's request structure
*/
     ap_set_module_config(r->request_config, &webapp_module, appl);
-    return(OK);
+    return(DECLINED);
 }
 
 /* Handle the current request */
@@ -420,6 +437,7 @@
     wa_application *appl=NULL;
     wa_request *req=NULL;
     const char *msg=NULL;
+ ignore_urls *igurls = NULL;
     char *stmp=NULL;
     char *ctmp=NULL;
     char *ssl_temp;
@@ -431,6 +449,14 @@
     /* Try to get a hold on the webapp request structure */
     appl=(wa_application *)ap_get_module_config(r->request_config,
                                                 &webapp_module);
+
+ /* Now check for ignored urls */
+ for(igurls = appl->host->ignore_urls; igurls; igurls = igurls->next) {
+ if(apr_fnmatch(igurls->url, r->uri) == APR_SUCCESS) {
+ return(DECLINED);
+ }
+ }
+
     if (appl==NULL) return(DECLINED);
 
     /* Allocate the webapp request structure */
--- lib/wa_config.c Wed Feb 13 17:53:58 2002
+++ lib/wa_config.c.new Sat Mar 23 17:28:29 2002
@@ -121,6 +121,7 @@
     host->name=apr_pstrdup(wa_pool,n);
     host->port=p;
     host->apps=NULL;
+ host->ignore_urls = NULL; 
 
     /* Done! :) */
     wa_debug(WA_MARK,"Created virtual host
\"%s:%d\"",host->name,host->port);
@@ -168,4 +169,14 @@
              n,p,a);
     *c=conn;
     return(NULL);
+}
+
+/* Add an ignored url to a virtual host */
+const char *wa_ignore(wa_virtualhost *vhost, char *url) {
+ ignore_urls *ig = vhost->ignore_urls;
+ ignore_urls *igu = apr_palloc(wa_pool, sizeof(ignore_urls));
+ igu->url = apr_pstrdup(wa_pool, url);
+ igu->next = ig;
+ vhost->ignore_urls = igu; 
+ return(NULL);
 }
--- include/wa_config.h Wed Feb 13 17:53:58 2002
+++ include/wa_config.h.new Sat Mar 23 17:36:32 2002
@@ -63,6 +63,14 @@
 #ifndef _WA_CONFIG_H_
 #define _WA_CONFIG_H_
 
+/** 
+ * What a 'orrible hack
+ */
+typedef struct {
+ char *url;
+ void *next;
+} ignore_urls;
+
 /**
  * The WebApp Library connection structure.
  * <br>
@@ -91,6 +99,8 @@
     char *name;
     /** The virtual host port. */
     int port;
+ /* Patterns to ignore */
+ ignore_urls *ignore_urls;
     /** The list of all applications deployed in this virtual hosts. */
     wa_chain *apps;
 };
@@ -167,5 +177,8 @@
                            const char *n,
                            const char *p,
                            const char *a);
+
+/* Ignore certain urls */
+const char *wa_ignore(wa_virtualhost *vhost, char *url);
 
 #endif /* ifndef _WA_CONFIG_H_ */

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message