On 05/29/2012 09:41 AM, Zaid B. Amireh wrote:
Hello,

I have a content filter module that is operating in a proxy environment, the 
module parses HTML and XML documents and changes quite a bit of content.

The issue I'm facing is handling gzip'ed content, I tried the following 
mod_filter config

===============
FilterDeclare inflate
FilterDeclare mymodule
FilterDeclare deflate

FilterProvider inflate INFLATE resp=Content-Encoding $gzip
FilterProvider mymodule mymodule-filter resp=Content-Type $text/html
FilterProvider deflate DEFLATE resp=Content-Encoding $gzip

FilterTrace inflate 1
FilterTrace deflate 1
FilterTrace mymodule 1

FilterChain inflate mymodule deflate
===============

What is happening is that my module is receiving duplicate buckets, here is a 
snippet from the log

===============
mod_filter.c(117): inflate
mod_filter.c(122): inflate: type: TRANSIENT, length: 1202
mod_filter.c(117): inflate
mod_filter.c(122): inflate: type: FLUSH, length: 0
mod_filter.c(117): mymodule
mod_filter.c(122): mymodule: type: HEAP, length: 3746
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(117): inflate
mod_filter.c(122): inflate: type: TRANSIENT, length: 1400
mod_filter.c(117): inflate
mod_filter.c(122): inflate: type: TRANSIENT, length: 1520
mod_filter.c(117): mymodule
mod_filter.c(122): mymodule: type: HEAP, length: 3746
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 8096
...
....
.....
mod_deflate.c(1113): Zlib: Inflated 9637 to 41199 : URL /
mod_filter.c(117): mymodule
mod_filter.c(122): mymodule: type: HEAP, length: 3746
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 8096
mod_filter.c(122): mymodule: type: HEAP, length: 3829
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 5008
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 5412
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 6947
mod_filter.c(122): mymodule: type: FLUSH, length: 0
mod_filter.c(122): mymodule: type: HEAP, length: 8096
mod_filter.c(122): mymodule: type: HEAP, length: 65
mod_filter.c(122): mymodule: type: EOS, length: 0
mod_filter.c(117): deflate
mod_filter.c(122): deflate: type: TRANSIENT, length: 198242
===============

The first bucket of size 3746 was received 7 times by the module, the second 
bucket of 8096 was received 6 times and so on.

I'm really stumped as to what is causing this behavior, any ideas?

Could it be that you are intercepting the subrequest and seeing the content from that in your filter? I am not sure how mod_proxy works (I've not actually looked at the code), but odds are that it is creating a sub request, which will also have filters in it, and that is what you are also seeing.

Joe

virtually yours
Zaid

Reply via email to