My application (S60 2.1) is getting a HTTP response from a custom server that provides a custom response header, and I am having a problem retreiving the value of that header.


In the MHFRunL method when I receive the case:

case THTTPEvent::EGotResponseHeaders:

I iterate through the response headers and can see that the custom response header is not captured (although i can see from the server that it is sent). The code that I am using to iterate through the response headers is pasted below. Is there something that I need to do to force the session to capture a custom response header not in the standard stringpool?? I tried calling StringPool.OpenStringL() with the name of the custom response header before the request is sent, but no luck. Anybody got any ideas? Thanks.


Code to iterate through response headers:
RStringPool strP = iSession.StringPool();
RHTTPHeaders hdr = aTransaction.Response().GetHeaderCollection();

THTTPHdrFieldIter it = headers.Fields();
TBuf<256> fieldName16;
TBuf<256> fieldVal16;

while (it.AtEnd() == EFalse)
{
RStringTokenF fieldName = it();
RStringF fieldNameStr = strP.StringF(fieldName);
THTTPHdrVal fieldVal;

if (hdr.GetField(fieldNameStr,0,fieldVal) == KErrNone)
{
const TDesC8& fieldNameDesC = fieldNameStr.DesC();
fieldName16.Copy(fieldNameDesC.Left(256));
switch (fieldVal.Type())
{
case THTTPHdrVal::KTIntVal:
{
Log(_L("%S: %d\n"), &fieldName16, fieldVal.Int());
break;
}
case THTTPHdrVal::KStrFVal:
{
RStringF fieldValStr = strP.StringF(fieldVal.StrF());
const TDesC8& fieldValDesC = fieldValStr.DesC();
fieldVal16.Copy(fieldValDesC.Left(256));
Log(_L("%S: %S\n"), &fieldName16, &fieldVal16);
break;
}
case THTTPHdrVal::KStrVal:
{
RString fieldValStr = strP.String(fieldVal.Str());
const TDesC8& fieldValDesC = fieldValStr.DesC();
fieldVal16.Copy(fieldValDesC.Left(256));
Log(_L("%S: %S\n"), &fieldName16, &fieldVal16);
break;
}
case THTTPHdrVal::KDateVal:
{
TDateTime date = fieldVal.DateTime();
TBuf<40> dateTimeString;
TTime t(date);
t.FormatL(dateTimeString,_L("%D %M %Y"));

Log(_L("%S: %S\n"), &fieldName16, &dateTimeString);
break;
}
default:
{
Log(_L("%S: <unrecognised value type>\n"), &fieldName16);
break;
}
}
}
it++;
}