| 263 | } |
| 264 | |
| 265 | bool CookieManager::RecurseCookieDomain(const std::string& url, |
| 266 | const BrowserCookie& cookie) { |
| 267 | int status = this->SetCookie(url, cookie); |
| 268 | |
| 269 | size_t dot_index = cookie.domain().find_first_of('.'); |
| 270 | if (dot_index == 0) { |
| 271 | BrowserCookie first_dot_cookie = cookie.Copy(); |
| 272 | first_dot_cookie.set_domain(cookie.domain().substr(1)); |
| 273 | return this->RecurseCookieDomain(url, first_dot_cookie); |
| 274 | } else if (dot_index != std::string::npos) { |
| 275 | BrowserCookie no_dot_cookie = cookie.Copy(); |
| 276 | no_dot_cookie.set_domain(cookie.domain().substr(dot_index)); |
| 277 | return this->RecurseCookieDomain(url, no_dot_cookie); |
| 278 | } |
| 279 | |
| 280 | BrowserCookie no_domain_cookie = cookie.Copy(); |
| 281 | no_domain_cookie.set_domain(""); |
| 282 | status = this->SetCookie(url, no_domain_cookie); |
| 283 | return status == WD_SUCCESS; |
| 284 | } |
| 285 | |
| 286 | std::string CookieManager::ReadCookieFile(const std::wstring& file_name) { |
| 287 | LOG(TRACE) << "Entering CookieManager::ReadCookieFile"; |
no test coverage detected