Symbian Http添加Cookie 请求

阅读更多

// Set Cookie... // 1. set cookie name. RStringF fieldName = iSession.StringPool().StringF(HTTP::ECookie, RHTTPSession::GetTable()); THTTPHdrVal fieldValue; fieldValue.SetStrF(fieldName); // 2. set cookie name and values. // Check the cookie name and value RStringF name = iSession.StringPool().StringF(HTTP::ECookieName, RHTTPSession::GetTable()); RStringF value = iSession.StringPool().StringF(HTTP::ECookieValue, RHTTPSession::GetTable()); TInt itemNumber = cookie->ItemNumber(); for(TInt i = 0; i < itemNumber; ++i) { // Set the name RString paraName = iSession.StringPool().OpenStringL(cookie->GetCookieName(i)); CleanupClosePushL(paraName); hdr.SetFieldL(fieldName, fieldValue, name, THTTPHdrVal(paraName)); CleanupStack::PopAndDestroy(); // Set the value RString paraValue = iSession.StringPool().OpenStringL(cookie->GetCookieValue(i)); CleanupClosePushL(paraValue); hdr.SetFieldL(fieldName, fieldValue, value, THTTPHdrVal(paraValue)); CleanupStack::PopAndDestroy(); }

你可能感兴趣的:(Symbian)