You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Vincent Veyron <vv...@wanadoo.fr> on 2015/05/27 20:48:33 UTC

Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Hi list,

My application has the following general configuration, which works fine with 2.2 : a perl script generates the 'core' html content for a given location, and a filter adds some additional generic content. The basic Apache configuration directives are :
 
 <Location /base/agenda_general>

  SetHandler perl-script

   Marica::Base::Agenda::agenda_general

 </location>

 <LocationMatch \/base\/>

  PerlOutputFilterHandler Marica::Base::Filter::html_head_and_tail

 </LocationMatch>

When I upgrade to Apache 2.4, this happens :

http://imgur.com/5WkhL8P

The filter appears to get the encoding wrong when processing the content of the PerlResponseHandler (the garbled part on the right), while the part that it adds (the menu on the left) is displayed correctly.

Code for the PerlOutputFilterHandler is here :

http://pastebin.com/G6QTBNJL

Code for the PerlResponseHandler is here :

http://pastebin.com/JqLT7aKU

Any idea of what might cause this?


-- 
					Salutations, Vincent Veyron 

https://legalcase.libremen.com/ 
Legal case, contract and insurance claim management software

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
On Wed, 3 Jun 2015 17:47:25 +0200
Vincent Veyron <vv...@wanadoo.fr> wrote:

> 
> FYI, the problem disappears when using mod_perl-2.0.9 RC2. 
> 

Scratch this, I had forgotten to enable mod_deflate. It's still there.

Bummer.

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
On Thu, 28 May 2015 09:06:13 -0400
"Kevin A. McGrail" <KM...@PCCC.com> wrote:

> On 5/27/2015 6:45 PM, Vincent Veyron wrote:
> >> and what version of MP are you using?

Hi,

FYI, the problem disappears when using mod_perl-2.0.9 RC2. 

All is well.

-- 
					Salutations, Vincent Veyron 

https://legalcase.libremen.com/ 
Legal case, contract and insurance claim management software

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Jie Gao <J....@sydney.edu.au>.
Hi Vincent

Thanks for sharing your solution.

Regards,

Jie 

* Vincent Veyron <vv...@wanadoo.fr> wrote:

> Date: Sun, 29 Nov 2015 19:15:20 +0100
> From: Vincent Veyron <vv...@wanadoo.fr>
> To: Jie Gao <J....@sydney.edu.au>
> CC: modperl@perl.apache.org
> Subject: Re: Upgrade to Apache 2.4 breaks encoding in a
>  PerlOutputFilterHandler
> X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.10; i486-pc-linux-gnu)
> 
> On Sun, 29 Nov 2015 19:59:28 +1100
> Jie Gao <J....@sydney.edu.au> wrote:
> > 
> > Well, check out this: https://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_ .
> > 
> 
> Hi Jie,
> 
> Yes, the instructions on this page work well; but with those, I need to add 'SetOutputFilter DEFLATE' in every virtual host.
> 
> I use a global configuration in deflate.conf, and got it to work in 2.4 by replacing :
> 
> #               AddOutputFilterByType DEFLATE text/html text/plain text/xml                                            
> 
> with this:
>                                                                                                                    
> FilterDeclare   COMPRESS CONTENT_SET
> FilterProvider  COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m#^text/(html|plain)#"
> FilterChain     COMPRESS
> FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
> 
> Which places mod_deflate after my PerlOutputFilterHandler in the chain.
> 
> I was surprised nobody else had the problem before, though?
> 
> -- 
> 					Bien à vous, Vincent Veyron 
> 
> https://marica.fr/ 
> Suivi des contentieux juridiques, des sinistres d'assurance et des contrats

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
On Sun, 29 Nov 2015 18:18:21 +0000
Dr James Smith <js...@sanger.ac.uk> wrote:

> I knew it was a problem - but due to our set up of front end proxy / 
> mod_perl then this wasn't an issue.. the mod_perl server handles the 
> filter - and the front end proxy does the gzipping (we use Brocade 
> Traffic Mangers and Apache in different places) - in most production 
> environments this is the "usual" setup...
> 

Ha, that would explain it. Thanks for the heads up.

My site is low traffic, so I only use one Apache server for everything.


-- 
					Bien à vous, Vincent Veyron 

https://marica.fr/ 
Suivi des contentieux juridiques, des sinistres d'assurance et des contrats

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Dr James Smith <js...@sanger.ac.uk>.
I knew it was a problem - but due to our set up of front end proxy / 
mod_perl then this wasn't an issue.. the mod_perl server handles the 
filter - and the front end proxy does the gzipping (we use Brocade 
Traffic Mangers and Apache in different places) - in most production 
environments this is the "usual" setup...

On 29/11/2015 18:15, Vincent Veyron wrote:
> On Sun, 29 Nov 2015 19:59:28 +1100
> Jie Gao <J....@sydney.edu.au> wrote:
>> Well, check out this: https://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_ .
>>
> Hi Jie,
>
> Yes, the instructions on this page work well; but with those, I need to add 'SetOutputFilter DEFLATE' in every virtual host.
>
> I use a global configuration in deflate.conf, and got it to work in 2.4 by replacing :
>
> #               AddOutputFilterByType DEFLATE text/html text/plain text/xml
>
> with this:
>                                                                                                                     
> FilterDeclare   COMPRESS CONTENT_SET
> FilterProvider  COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m#^text/(html|plain)#"
> FilterChain     COMPRESS
> FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
>
> Which places mod_deflate after my PerlOutputFilterHandler in the chain.
>
> I was surprised nobody else had the problem before, though?
>



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
On Sun, 29 Nov 2015 19:59:28 +1100
Jie Gao <J....@sydney.edu.au> wrote:
> 
> Well, check out this: https://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_ .
> 

Hi Jie,

Yes, the instructions on this page work well; but with those, I need to add 'SetOutputFilter DEFLATE' in every virtual host.

I use a global configuration in deflate.conf, and got it to work in 2.4 by replacing :

#               AddOutputFilterByType DEFLATE text/html text/plain text/xml                                            

with this:
                                                                                                                   
FilterDeclare   COMPRESS CONTENT_SET
FilterProvider  COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m#^text/(html|plain)#"
FilterChain     COMPRESS
FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no

Which places mod_deflate after my PerlOutputFilterHandler in the chain.

I was surprised nobody else had the problem before, though?

-- 
					Bien à vous, Vincent Veyron 

https://marica.fr/ 
Suivi des contentieux juridiques, des sinistres d'assurance et des contrats

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Jie Gao <J....@sydney.edu.au>.
* Vincent Veyron <vv...@wanadoo.fr> wrote:

> Date: Fri, 29 May 2015 19:13:50 +0200
> From: Vincent Veyron <vv...@wanadoo.fr>
> To: "Kevin A. McGrail" <KM...@PCCC.com>
> CC: modperl@perl.apache.org
> Subject: Re: Upgrade to Apache 2.4 breaks encoding in a
>  PerlOutputFilterHandler
> X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.10; i486-pc-linux-gnu)
> 
> 
> I found the problem : it appears mod_deflate now runs _before_ my PerlOutputFilterHandler, which then gets gzip encoded content. 
> 
> Disabling mod_deflate fixes it, but this was not necessary in Apache 2.2. Something must have changed in the priority type of the modules.

Well, check out this: https://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_ .


Regards,


Jie

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
I found the problem : it appears mod_deflate now runs _before_ my PerlOutputFilterHandler, which then gets gzip encoded content. 

Disabling mod_deflate fixes it, but this was not necessary in Apache 2.2. Something must have changed in the priority type of the modules.

-- 
					Salutations, Vincent Veyron 

https://legalcase.libremen.com/ 
Legal case, contract and insurance claim management software

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 5/27/2015 6:45 PM, Vincent Veyron wrote:
>> and what version of MP are you using?
> #dpkg -l *mod-perl*
> libapache2-mod-perl2                      2.0.9~1624218-2           i386
OK, I can't tell if that's older or newer than rc1 but it's at least not 
the 2.0.7 issue I had to deal with recently.

Regards,
KAM

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by Vincent Veyron <vv...@wanadoo.fr>.
On Wed, 27 May 2015 15:03:39 -0400
"Kevin A. McGrail" <KM...@PCCC.com> wrote:

Hi Kevin,

> How did you upgrade to 2.4 

I use the current debian stable (wheezy until now); I followed this to the t :

https://www.debian.org/releases/jessie/amd64/release-notes/ch-upgrading.en.html

The crux of it being to run apt-get upgrade, then apt-get dist-upgrade

>and what version of MP are you using?

#dpkg -l *mod-perl*
libapache2-mod-perl2                      2.0.9~1624218-2           i386 



-- 
					Salutations, Vincent Veyron 

https://legalcase.libremen.com/ 
Legal case, contract and insurance claim management software

Re: Upgrade to Apache 2.4 breaks encoding in a PerlOutputFilterHandler

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
 > When I upgrade to Apache 2.4, this happens

How did you upgrade to 2.4 and what version of MP are you using?

I ask because I've been running into distros running MP 2.0.7 with 
Apache httpd 2.4 so I want to help rule out that issue.

Regards,
KAM