On Sun, Jun 29, 2003 at 05:36:48PM +1000, James Gifford wrote:
> I created a virtual directory in apache with the same path as my Midgard
> host. But when I call my root page, Apache handles it even when there
> is no index page in the folder and indexes are not allowed in the apache
> settings.
Try the patch below.
=================================
Index: mod_midgard.c
===================================================================
RCS file: /home/cvsmgd/midgard/mod-preparser/mod_midgard.c,v
retrieving revision 1.38
diff -u -d -B -u -b -r1.38 mod_midgard.c
--- mod_midgard.c 14 Jun 2003 16:00:30 -0000 1.38
+++ mod_midgard.c 29 Jun 2003 08:42:26 -0000
@@ -1296,6 +1296,8 @@
const char *parser;
GArray *path;
char *uri;
+ int urilen;
+
#if ! HAVE_MIDGARD_MULTILANG
int auth_res;
#else /* HAVE_MIDGARD_MULTILANG */
@@ -1320,27 +1322,6 @@
if (!dcfg || !dcfg->engine.on)
return DECLINED;
- /*[eeh] determine translated filename + handler by subrequest
- * _unless_ we're requesting the root page. The root page will
- * generally resolve to the docroot, and that'll allways
- * match in favor of the midgard request => root page
- * unreachable. Another way would be to check for
- * directories, but given the fact that most people
- * (including me) like and use directory => index.html
- * mapping, I'd rather use this hack.
- */
- if (favor_files && r->uri[0] != '\0' && (r->uri[0] != '/' || r->uri[1] != '\0')) {
- if ((subreq = ap_sub_req_lookup_uri(r->uri, r)) != NULL &&
subreq->finfo.st_mode != 0) {
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r,
- "Midgard: file %s exists [%s], not serving from database",
- subreq->filename, subreq->content_type);
- ap_destroy_sub_req(subreq);
- return DECLINED;
- }
-
- ap_destroy_sub_req(subreq);
- }
-
ap_log_rerror(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r,
"midgard_translate_handler(%s, http://%s:%d%s)",
dcfg->parser ? dcfg->parser : default_parser,
@@ -1397,6 +1378,32 @@
ap_get_server_name(r), ap_get_server_port(r));
return DECLINED;
}
+
+ /*[eeh] determine translated filename + handler by subrequest
+ * _unless_ we're requesting the root page. The root page will
+ * generally resolve to the docroot, and that'll allways
+ * match in favor of the midgard request => root page
+ * unreachable. Another way would be to check for
+ * directories, but given the fact that most people
+ * (including me) like and use directory => index.html
+ * mapping, I'd rather use this hack.
+ */
+ urilen = strlen(r->uri);
+ /* remove trailing '/' since prefixes in the midgard database
+ * should not have them
+ */
+ if (urilen > 0 && r->uri[urilen - 1] == '/') { urilen--; }
+ if (favor_files && host.prefix_length != urilen) {
+ if ((subreq = ap_sub_req_lookup_uri(r->uri, r)) != NULL &&
subreq->finfo.st_mode != 0) {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r,
+ "Midgard: file %s exists [%s], not serving from database",
+ subreq->filename, subreq->content_type);
+ ap_destroy_sub_req(subreq);
+ return DECLINED;
+ }
+
+ ap_destroy_sub_req(subreq);
+ }
/* copy found values */
rcfg->host = host.host;
=================================
--
Emiliano
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]