Allow to use cookies with macros like ITERATE.
Definition at line 292 of file ncbi_cookies.hpp.
◆ TCookieList [1/2] ◆ TCookieList [2/2] ◆ TCookieMap [1/2] ◆ TCookieMap [2/2] ◆ TList_CI ◆ TMap_CI ◆ ECookieFormatWhether the cookie is sent as a part of HTTP request or HTTP response.
Enumerator eHTTPResponse eHTTPRequestDefinition at line 146 of file ncbi_cookies.hpp.
◆ ECookieHeaderCookie header type.
Enumerator eHeader_Cookie eHeader_SetCookieDefinition at line 255 of file ncbi_cookies.hpp.
◆ EErrCode ◆ EFieldTypeCookie field selector.
Enumerator eField_Name eField_Value eField_Domain eField_Path eField_Extension eField_OtherDefinition at line 200 of file ncbi_cookies.hpp.
◆ Add() [1/2] ◆ Add() [2/2]Parse a single Cookie or Set-Cookie header, discard bad cookies.
Definition at line 720 of file ncbi_cookies.cpp.
References CHttpCookies::Add(), CHttpCookies::Cleanup(), count, CHttpCookies::eHeader_Cookie, NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, CHttpCookie::GetDomain(), CUrl::GetHost(), CHttpCookie::GetName(), CHttpCookie::GetPath(), CUrl::GetPath(), CHttpCookie::IsExpired(), ITERATE, CHttpCookie::Match(), CHttpCookie::Parse(), CHttpCookie::SetDomain(), CHttpCookie::SetHostOnly(), CHttpCookie::SetPath(), NStr::Split(), str(), and CHttpCookies::x_Find().
◆ AsString()Compose string from the cookie.
If quoting is enabled, the value is placed in double-quotes. NOTE that this method does not print 'Set-Cookie:' or 'Cookie:' header itself, just the cookie value.
Definition at line 214 of file ncbi_cookies.cpp.
References CHttpCookie::eField_Domain, CHttpCookie::eField_Extension, CHttpCookie::eField_Name, CHttpCookie::eField_Path, CHttpCookie::eField_Value, CHttpCookie::eHTTPRequest, CHttpCookie::eHTTPResponse, format, CHttpCookie::GetExpirationStr(), CTime::IsEmpty(), CHttpCookie::m_Accessed, CHttpCookie::m_Domain, CHttpCookie::m_Expires, CHttpCookie::m_Extension, CHttpCookie::m_HttpOnly, CHttpCookie::m_Name, CHttpCookie::m_Path, CHttpCookie::m_Secure, CHttpCookie::m_Value, CTime::SetCurrent(), and CHttpCookie::x_Validate().
Referenced by CHttpSession_Base::x_GetCookies().
◆ begin() [1/2] ◆ begin() [2/2] ◆ CHttpCookie() [1/2] ◆ CHttpCookie() [2/2] CHttpCookie::CHttpCookie ( void ) ◆ CHttpCookie_CI() [1/3] ◆ CHttpCookie_CI() [2/3]Definition at line 878 of file ncbi_cookies.cpp.
References map_checker< Container >::begin(), map_checker< Container >::end(), CUrl::GetHost(), map_checker< Container >::lower_bound(), CHttpCookies::m_CookieMap, CHttpCookie_CI::m_Cookies, CHttpCookie_CI::m_ListIt, CHttpCookie_CI::m_MapIt, CHttpCookie_CI::m_Url, NULL, CHttpCookies::sx_RevertDomain(), and CHttpCookie_CI::x_Settle().
◆ CHttpCookie_CI() [3/3] ◆ Cleanup() void CHttpCookies::Cleanup ( size_t max_count =0
)
Cleanup cookies.
Remove the expired ones first, then if the remaining number of cookies is above the limit, remove domains containing most cookies until the total number is below the limit.
Definition at line 791 of file ncbi_cookies.cpp.
References _ASSERT, map_checker< Container >::clear(), count, map_checker< Container >::end(), map_checker< Container >::erase(), ERASE_ITERATE, map_checker< Container >::find(), ITERATE, CHttpCookies::m_CookieMap, and s_DomainCountLess().
Referenced by CHttpCookies::Add().
◆ end() ◆ GetDomain() ◆ GetErrCodeString() const char * CHttpCookieException::GetErrCodeString ( void ) const overridevirtual ◆ GetExpirationStr() string CHttpCookie::GetExpirationStr ( void ) const ◆ GetExpirationTime() const CTime & CHttpCookie::GetExpirationTime ( void ) const inline ◆ GetExtension() const string & CHttpCookie::GetExtension ( void ) const inline ◆ GetHostOnly() bool CHttpCookie::GetHostOnly ( void ) const inlineGet host-only flag.
The flag is set if the incoming cookie contains no domain attribute. In this case the domain is set to the originating host but no domain matching is used and the cookie can be sent back only to the same domain.
Definition at line 432 of file ncbi_cookies.hpp.
References CHttpCookie::m_HostOnly.
◆ GetHttpOnly() bool CHttpCookie::GetHttpOnly ( void ) const inline ◆ GetName() ◆ GetPath() ◆ GetSecure() bool CHttpCookie::GetSecure ( void ) const inline ◆ GetValue() ◆ IsExpired() [1/2] ◆ IsExpired() [2/2] bool CHttpCookie::IsExpired ( void ) const inline ◆ IsValidValue()Check if the value can be safely used for the selected field.
If the value is not valid and err_msg is not NULL, save error description to the string.
Definition at line 114 of file ncbi_cookies.cpp.
References _ASSERT, CHttpCookie::eField_Domain, CHttpCookie::eField_Extension, CHttpCookie::eField_Name, CHttpCookie::eField_Path, CHttpCookie::eField_Value, isalnum(), iscntrl(), kBannedChars_Extension, kBannedChars_Name, kBannedChars_Path, kBannedChars_Value, NPOS, NStr::SizetToString(), string, and rapidjson::value.
Referenced by CHttpCookie::Parse(), CHttpCookie::Validate(), and CHttpCookie::x_Validate().
◆ Match() ◆ MatchDomain() ◆ MatchPath() ◆ NCBI_EXCEPTION_DEFAULT() ◆ operator bool() ◆ operator!=() ◆ operator()() ◆ operator*() ◆ operator++() ◆ operator->() ◆ operator<()Compare two cookies:
Definition at line 306 of file ncbi_cookies.cpp.
References CHttpCookie::sx_Compare().
◆ operator=() ◆ operator==() [1/2] ◆ operator==() [2/2] ◆ Parse()Read cookie from the string.
The string should not include 'Cookie:' or 'Set-Cookie:' header. In case of HTTP request cookies ('Cookie:' header) the input should contain only one name=value pair. Return true on success, false on error (bad symbols in name/value, invalid domain, inproper protocol etc. - see RFC-6265). Parsing errors are logged with 'Info' severity.
Definition at line 461 of file ncbi_cookies.cpp.
References CTime::AddSecond(), CTime::Clear(), CHttpCookie::eField_Domain, CHttpCookie::eField_Name, CHttpCookie::eField_Path, CHttpCookie::eField_Value, CTime::eGmt, NStr::EndsWith(), NStr::EqualNocase(), ERR_POST_X, ncbi::grid::netcache::search::fields::expires, NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, Info(), CTime::IsEmpty(), CHttpCookie::IsValidValue(), ITERATE, CHttpCookie::m_Accessed, CHttpCookie::m_Created, CHttpCookie::m_Domain, CHttpCookie::m_Expires, CHttpCookie::m_Extension, CHttpCookie::m_HostOnly, CHttpCookie::m_HttpOnly, CHttpCookie::m_Name, CHttpCookie::m_Path, CHttpCookie::m_Secure, CHttpCookie::m_Value, NPOS, s_ParseDateTime(), CTime::SetCurrent(), CTime::SetTimeZone(), NStr::Split(), str(), NStr::ToLower(), NStr::TruncateSpaces(), and rapidjson::value.
Referenced by CHttpCookies::Add().
◆ Reset() void CHttpCookie::Reset ( void )Reset value and all attributes, keep just the name.
Definition at line 682 of file ncbi_cookies.cpp.
References CTime::Clear(), CHttpCookie::m_Accessed, CHttpCookie::m_Created, CHttpCookie::m_Domain, CHttpCookie::m_Expires, CHttpCookie::m_Extension, CHttpCookie::m_HostOnly, CHttpCookie::m_HttpOnly, CHttpCookie::m_Path, CHttpCookie::m_Secure, and CHttpCookie::m_Value.
◆ SetDomain() ◆ SetExpirationTime() void CHttpCookie::SetExpirationTime ( const CTime & exp_time ) inline ◆ SetExtension()Any additional attributes (multiple attributes should be separated with semicolon).
The string is appended to the cookie, semicolon-separated when converting it to a string.
Definition at line 501 of file ncbi_cookies.hpp.
References CHttpCookie::m_Extension.
◆ SetHostOnly() void CHttpCookie::SetHostOnly ( bool host_only ) inline ◆ SetHttpOnly() void CHttpCookie::SetHttpOnly ( bool http_only ) inline ◆ SetName()Set cookie's name.
No validation is performed immediately, but if the value is invalid CHttpCookieExcepion will be thrown on an attempt to get the cookie as a string. The name is never encoded - the caller is responsible for providing a valid name.
Definition at line 462 of file ncbi_cookies.hpp.
References CHttpCookie::m_Name.
◆ SetPath() ◆ SetSecure() void CHttpCookie::SetSecure ( bool secure ) inline ◆ SetValue()Set cookie's value.
No validation is performed immediately, but if the value is invalid CHttpCookieExcepion will be thrown on an attempt to get the cookie as a string. The value is never encoded - the caller is responsible for providing a valid value.
Definition at line 467 of file ncbi_cookies.hpp.
References CHttpCookie::m_Value, and rapidjson::value.
◆ sx_Compare() ◆ sx_RevertDomain() ◆ Validate() bool CHttpCookie::Validate ( void ) constCheck if name, value, domain and path of the cookie are valid.
Definition at line 318 of file ncbi_cookies.cpp.
References CHttpCookie::eField_Domain, CHttpCookie::eField_Extension, CHttpCookie::eField_Name, CHttpCookie::eField_Path, CHttpCookie::eField_Value, CHttpCookie::IsValidValue(), CHttpCookie::m_Domain, CHttpCookie::m_Extension, CHttpCookie::m_Name, CHttpCookie::m_Path, CHttpCookie::m_Value, and NULL.
◆ x_CheckState() void CHttpCookie_CI::x_CheckState ( void ) const private ◆ x_Compare() ◆ x_Find() ◆ x_IsValid() bool CHttpCookie_CI::x_IsValid ( void ) const private ◆ x_Next() void CHttpCookie_CI::x_Next ( void ) private ◆ x_Settle() void CHttpCookie_CI::x_Settle ( void ) private ◆ x_Validate() ◆ ~CHttpCookies() ◆ m_Accessed CTime CHttpCookie::m_Accessed mutableprivate ◆ m_CookieMap ◆ m_Cookies ◆ m_Created CTime CHttpCookie::m_Created private ◆ m_Domain ◆ m_Expires CTime CHttpCookie::m_Expires private ◆ m_Extension string CHttpCookie::m_Extension private ◆ m_HostOnly bool CHttpCookie::m_HostOnly private ◆ m_HttpOnly bool CHttpCookie::m_HttpOnly private ◆ m_ListIt ◆ m_MapIt ◆ m_Name ◆ m_Path ◆ m_Secure bool CHttpCookie::m_Secure private ◆ m_Url CUrl CHttpCookie_CI::m_Url private ◆ m_Value ◆ CHttpCookie ◆ CHttpCookie_CI ◆ CHttpCookiesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4