本文整理汇总了C++中CookieMap::removeCookie方法的典型用法代码示例。如果您正苦于以下问题:C++ CookieMap::removeCookie方法的具体用法?C++ CookieMap::removeCookie怎么用?C++ CookieMap::removeCookie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CookieMap
的用法示例。
在下文中一共展示了CookieMap::removeCookie方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAndTreatCookie
void CookieManager::checkAndTreatCookie(ParsedCookie* candidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter filter)
{
CookieLog("CookieManager - checkAndTreatCookie - processing url with domain - %s & protocol %s\n", candidateCookie->domain().utf8().data(), candidateCookie->protocol().utf8().data());
// Delete invalid cookies:
// 1) A cookie which is not from http shouldn't have a httpOnly property.
// 2) Cookies coming from schemes that we do not support and the special flag isn't on
if ((filter == NoHttpOnlyCookie && candidateCookie->isHttpOnly()) || (shouldIgnoreScheme(candidateCookie->protocol()) && !m_shouldDumpAllCookies)) {
delete candidateCookie;
return;
}
const bool ignoreDomain = (candidateCookie->protocol() == "file" || candidateCookie->protocol() == "local");
// Determine which protocol tree to add the cookie to. Create one if necessary.
CookieMap* curMap = 0;
if (m_managerMap.contains(candidateCookie->protocol()))
curMap = m_managerMap.get(candidateCookie->protocol());
else {
// Check if it is a secure version, if it is, link it to the non-secure version
// Link curMap to the new protocol as well as the old one if it doesn't exist
if (candidateCookie->protocol() == "https") {
curMap = m_managerMap.get("http");
if (!curMap) {
curMap = new CookieMap("http");
m_managerMap.add("http", curMap);
}
} else if (candidateCookie->protocol() == "wss") {
curMap = m_managerMap.get("ws");
if (!curMap) {
curMap = new CookieMap("ws");
m_managerMap.add("ws", curMap);
}
} else
curMap = new CookieMap(candidateCookie->protocol());
CookieLog("CookieManager - adding protocol cookiemap - %s\n", curMap->getName().utf8().data());
m_managerMap.add(candidateCookie->protocol(), curMap);
}
// If protocol support domain, we have to traverse the domain tree to find the right
// cookieMap to handle with
if (!ignoreDomain)
curMap = findOrCreateCookieMap(curMap, *candidateCookie);
// Now that we have the proper map for this cookie, we can modify it
// If cookie does not exist and has expired, delete it
// If cookie exists and it has expired, so we must remove it from the map, if not update it
// If cookie expired and came from the BackingStore (therefore does not exist), we have to remove from database
// If cookie does not exist & it's valid, add it to the current map
if (candidateCookie->hasExpired() || candidateCookie->isForceExpired()) {
// Special case for getBackingStoreCookies() to catch expired cookies
if (postToBackingStore == BackingStoreCookieEntry)
m_cookieBackingStore->remove(candidateCookie);
else if (curMap) {
// RemoveCookie will return 0 if the cookie doesn't exist.
ParsedCookie* expired = curMap->removeCookie(candidateCookie, filter);
// Cookie is useless, Remove the cookie from the backingstore if it exists.
// Backup check for BackingStoreCookieEntry incase someone incorrectly uses this enum.
if (expired && postToBackingStore != BackingStoreCookieEntry && !expired->isSession()) {
CookieLog("CookieManager - expired cookie is nonsession, deleting from db");
m_cookieBackingStore->remove(expired);
}
delete expired;
} else
delete candidateCookie;
} else {
ASSERT(curMap);
addCookieToMap(curMap, candidateCookie, postToBackingStore, filter);
}
}