Discussion Board
-
<---- cookie ----help ---->
2005-06-16, 04:53
#1
Registered User
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).
------------------------- 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 : cysnew@vip.sina.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules