httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <...@apache.org>
Subject Re: ordering output filters
Date Mon, 14 Mar 2011 17:31:13 GMT

On 14 Mar 2011, at 15:54, Joshua Marantz wrote:


>  if (mod_includes was enabled in this config) {
>    re-insert mod_pagespeed at the end of the AP_FTYPE_RESOURCE chain
>    pass the buckets to mod_includes
>  }

Not good.  Modules are there to serve the server admin, not to enslave him.
In general they shouldn't touch each other (except through public APIs)
nor second-guess a server admin.

In practical terms, what about a third-party module that parses comments?
If includes get special treatment but others don't, you're making things horribly
confusing for your users.

A traditional but only slightly less ugly hack would be to declare your filter
AP_FTYPE_RESOURCE+1.  That also leaves an admin the possibility of
overriding it.

> Or can we, at init time, call server APIs to tweak the filter order?  Is
> there any filter that seeks to do that somehow?

You could take a look at how mod_proxy_html inserts mod_xml2enc
if available.

> A third idea is to exploit the fact that INCLUDES adds itself to the output
> chain via
>   ap_hook_fixups(include_fixup, NULL, NULL, APR_HOOK_LAST);
> where include_fixup() does ap_add_output_filter("INCLUDES", NULL, r,
> r->connection);

Why not an insert_filter hook?

That would be the right place to go, but then be sure to document exactly
how it works and what other modules will be auto-configured.

-- 
Nick Kew

Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html


Mime
View raw message