You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nikolas Coukouma <at...@atrus.org> on 2007/08/06 06:50:59 UTC

mod_deflate: Inflate output filter checks

Right now the inflate filter only checks to see if the Content-Encoding
in the headers table contains gzip. It does not check
r->content_encoding. This breaks it with mod_mime (among other things).

The fix is straightforward enough, and I've attached a patch to the bug.
I've tested it to (try to) make sure it actually fixes the problem and
doesn't break deflate output.

Example test/use case:

# All files from this location have been compressed
<Location "/zipped">
  AddEncoding gzip .html .txt
</Location>
# Automatically decompress things for clients that don't support gzip
Header add Vary Accept-Encoding
FilterDeclare gzip CONTENT_SET
FilterProvider gzip inflate req=Accept-Encoding $!gzip
FilterChain gzip

Bugzilla entry:
http://issues.apache.org/bugzilla/show_bug.cgi?id=42993
Feedback, commments, etc. welcomed :) A commit or two would be nice ;)

Cheers,
-Nikolas


Re: mod_deflate: Inflate output filter checks

Posted by Nikolas Coukouma <at...@atrus.org>.
Nick Kew wrote:
> On Mon, 06 Aug 2007 00:50:59 -0400
> Nikolas Coukouma <at...@atrus.org> wrote:
>   
>> Right now the inflate filter only checks to see if the
>> Content-Encoding in the headers table contains gzip. It does not check
>> r->content_encoding. This breaks it with mod_mime (among other
>> things).
>>     
>
> Please refer to recent discussion, in particular
> http://marc.info/?l=apache-httpd-dev&m=118622934222115&w=2
> and take a look at mod_deflate in /trunk/ and STATUS in 2.2.
> Any thoughts there
Thanks for the pointers; I wasn't sure what was worth reading ;)

I generally agree with you. mod_deflate has several problems, sadly, and
it's sensible to take on one (or two) at a time.

Althogh I glanced at the other mod_deflate tickets, I still haven't
given much thought to them yet. For the content encoding issue ....

Immediate (perhaps suitable for backport to 2.2.x?):
Make all three mod_deflate filters use the check_gzip function for on
the headers table. The output filters still check r->content_encoding;
use another static function that does that common task and calls the
check_gzip (or maybe have check_gzip take the request intead of the
headers table and then a flag for checking input or output).

(Sorry, I have some ants in my pants about making this at least mostly
work in a relase or at least real-soon-trunk version. I don't know if
that's feasible)

Bit longer: (please excuse any ignorance on my part here)
I like the idea of adding a phase/filter that would combine the
(seemingly) legacy r->content_encoding with the header table. Precedence
seems to be a bit of an issue (thoughts? new or old). For marvelous
compatability, these fields could be mirrored after each filter. This
seems worth attempting/fiddling-with in trunk; it would provide
backwards compatability while ensuring that the headers table is usable.

Alternatively, maybe the filters should be slowly updated to use
accessor functions that would do the update lazily. This might be better
from performance, but doesn't seem to really address (what I see as) the
problem: there's two places to store the value for the same key.

Even longer:
My curent feeling is that, ultimately, content_encoding should be
deprecated in favor of the request header tables. I imagine this would
break a lot of third-party modules and I although I see it as desirable
from where I am, I don't know if it's a good direction to head in.

-Nikolas


Re: mod_deflate: Inflate output filter checks

Posted by Nick Kew <ni...@webthing.com>.
On Mon, 06 Aug 2007 00:50:59 -0400
Nikolas Coukouma <at...@atrus.org> wrote:

> Right now the inflate filter only checks to see if the
> Content-Encoding in the headers table contains gzip. It does not check
> r->content_encoding. This breaks it with mod_mime (among other
> things).

Please refer to recent discussion, in particular
http://marc.info/?l=apache-httpd-dev&m=118622934222115&w=2
and take a look at mod_deflate in /trunk/ and STATUS in 2.2.
Any thoughts there?


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/