MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ParseCookieList

Method ParseCookieList

cpp/iedriver/CookieManager.cpp:309–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void CookieManager::ParseCookieList(const std::string& cookie_file_contents,
310 const bool include_secure_cookies,
311 std::map<std::string, BrowserCookie>* cookies) {
312 LOG(TRACE) << "Entering CookieManager::ParseCookieList";
313
314 // Each cookie in the file is a record structure separated by
315 // a line containing a single asterisk ('*'). Split the file
316 // content on this delimiter, and parse each record.
317 std::vector<std::string> persistent_cookie_strings;
318 StringUtilities::Split(cookie_file_contents,
319 "\n*\n",
320 &persistent_cookie_strings);
321 std::vector<std::string>::const_iterator cookie_string_iterator;
322 for (cookie_string_iterator = persistent_cookie_strings.begin();
323 cookie_string_iterator != persistent_cookie_strings.end();
324 ++cookie_string_iterator) {
325 BrowserCookie persistent_cookie =
326 this->ParseSingleCookie(*cookie_string_iterator);
327 if (include_secure_cookies || !persistent_cookie.is_secure()) {
328 // Omit the cookie if it's 'secure' flag is set and we are *not*
329 // browsing using SSL.
330 cookies->insert(
331 std::pair<std::string, BrowserCookie>(persistent_cookie.name(),
332 persistent_cookie));
333 }
334 }
335}
336
337BrowserCookie CookieManager::ParseSingleCookie(const std::string& cookie) {
338 LOG(TRACE) << "Entering CookieManager::ParsePersistentCookieInfo";

Callers 1

GetCookiesMethod · 0.95

Calls 6

ParseSingleCookieMethod · 0.95
endMethod · 0.80
is_secureMethod · 0.80
insertMethod · 0.80
nameMethod · 0.65
LOGClass · 0.50

Tested by

no test coverage detected