how to write the COOKIE data in the HTTP header

Login to reply to this topic.
Mon, 2005-06-20 03:42
Joined: 2005-06-17
Forum posts: 3
hi,guys.

now i am managed to add cookie in HTTP request header, but i failed to do that way .

I don't know how to do that ,anyone have any ideas?

1. I search in the SDK help which give some interface class such as "MHttpCookieManager" to do someting

related with 'cookie', but i cann't find any header file associated in the include path.

2. After that , I decided to do myself. here is my code segement, i can read the cookie from Http response header

and save it into a variable , but i can not add it in the HTTP request header for further loging ( i have capture

the HTTP header packet using winpcap).

Code:
Code:
------------------------- read and save cookie from HTTP response HEADER ------------------

RHTTPHeaders aCurrentHeader;
aCurrentHeader = aResponse.GetHeaderCollection();

// 2. ------- set the RStringF string to get header field data --//

RStringF setcookie = iSession.StringPool().StringF(HTTP::ESetCookie,
RHTTPSession::GetTable());

// 3. ------- get the cookie raw data ---------------------------//

TInt ifcookie = aCurrentHeader.GetField(setcookie,0,iCookieData); //( THTTPHdrVal iCookieData;)

------------------------append the saved cookie data into HTTP request HEADER ------------------

RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
SetHeaderL(hdr, HTTP::EAccept, KAccept);
// ----- get the cookie if have cookie ---2005-06-15------------ //
if(iSetCookie)
{
hdr.SetFieldL(iSession.StringPool().StringF(HTTP::ECookie,
RHTTPSession::GetTable()), iCookieData);
}

anyone who knows that ,plz help me or send mail to me : cuiyingsan@gmail.com

Wed, 2005-06-29 12:22
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 721
Re: how to write the COOKIE data in the HTTP header
Hi,

Cookie Manager's header file is not in the SDK.

As to your code:
- Is iSetCookie true?
- Does SetFieldL leave?

Note that you handle only old-style Netscape-cookies. The new cookie "standard" can be found in RFC2965, HTTP State Management Mechanism.

tOtE

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Mon, 2005-07-18 07:33
Joined: 2005-06-23
Forum posts: 10
Re: how to write the COOKIE data in the HTTP header
Hi

You have written that cookie manager's header file is not in SDK, then where can we find it. If any of you have found the solution then pleas post it here.

Thanks
Rashmi
Mon, 2005-07-18 08:26
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 721
Re: how to write the COOKIE data in the HTTP header
If it's not in the SDK, then you cannot have it. It's that easy.  Undecided

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

  • Login to reply to this topic.