use std::wstring_view in SessionIdManager::DecodeToken(...) method
This commit is contained in:
parent
de972de948
commit
6266eac729
|
@ -52,6 +52,7 @@ public:
|
||||||
static constexpr const wchar_t * content_type = L"Content-Type";
|
static constexpr const wchar_t * content_type = L"Content-Type";
|
||||||
static constexpr const wchar_t * accept = L"Accept";
|
static constexpr const wchar_t * accept = L"Accept";
|
||||||
static constexpr const wchar_t * accept_language = L"Accept-Language";
|
static constexpr const wchar_t * accept_language = L"Accept-Language";
|
||||||
|
static constexpr const wchar_t * authorization = L"Authorization";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* headers' names lower case
|
* headers' names lower case
|
||||||
|
@ -87,6 +88,7 @@ public:
|
||||||
static constexpr const wchar_t * multipart_form_data = L"multipart/form-data";
|
static constexpr const wchar_t * multipart_form_data = L"multipart/form-data";
|
||||||
|
|
||||||
static constexpr const wchar_t * bearer = L"Bearer";
|
static constexpr const wchar_t * bearer = L"Bearer";
|
||||||
|
static constexpr const wchar_t * winix = L"Winix";
|
||||||
|
|
||||||
|
|
||||||
static const int status_200_ok = 200;
|
static const int status_200_ok = 200;
|
||||||
|
|
|
@ -433,6 +433,18 @@ void SessionIdManager::CopyString(const std::wstring & in, std::string & out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SessionIdManager::CopyString(const std::wstring_view & in, std::string & out)
|
||||||
|
{
|
||||||
|
out.clear();
|
||||||
|
|
||||||
|
if( out.capacity() < in.size() )
|
||||||
|
out.reserve(in.size());
|
||||||
|
|
||||||
|
for(size_t i=0 ; i<in.size() ; ++i)
|
||||||
|
out += in[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionIdManager::Encode(std::string & str)
|
bool SessionIdManager::Encode(std::string & str)
|
||||||
{
|
{
|
||||||
|
@ -613,7 +625,7 @@ bool SessionIdManager::DecodeToken(size_t & id, unsigned int & index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SessionIdManager::DecodeToken(const std::wstring & token, size_t & id, unsigned int & index)
|
bool SessionIdManager::DecodeToken(const std::wstring_view & token, size_t & id, unsigned int & index)
|
||||||
{
|
{
|
||||||
if( !was_inited )
|
if( !was_inited )
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -133,7 +133,7 @@ public:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool EncodeToken(size_t id, unsigned int index, time_t cur_utc_time, std::wstring & token);
|
bool EncodeToken(size_t id, unsigned int index, time_t cur_utc_time, std::wstring & token);
|
||||||
bool DecodeToken(const std::wstring & token, size_t & id, unsigned int & index);
|
bool DecodeToken(const std::wstring_view & token, size_t & id, unsigned int & index);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -170,6 +170,7 @@ private:
|
||||||
void AppendXor(std::string & str);
|
void AppendXor(std::string & str);
|
||||||
void CopyString(const std::string & in, std::wstring & out);
|
void CopyString(const std::string & in, std::wstring & out);
|
||||||
void CopyString(const std::wstring & in, std::string & out);
|
void CopyString(const std::wstring & in, std::string & out);
|
||||||
|
void CopyString(const std::wstring_view & in, std::string & out);
|
||||||
bool Encode(std::string & str);
|
bool Encode(std::string & str);
|
||||||
bool DecodeToken(size_t key, size_t & id, unsigned int & index);
|
bool DecodeToken(size_t key, size_t & id, unsigned int & index);
|
||||||
bool DecodeToken(size_t & id, unsigned int & index);
|
bool DecodeToken(size_t & id, unsigned int & index);
|
||||||
|
|
Loading…
Reference in New Issue