diff options
Diffstat (limited to 'indra/llplugin/llplugincookiestore.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/llplugin/llplugincookiestore.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp index 82017ab3fa..a5d717389d 100644..100755 --- a/indra/llplugin/llplugincookiestore.cpp +++ b/indra/llplugin/llplugincookiestore.cpp @@ -27,6 +27,7 @@ */ #include "linden_common.h" +#include "llstl.h" #include "indra_constants.h" #include "llplugincookiestore.h" @@ -87,6 +88,16 @@ std::string LLPluginCookieStore::Cookie::getKey() const return result; } +std::string LLPluginCookieStore::Cookie::getDomain() const +{ + std::string result; + if(mDomainEnd > mDomainStart) + { + result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart); + } + return result; +} + bool LLPluginCookieStore::Cookie::parse(const std::string &host) { bool first_field = true; @@ -395,7 +406,7 @@ void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_change { if(mHasChangedCookies) { - lldebugs << "returning changed cookies: " << llendl; + LL_DEBUGS() << "returning changed cookies: " << LL_ENDL; cookie_map_t::iterator iter; for(iter = mCookies.begin(); iter != mCookies.end(); ) { @@ -407,7 +418,7 @@ void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_change { s << iter->second->getCookie() << "\n"; - lldebugs << " " << iter->second->getCookie() << llendl; + LL_DEBUGS() << " " << iter->second->getCookie() << LL_ENDL; // If requested, clear the changed mark if(clear_changed) @@ -644,12 +655,8 @@ void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_t void LLPluginCookieStore::clearCookies() { - while(!mCookies.empty()) - { - cookie_map_t::iterator iter = mCookies.begin(); - delete iter->second; - mCookies.erase(iter); - } + std::for_each(mCookies.begin(), mCookies.end(), DeletePairedPointer()); + mCookies.clear(); } void LLPluginCookieStore::removeCookie(const std::string &key) @@ -662,3 +669,21 @@ void LLPluginCookieStore::removeCookie(const std::string &key) } } +void LLPluginCookieStore::removeCookiesByDomain(const std::string &domain) +{ + cookie_map_t::iterator iter = mCookies.begin(); + while(iter != mCookies.end()) + { + if(iter->second->getDomain() == domain) + { + cookie_map_t::iterator doErase = iter; + iter++; + delete doErase->second; + mCookies.erase(doErase); + } + else + { + iter++; + } + } +} |