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 05:18:46 -0700 (PDT)

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". 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

-- 
View this message in context: http://www.nabble.com/Couldn%27t-get-Header-value----Error-occured-%22ICAP-protocol-error%22-tp22969759p22969759.html
Sent from the Squid - Development mailing list archive at Nabble.com.
Received on Thu Apr 09 2009 - 12:18:49 MDT

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