httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterling <sterl...@covalent.net>
Subject [PATCH] OLD_WRITE filter assumes it is first in the output filters list
Date Thu, 15 Nov 2001 02:10:59 GMT
Hi -

I am not too familiar with the OLD_WRITE filter, but I have run into an
interesting situation.  I want to ensure that my filter is before any of
the FTYPE_CONTENT filters.  The only way to do this is to make mine
FTYPE_CONTENT-1.  However, OLD_WRITE assumes (since it is set as
FTYPE_CONTENT-1) that it is the first filter in output_filters (and then
assumes that in fact it is the first one without checking).

Maybe OLD_WRITE should be set to 0 (or AP_FTYPE_FIRST or something) so you
can have more fine grained filter ordering.   Here is a patch that
implements that (and also gets rid of an assumption in buffer_output).

As I said, not sure if this is the right fix, any suggestions (MAYBE an
FTYPE_FIRST instead of FTYPE_CONTENT-1)?

thanks

sterling

Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.88
diff -u -r1.88 core.c
--- server/core.c	2001/11/08 14:29:36	1.88
+++ server/core.c	2001/11/15 00:46:12
@@ -3301,7 +3301,7 @@
     ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter,
                               AP_FTYPE_CONTENT);
     ap_old_write_func = ap_register_output_filter("OLD_WRITE",
-                                   ap_old_write_filter, AP_FTYPE_CONTENT - 1);
+                                   ap_old_write_filter, 0);
 }

 AP_DECLARE_DATA module core_module = {
Index: server/protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.51
diff -u -r1.51 protocol.c
--- server/protocol.c	2001/11/07 05:41:22	1.51
+++ server/protocol.c	2001/11/15 00:46:12
@@ -1069,8 +1069,8 @@
     if (f == NULL) {
         /* our filter hasn't been added yet */
         ctx = apr_pcalloc(r->pool, sizeof(*ctx));
-        ap_add_output_filter("OLD_WRITE", ctx, r, r->connection);
-        f = r->output_filters;
+        f = ap_add_output_filter("OLD_WRITE", ctx, r, r->connection);
+        AP_DEBUG_ASSERT(f);
     }

     /* if the first filter is not our buffering filter, then we have to


Mime
View raw message