MCPcopy Create free account
hub / github.com/axmolengine/axmol / checkAndGetFormatedMatchCookies

Method checkAndGetFormatedMatchCookies

core/network/HttpCookie.cpp:133–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133std::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
159bool HttpCookie::updateOrAddCookie(std::string_view cookie, const Uri& uri)
160{

Callers 1

handleNetworkEventMethod · 0.80

Calls 9

ends_withFunction · 0.85
time_nowFunction · 0.85
starts_withFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
getPathMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected