| 131 | } |
| 132 | |
| 133 | std::string HttpCookie::checkAndGetFormatedMatchCookies(const Uri& uri) |
| 134 | { |
| 135 | std::string ret; |
| 136 | for (auto iter = _cookies.begin(); iter != _cookies.end();) |
| 137 | { |
| 138 | auto& cookie = *iter; |
| 139 | if (cxx20::ends_with(uri.getHost(), cookie.domain) && cxx20::starts_with(uri.getPath(), cookie.path)) |
| 140 | { |
| 141 | if (yasio::time_now() >= cookie.expires) |
| 142 | { |
| 143 | iter = _cookies.erase(iter); |
| 144 | continue; |
| 145 | } |
| 146 | |
| 147 | if (!ret.empty()) |
| 148 | ret += "; "; |
| 149 | |
| 150 | ret += cookie.name; |
| 151 | ret.push_back('='); |
| 152 | ret += cookie.value; |
| 153 | } |
| 154 | ++iter; |
| 155 | } |
| 156 | return ret; |
| 157 | } |
| 158 | |
| 159 | bool HttpCookie::updateOrAddCookie(std::string_view cookie, const Uri& uri) |
| 160 | { |
no test coverage detected