how to write the COOKIE data in the HTTP header
| Mon, 2005-06-20 03:42 | |
|
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 |
|






Forum posts: 721
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/
Forum posts: 10
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
Forum posts: 721
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/