This is another attempt at fixing mod_autoindex.  This works for me on
my computer, and it explains the problem.  I haven't been able to
actually reproduce the problem, but I have seen the symptoms.  Can
somebody who can reproduce PLEASE test this on their setup.  I am hoping
to setup a failure condition soon so that I can test this myself.

I may commit this either way, because even if this doesn't fix the
problem from apache.org, it does solve a problem with data ordering.

This is the cleanest way I could find to solve the problem, but I am
perfectly willing to listen to other ideas.

Ryan

Index: modules/generators/mod_autoindex.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
retrieving revision 1.102
diff -u -d -b -w -u -r1.102 mod_autoindex.c
--- modules/generators/mod_autoindex.c  20 Mar 2002 17:41:54 -0000
1.102
+++ modules/generators/mod_autoindex.c  5 Apr 2002 06:26:08 -0000
@@ -1017,6 +1017,7 @@
         if (rr->content_type != NULL) {
             if (!strcasecmp(ap_field_noparam(r->pool,
rr->content_type),
                             "text/html")) {
+                ap_filter_t *f;
                 /* Hope everything will work... */
                 emit_amble = 0;
                 emit_H1 = 0;
@@ -1024,6 +1025,22 @@
                 if (! suppress_amble) {
                     emit_preamble(r, title);
                 }
+                /* This is a hack, but I can't find any better way to
do this.
+                 * The problem is that we have already created the
sub-request,
+                 * but we just inserted the OLD_WRITE filter, and the 
+                 * sub-request needs to pass its data through the
OLD_WRITE
+                 * filter, or things go horribly wrong (missing data,
data in
+                 * the wrong order, etc).  To fix it, if you create a 
+                 * sub-request and then insert the OLD_WRITE filter
before you
+                 * run the request, you need to make sure that the
sub-request
+                 * data goes through the OLD_WRITE filter.  Just steal
this 
+                 * code.  The long-term solution is to remove the ap_r*
+                 * functions.
+                 */
+                for (f=rr->output_filters; 
+                     f->frec != ap_subreq_core_filter_handle; f =
f->next);
+                f->next = r->output_filters; 
+             
                 /*
                  * If there's a problem running the subrequest, display
the
                  * preamble if we didn't do it before -- the header
file

----------------------------------------------
Ryan Bloom                  [EMAIL PROTECTED]
645 Howard St.              [EMAIL PROTECTED]
San Francisco, CA 


Reply via email to