inflate encoded content

Asked by Rob on 2009-12-29

hi Guys

Hope you had a nice Xmas

I am plaing with content adoption adapter, it works just fine except encoded sites. I need to find a way how to decode encoded websites using adapter_modifying.cc

Can anyone help? I have looked for some examples but couldnt find anythings.

Rob

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Rob
Solved:
2010-01-09
Last query:
2010-01-09
Last reply:
Magus (davdeclerck) said : #1

Hi,

Well, as long as you are just "playing" with the adapter, the (probably) simplest solution may just be to remove any Accept-Encoding header from the request, that way the server will always use identity encoding.

In order to achieve this, just locate the following lines in Adapter::Xaction::start() :
 libecap::shared_ptr<libecap::Message> adapted = hostx->virgin().clone();
 Must(adapted != 0);

And add these lines right after :
 if (adapted->header().hasAny(libecap::Name("Accept-Encoding")))
  adapted->header().removeAny(libecap::Name("Accept-Encoding"));

I wouldn't recommend doing this for production use though.

Rob (tenerifemaster) said : #2

Magus,
Thanks a lot! Its a great start for me :)