Re: Couldn't get Header value -- Error occured "ICAP protocol error"

From: Ali Muhammad Qaim Khani <ali.mohammad_at_tenpearls.com>
Date: Thu, 9 Apr 2009 22:51:07 -0700 (PDT)

Alex Rousskov wrote:
>
> On 04/09/2009 06:18 AM, Ali Muhammad Qaim Khani wrote:
>> Hi All,
>>
>> I am new to ECAP lib and working on sample content adapter
>> "ecap_adapter_sample-0.0.2". My packages and system specs are:
>>
>> 1. OS: Centos5.0
>> 2. Squid: 3.1.0.6
>> 3. libecap: 0.0.2
>>
>> I am trying to get the header field for a browser request, say "Host:
>> www.google.com", where name is "Host" and value is "www.google.com".
>
> I have made some suggestions when I answered the same question at
> https://answers.launchpad.net/ecap/+question/66951
>
> Please follow those suggestions. Until the culprit is found, you can
> post either here or on Launchpad, whichever works best for you.
> Launchpad eCAP answers are probably easier for other folks to find in
> the future than a squid-dev thread.
>
> Thank you,
>
> Alex.
>
>
>> My code
>> is as:
>>
>> void Adapter::Xaction::start() {
>> Must(hostx);
>> if (hostx->virgin().body()) {
>> receivingVb = opOn;
>> hostx->vbMake(); // ask host to supply virgin body
>> } else {
>> receivingVb = opNever;
>> }
>>
>> libecap::shared_ptr<libecap::Message> adapted = hostx->virgin().clone();
>> Must(adapted != 0);
>>
>> adapted->header().removeAny(libecap::headerContentLength);
>>
>> // add a custom header
>> static const libecap::Name name("X-Ecap");
>> const libecap::Header::Value value =
>> libecap::Area::FromTempString(libecap::MyHost().uri());
>> adapted->header().add(name, value);
>>
>> cout << "1. I am at "<< __LINE__ << endl;
>>
>> const libecap::Name name2("Host");
>> libecap::Header::Value value1 ;
>>
>> cout << "2. I am at "<< __LINE__ << endl;
>> value1 = adapted->header().value( name2 );
>>
>> if (!adapted->body()) {
>> sendingAb = opNever; // there is nothing to send
>> lastHostCall()->useAdapted(adapted);
>> } else {
>> hostx->useAdapted(adapted);
>> }
>> }
>>
>> When the execution reaches at line "cout << "2. I am at "<< __LINE__ <<
>> endl;", It displays the following error on browser:
>>
>> ------------------
>> ICAP protocol error.
>> The system returned: [No Error]
>> This means that some aspect of the ICAP communication failed.
>> Some possible problems are:
>> * The ICAP server is not reachable.
>> * An Illegal response was received from the ICAP server.
>> ------------------
>> please suggest me what I am doing wrong? I think there is a bug in
>> value()
>> function.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks in advance.
>> Ali Muhammad
>

Thanks Alex for quick response
I will keep posting my questions on 'Launchpad eCAP forum'.

Thanks
Ali Muhamamd

-- 
View this message in context: http://www.nabble.com/Couldn%27t-get-Header-value----Error-occured-%22ICAP-protocol-error%22-tp22969759p22983465.html
Sent from the Squid - Development mailing list archive at Nabble.com.
Received on Fri Apr 10 2009 - 05:51:15 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 10 2009 - 12:00:04 MDT