perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <>
Subject Re: strange mod_deflate behaviour on binary output
Date Mon, 23 Mar 2009 01:23:49 GMT
On 22/3/09 15:25, Louis-David Mitterrand wrote:
> Hi,
> I noticed something interesting with mod_deflate when serving binary
> content from a mason component:
> 	<%init>
> 	$m->clear_buffer();
> 	$r->content_type("video/mp4");
> 	$r->headers_out->add('Content-length' => -s $file);
> 	$r->sendfile($file);
> 	$m->abort(200);
> 	</%init>
> mod_deflate is enabled with the default:
> 	AddOutputFilterByType DEFLATE text/html text/plain text/xml
> and .md mason components have:
> 	AddType text/html .md
> But when I change the content-type from within the component mod_deflate
> doesn't seem to notice and keeps gzip'ing the video/mp4 output, which
> FlowPlayer doesn't appreciate.
> I certainly could disable mod_deflate and be on my merry way. 
> But I thought I'd ask the modperl list (already posted to mason-users)
> whether this mod_deflate behaviour is expected and/or normal?

Sounds like Mason runs exclusively in the PerlResponse phase, at which
point, AddOutputFilterByType has already decided if it should apply the
filter or not, so it's too late to change that.

One easy way to disable mod_deflate from that point in time, from mason,
would be to do:

$r->subprocess_env('no-gzip' => 1);

Since from mod_deflate.c:

        /* some browsers might have problems, so set no-gzip
         * (with browsermatch) for them
        if (apr_table_get(r->subprocess_env, "no-gzip")) {
            return ap_pass_brigade(f->next, bb);

Give it a try, this is untested!

Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5       m/gozer\@(apache|cpan|ectoplasm)\.org/

View raw message