[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] AddOutputFilterByType issues.

From: Justin Erenkrantz <jerenkrantz_at_apache.org>
Date: 2002-04-01 23:56:01 CEST

I've been partly out of it lately, but I think there is a problem
with AddOutputFilterByType. Since ap_set_content_type() can
be called arbitrarily many times, it will try to add each filter
as directed by AddOutputFilterByType on each call. For certain
filters, that isn't a terrifically good idea - such as mod_deflate.
For others (say mod_include), this is okay.

We can't compress a file twice (and is causing problems with
Subversion right now), but that's what we are doing now -
mod_deflate is in the chain twice. mod_mime calls
ap_set_content_type twice in its normal execution (I dunno why,
but that's sucky).

I'm using the following patch to minimize how often
ap_add_output_filters_by_type is called. This fixes the symptom,
but perhaps we should think of a better solution? Perhaps only
allow AP_FTYPE_RESOURCE filters to be added multiple times, and
AP_FTYPE_CONTENT_SET or higher can only be added once?

Thoughts? -- justin

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.406
diff -u -r1.406 http_protocol.c
--- modules/http/http_protocol.c 29 Mar 2002 08:17:22 -0000 1.406
+++ modules/http/http_protocol.c 1 Apr 2002 21:43:07 -0000
@@ -1272,14 +1272,16 @@
 
 AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct)
 {
- r->content_type = ct;
+ if (!r->content_type || strcmp(r->content_type, ct)) {
+ r->content_type = ct;
 
- /* Insert filters requested by the AddOutputFiltersByType
- * configuration directive. Content-type filters must be
- * inserted after the content handlers have run because
- * only then, do we reliably know the content-type.
- */
- ap_add_output_filters_by_type(r);
+ /* Insert filters requested by the AddOutputFiltersByType
+ * configuration directive. Content-type filters must be
+ * inserted after the content handlers have run because
+ * only then, do we reliably know the content-type.
+ */
+ ap_add_output_filters_by_type(r);
+ }
 }
 
 typedef struct header_filter_ctx {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 1 23:56:47 2002

This is an archived mail posted to the Subversion Dev mailing list.