mod_gzip Calling Perl Handlers Twice

pudge on 2003-11-14T19:22:42

With mod_gzip installed, my PerlAccessHandler handlers get called twice. I dislike this. Does anyone know what the heck is going on and how to fix it?


Replace ?

rafael on 2003-11-14T20:12:37

Replace mod_gzip by a perl-based solution ? there are several ones on CPAN.

Re:Replace ?

pudge on 2003-11-14T20:27:57

Any recommendations? Apache::Dynagzip looks promising, as do Apache::Compress and Apache::GzipChain. I like Apache::Compress as I know Ken, and it looks simple, and handles files as well as dynamic content from mod_perl (does GzipChain do that? not sure). Dynagzip appears to send data in chunks, which is a nice thing, but I don't know the author and it looks more complicated to set up.

Re:Replace ?

rafael on 2003-11-14T20:39:06

GzipChain is designed to be stackable, if your mod_perl supports it. In fact the bug you reported sounds like mod_gzip not correctly passing to the next handler, hence my proposal to use an alternative.

SubRequests?

Dom2 on 2003-11-17T12:50:09

I would hazard a guess that your PerlAccessHandler is being called as part of a subrequest the second time. Try adding something like return unless $r->is_main to the top of your handler and see if it makes a difference.

I've just been bitten by something similiar, but the other way around. mod_ssl doesn't set up environment variables until the fixup phase. Unfortunately, I needed them in the PerlAuthenHandler phase. So I had to run a subrequest and look at the environment variables for that instead. This is actually mentioned in the eagle book, but it's only one paragraph in 600+ pages. :-)

-Dom

Re:SubRequests?

pudge on 2003-11-17T20:57:06

I would hazard a guess that your PerlAccessHandler is being called as part of a subrequest the second time. Try adding something like return unless $r->is_main to the top of your handler and see if it makes a difference.

Yeah, we already have that in there. At one point some time ago we didn't, but it's been in there for some time now.