[Rabbit-dev] FilterHandler is unable to correctly parse some buffer streams

Robert Olofsson robert.olofsson at khelekore.org
Sun Dec 13 15:13:19 CET 2009


On Sat, 12 Dec 2009 21:49:51 +0000
Mindaugas Žakšauskas <mindas at gmail.com> wrote:

> > Rabbit should not normally try to filter this data, if it is then it is
> > doing the
> > wrong thing.
> 
> Yep, I think the fix is necessary (at least in 4.2, haven't got a chance to
> look at 4.3). Something like

When I look at the code and try it out everything seems to work fine.
FilterHandler.setupHandler calls GZipHandler.setupHandler and that will
set mayFilter to false for compressed content.
In FilterHandler.modifyBuffer we check mayFilter and since it is not
true we will just call super.modifyBuffer and return (and that will just
write the buffer out).

> If you set "repack=true" rabbit ought to unpack and filter pages
> > that are gzipped.
> >
> 
> This makes sense only if repack=true *and* compress=true. If compress=false
> and repack=true, browser ends up in "Content Encoding Error" when trying to
> get gzipped stream, such as http://www.guardian.co.uk. Is this expected?

If repack is not working, then we have a bug. I have to check it.

> Also, another question: what is the best way to share data
> between proxy.filter.HttpFilter and proxy.filter.HtmlFilter?
> E.g. say I want to show a nice (HTML) error screen (which I would normally
> do in proxy.filter.HtmlFilter) if user is not authenticated (and that's
> decided in proxy.filter.HttpFilter), instead of just throwing a default HTTP
> 407.
> One way of doing this would be throwing extra rabbit.http.HttpHeader and
> check (also delete?) it later. But is this good enough? Any other options?

I do not think that question makes much sense.
If you want to return a nice error page for unauthorized users you do not 
want to get the real html resource and filter it. 
What we ought to do is to make the error pages use configurable templates.
Currently StandardResponseHeaders is the class that generates the error 
pages and it does not read any templates. So changing that one to read some
template would be a nice thing.

/robo




More information about the Rabbit-dev mailing list