bojan 2002/07/22 16:18:38
Modified: jk/native2/server/apache2 mod_jk2.c
Log:
Initial, most likely *BROKEN* code to handle default directory files. The
code in jk2_map_to_storage() should be OK.
Most critical stuff is in jk2_handler() function, the part of code that
attempts to get uriEnv from r->server->module_config.
Please review!
Revision Changes Path
1.45 +41 -23 jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c
Index: mod_jk2.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mod_jk2.c 21 Jul 2002 06:52:29 -0000 1.44
+++ mod_jk2.c 22 Jul 2002 23:18:38 -0000 1.45
@@ -532,8 +532,13 @@
uriEnv=ap_get_module_config( r->request_config, &jk2_module );
+ /* We do DIR_MAGIC_TYPE here to make sure TC gets all requests, even
+ * if they are directory requests, in case there are no static files
+ * visible to Apache and/or DirectoryIndex was not used */
+
/* not for me, try next handler */
- if(uriEnv==NULL || strcmp(r->handler,JK_HANDLER)!= 0 )
+ if((uriEnv==NULL || strcmp(r->handler,JK_HANDLER)) &&
+ strcmp(r->handler,DIR_MAGIC_TYPE))
return DECLINED;
/* If this is a proxy request, we'll notify an error */
@@ -541,6 +546,17 @@
return HTTP_INTERNAL_SERVER_ERROR;
}
+ /* This is needed for DIR_MAGIC_TYPE. Not sure if this is good, bad or just
+ * plain ugly, but we really NEED to have uriEnv, otherwise everything else
+ * will blow up */
+
+ if(uriEnv == NULL){
+ uriEnv = ap_get_module_config(r->server->module_config, &jk2_module);
+
+ if(uriEnv == NULL) /* We still have nothing, go out */
+ return DECLINED;
+ }
+
workerEnv = uriEnv->workerEnv;
/* Get an env instance */
@@ -708,30 +724,32 @@
jk_uriEnv_t *uriEnv=ap_get_module_config( r->request_config, &jk2_module );
if( uriEnv != NULL ) {
- char *uri_p=r->uri;
+
+ /* First find just the name of the file, no directory */
+ r->filename = (char *)apr_filename_of_pathname(r->uri);
- /* This is old code which doesn't seem to work well with mod_dir
- r->filename = (char *)apr_filename_of_pathname(r->uri); */
+ /* Only if sub-request for a directory, most likely from mod_dir */
+ if (r->main && r->main->filename &&
+ !*apr_filename_of_pathname(r->main->filename)){
+
+ /* The filename from the main request will be set to what should
+ * be picked up, aliases included. Tomcat will need to know about
+ * those aliases or things won't work for them. Normal files
+ * should be fine. */
+
+ /* Need absolute path to stat */
+ if (apr_filepath_merge(&r->filename,
+ r->main->filename, r->filename,
+ APR_FILEPATH_SECUREROOT |
+ APR_FILEPATH_TRUENAME,
+ r->pool)
+ != APR_SUCCESS){
+ return DECLINED; /* We should never get here, very bad */
+ }
- /* if( uriEnv->mbean->debug > 0 ) { */
- /* env->l->jkLog(env, env->l, JK_LOG_INFO, */
- /* "mod_jk.map_to_storage(): map %s %s\n", */
- /* r->uri, r->filename); */
- /* } */
-
- /* Absolute paths cannot be merged */
- while (*uri_p == '/') ++uri_p;
-
- /* Need absolute path to stat */
- if (apr_filepath_merge(&r->filename, ap_document_root(r), uri_p,
- APR_FILEPATH_SECUREROOT | APR_FILEPATH_TRUENAME,
- r->pool)
- != APR_SUCCESS){
- return DECLINED;
+ /* Stat the file so that mod_dir knows it's there */
+ apr_stat(&r->finfo, r->filename, APR_FINFO_TYPE, r->pool);
}
-
- /* Stat the file so that mod_dir knows it's there */
- apr_stat(&r->finfo, r->filename, APR_FINFO_TYPE, r->pool);
return OK;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>