MCPcopy Create free account
hub / github.com/apache/arrow / UpdateCachedCookies

Method UpdateCachedCookies

cpp/src/arrow/flight/cookie_internal.cc:256–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256void CookieCache::UpdateCachedCookies(const CallHeaders& incoming_headers) {
257 CookieHeaderPair header_values = incoming_headers.equal_range("set-cookie");
258 const std::lock_guard<std::mutex> guard(mutex_);
259
260 for (auto it = header_values.first; it != header_values.second; ++it) {
261 const std::string_view& value = it->second;
262 Cookie cookie = Cookie::Parse(value);
263
264 // Cache cookies regardless of whether or not they are expired. The server may have
265 // explicitly sent a Set-Cookie to expire a cached cookie.
266 auto insertable = cookies.insert({cookie.GetName(), cookie});
267
268 // Force overwrite on insert collision.
269 if (!insertable.second) {
270 insertable.first->second = cookie;
271 }
272 }
273}
274
275std::string CookieCache::GetValidCookiesAsString() {
276 const std::lock_guard<std::mutex> guard(mutex_);

Callers 3

ReceivedHeadersMethod · 0.80
AddAndValidateMethod · 0.80
TESTFunction · 0.80

Calls 3

ParseFunction · 0.50
insertMethod · 0.45
GetNameMethod · 0.45

Tested by 2

AddAndValidateMethod · 0.64
TESTFunction · 0.64