httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: patch to mod_dir.c (fwd)
Date Fri, 06 Mar 1998 04:39:32 GMT
On Thu, 5 Mar 1998, Brian Behlendorf wrote:

> 
> I think we can give that a firm -1.
> 
> 	Brian
> 
> At 01:38 PM 3/4/98 +0000, you wrote:
> >
> >bwaaaahahahaha.
> >
> >---------- Forwarded message ----------
> >Date: Tue, 3 Mar 1998 18:11:19 +0000
> >From: trp@hagar.cyberoptics.com
> >To: apache-bugs@apache.org
> >Subject: patch to mod_dir.c
> >
> >I wanted to have support to see a directory listing even when
> >the index file existed.  The following is a patch to the mod_dir.c
> >file that will show the directory listing if the URI ends with
> >two slashes.

I dunno... I wouldn't do it that way.  But it's certainly hardly any
changes to the code to support this sort of thing.

AddHandler autoindex dir

touch htdocs/index.dir

and then I can have index.shtml which does a #include virtual="index.dir". 

Why would I want that?  Because mod_autoindex sucks and doesn't use
multiviewed negotiated subrequests for README and HEADER and such.  Look
at the code, it fakes the whole thing.  For example, I can't use
mod_include and mod_autoindex together right now.

Not that index.dir is the right way to fix it. 

Dean

Index: modules/standard/mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.69
diff -u -r1.69 mod_autoindex.c
--- mod_autoindex.c	1998/03/06 04:25:45	1.69
+++ mod_autoindex.c	1998/03/06 04:34:00
@@ -1153,9 +1153,18 @@
 	 * Fixing this in the sub_req_lookup functions themselves is difficult,
 	 * and would probably break virtual includes...
 	 */
-
 	if (r->filename[strlen(r->filename) - 1] != '/') {
-	    r->filename = pstrcat(r->pool, r->filename, "/", NULL);
+	    if (!S_ISDIR(r->finfo.st_mode)) {
+		r->filename = make_dirstr_parent(r->pool, r->filename);
+		if (stat(r->filename, &r->finfo) == -1) {
+		    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
+			"unable to stat(%s)", r->filename);
+		    return HTTP_INTERNAL_SERVER_ERROR;
+		}
+	    }
+	    else {
+		r->filename = pstrcat(r->pool, r->filename, "/", NULL);
+	    }
 	}
 	return index_directory(r, d);
     }
@@ -1170,6 +1179,7 @@
 static handler_rec autoindex_handlers[] =
 {
     {DIR_MAGIC_TYPE, handle_autoindex},
+    {"autoindex", handle_autoindex},
     {NULL}
 };
 



Mime
View raw message