You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1998/03/04 14:38:20 UTC
patch to mod_dir.c (fwd)
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.
------begin
--- mod_dir.c.orig Tue Mar 3 11:12:48 1998
+++ mod_dir.c Tue Mar 3 12:07:23 1998
@@ -780,6 +780,7 @@
const char *names_ptr = d->index_names ? d->index_names :
DEFAULT_INDEX;
int allow_opts = allow_options (r);
int error_notfound = 0;
+ int n;
if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
char* ifile;
@@ -801,7 +802,14 @@
*/
r->filename = pstrcat (r->pool, r->filename, "/", NULL);
-
+
+ /* trp@cyberoptics.com 3/3/98
+ *
+ * check for double slashes at the end -- if so do a directory
listing
+ */
+ n=strlen(r->uri);
+ if ((r->uri[n-1]=='/') && (r->uri[n-2]=='/')) { names_ptr=""; }
+
while (*names_ptr) {
char *name_ptr = getword_conf (r->pool, &names_ptr);
------end
-----------------------------------------------------------------------
win95 - Where do you want to go today, since you can't do any work?
EXPERIENCE Linux -- http://www.redhat.com
-----------------------------------------------------------------------
Troy R. Pesola trp@cyberoptics.com
PGP key available at http://www.cyberoptics.com/~trp/pgpkey.html
CyberOptics Corp. 612)542-5000
-----------------------------------------------------------------------
Re: patch to mod_dir.c (fwd)
Posted by Dean Gaudet <dg...@arctic.org>.
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}
};
Re: patch to mod_dir.c (fwd)
Posted by Marc Slemko <ma...@worldgate.com>.
On Thu, 5 Mar 1998, Brian Behlendorf wrote:
>
> I think we can give that a firm -1.
Hey, Roxen has that... "feature". Serious.
>
> 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.
> >
> >------begin
> >--- mod_dir.c.orig Tue Mar 3 11:12:48 1998
> >+++ mod_dir.c Tue Mar 3 12:07:23 1998
> >@@ -780,6 +780,7 @@
> > const char *names_ptr = d->index_names ? d->index_names :
> >DEFAULT_INDEX;
> > int allow_opts = allow_options (r);
> > int error_notfound = 0;
> >+ int n;
> >
> > if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
> > char* ifile;
> >@@ -801,7 +802,14 @@
> > */
> >
> > r->filename = pstrcat (r->pool, r->filename, "/", NULL);
> >-
> >+
> >+ /* trp@cyberoptics.com 3/3/98
> >+ *
> >+ * check for double slashes at the end -- if so do a directory
> >listing
> >+ */
> >+ n=strlen(r->uri);
> >+ if ((r->uri[n-1]=='/') && (r->uri[n-2]=='/')) { names_ptr=""; }
> >+
> > while (*names_ptr) {
> >
> > char *name_ptr = getword_conf (r->pool, &names_ptr);
> >------end
> >
> >-----------------------------------------------------------------------
> > win95 - Where do you want to go today, since you can't do any work?
> > EXPERIENCE Linux -- http://www.redhat.com
> >-----------------------------------------------------------------------
> >Troy R. Pesola trp@cyberoptics.com
> >PGP key available at http://www.cyberoptics.com/~trp/pgpkey.html
> >CyberOptics Corp. 612)542-5000
> >-----------------------------------------------------------------------
> >
> >
> --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> specialization is for insects brian@organic.com
>
Re: patch to mod_dir.c (fwd)
Posted by Brian Behlendorf <br...@organic.com>.
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.
>
>------begin
>--- mod_dir.c.orig Tue Mar 3 11:12:48 1998
>+++ mod_dir.c Tue Mar 3 12:07:23 1998
>@@ -780,6 +780,7 @@
> const char *names_ptr = d->index_names ? d->index_names :
>DEFAULT_INDEX;
> int allow_opts = allow_options (r);
> int error_notfound = 0;
>+ int n;
>
> if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
> char* ifile;
>@@ -801,7 +802,14 @@
> */
>
> r->filename = pstrcat (r->pool, r->filename, "/", NULL);
>-
>+
>+ /* trp@cyberoptics.com 3/3/98
>+ *
>+ * check for double slashes at the end -- if so do a directory
>listing
>+ */
>+ n=strlen(r->uri);
>+ if ((r->uri[n-1]=='/') && (r->uri[n-2]=='/')) { names_ptr=""; }
>+
> while (*names_ptr) {
>
> char *name_ptr = getword_conf (r->pool, &names_ptr);
>------end
>
>-----------------------------------------------------------------------
> win95 - Where do you want to go today, since you can't do any work?
> EXPERIENCE Linux -- http://www.redhat.com
>-----------------------------------------------------------------------
>Troy R. Pesola trp@cyberoptics.com
>PGP key available at http://www.cyberoptics.com/~trp/pgpkey.html
>CyberOptics Corp. 612)542-5000
>-----------------------------------------------------------------------
>
>
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
specialization is for insects brian@organic.com
Re: patch to mod_dir.c (fwd)
Posted by Dean Gaudet <dg...@arctic.org>.
A small tweak to mod_autoindex to use make_dirstr_parent() would result in
the ability to use AddType to cause directory indexes. Like this:
AddType httpd/directory index
Then if you refer to /abc/foo.index where foo is a 0 length file it would
cause an index to be generated.
Dean
On Wed, 4 Mar 1998, Rob Hartill 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.
>
> ------begin
> --- mod_dir.c.orig Tue Mar 3 11:12:48 1998
> +++ mod_dir.c Tue Mar 3 12:07:23 1998
> @@ -780,6 +780,7 @@
> const char *names_ptr = d->index_names ? d->index_names :
> DEFAULT_INDEX;
> int allow_opts = allow_options (r);
> int error_notfound = 0;
> + int n;
>
> if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
> char* ifile;
> @@ -801,7 +802,14 @@
> */
>
> r->filename = pstrcat (r->pool, r->filename, "/", NULL);
> -
> +
> + /* trp@cyberoptics.com 3/3/98
> + *
> + * check for double slashes at the end -- if so do a directory
> listing
> + */
> + n=strlen(r->uri);
> + if ((r->uri[n-1]=='/') && (r->uri[n-2]=='/')) { names_ptr=""; }
> +
> while (*names_ptr) {
>
> char *name_ptr = getword_conf (r->pool, &names_ptr);
> ------end
>
> -----------------------------------------------------------------------
> win95 - Where do you want to go today, since you can't do any work?
> EXPERIENCE Linux -- http://www.redhat.com
> -----------------------------------------------------------------------
> Troy R. Pesola trp@cyberoptics.com
> PGP key available at http://www.cyberoptics.com/~trp/pgpkey.html
> CyberOptics Corp. 612)542-5000
> -----------------------------------------------------------------------
>
>