Content Encoding Error using firefox

Asked by Ivan Tsvetanov on 2010-08-20

[root@seducer squid]# sudo -u squid sbin/squid -v
Squid Cache: Version 3.1.6
configure options: '--prefix=/opt/squid' '--enable-ecap' --with-squid=/root/make/squid-3.1.6 --enable-ltdl-convenience

ecap_enable on
loadable_modules /usr/local/lib/
ecap_service eReqmod reqmod_precache 0 ecap://
ecap_service eRespmod respmod_precache 0 ecap://
adaptation_service_set reqFilter eReqmod
adaptation_service_set respFilter eRespmod
adaptation_access respFilter allow all
adaptation_access reqFilter allow all

Using the ecap_adapter_modifying example module I'm failing to adapt the content of a webpage.
In Firefox I'm getting:
Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
    * Please contact the website owners to inform them of this problem.
And does not load the page.
With lynx:
   Bad HTML...
But it loads the page with lynx.
I guess something is wrong with the Content-Encoding Header.
What should i do to fix the Content-Encoding?

I've applied the patch about commenting assert() in libecap so squid does not die after short time.

I'm not too much into C++. Just C.
At all I want to:
    send the exact same HTTP Headers
    modify some of the <html></html>

Any ideas are great appreciated!

Question information

English Edit question
eCAP Edit question
No assignee Edit question
Last query:
Last reply:
Alex Rousskov (rousskov) said : #1

My guess is that you are dealing with a gzipped or otherwise compressed response. To modify such a response you need to uncompress it first, modify it, and then, optionally, compress it back. The modifying adapter sample is too dumb to handle this.

You may also configure the host application to not send compressed or otherwise undesirable content to your eCAP adapter.

Please keep in mind that to preserve the message headers intact while modifying the message body, your modifications must not alter content length and content encoding. I am not sure that header preservation is a worthwhile goal though because the host application usually alters them anyway (e.g., adding Via).

In general, I would recommend capturing HTTP response packets received and sent by Squid. Using something like "follow TCP stream" mode in Wireshark, you will be able to compare virgin and adapted HTTP responses which is likely to shed more light on the issue. You can also study debugging logs, but that is often more difficult.

Good luck!

Sandeep Kuttal (skuttal) said : #2

Hi Ivan,

Yes I was able to get the virgin body messages... Hope I am writing to correct place. Let me know in details your question?


Sandeep Kuttal (skuttal) said : #3

Hi Ivan,

Have you applied all the patches. Try to remove bugs, Check bugs for ecap and apply all the patches to your code. the code contains already code to get the chunks.


Can you help with this problem?

Provide an answer of your own, or ask Ivan Tsvetanov for more information if necessary.

To post a message you must log in.