diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-02-10 16:49:42 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:42 +0300 |
commit | 0fd1998e1b2369f50fb694556f817d3c7fef10c8 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/monlib/service/mon_service_http_request.cpp | |
parent | 26e0e4fb5e5cd6b4d7f4c21f9fcd7978891bf946 (diff) | |
download | ydb-0fd1998e1b2369f50fb694556f817d3c7fef10c8.tar.gz |
Restoring authorship annotation for Alexey Efimov <xeno@prnwatch.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/service/mon_service_http_request.cpp')
-rw-r--r-- | library/cpp/monlib/service/mon_service_http_request.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/monlib/service/mon_service_http_request.cpp b/library/cpp/monlib/service/mon_service_http_request.cpp index b22e53d370..5d805631d9 100644 --- a/library/cpp/monlib/service/mon_service_http_request.cpp +++ b/library/cpp/monlib/service/mon_service_http_request.cpp @@ -42,44 +42,44 @@ const TCgiParameters& TMonService2HttpRequest::GetPostParams() const { } TStringBuf TMonService2HttpRequest::GetHeader(TStringBuf name) const { - const THttpHeaders& headers = HttpRequest->GetHeaders(); - const THttpInputHeader* header = headers.FindHeader(name); - if (header != nullptr) { - return header->Value(); - } - return TStringBuf(); -} - + const THttpHeaders& headers = HttpRequest->GetHeaders(); + const THttpInputHeader* header = headers.FindHeader(name); + if (header != nullptr) { + return header->Value(); + } + return TStringBuf(); +} + const THttpHeaders& TMonService2HttpRequest::GetHeaders() const { return HttpRequest->GetHeaders(); } - -TString TMonService2HttpRequest::GetRemoteAddr() const { - return HttpRequest->GetRemoteAddr(); -} - + +TString TMonService2HttpRequest::GetRemoteAddr() const { + return HttpRequest->GetRemoteAddr(); +} + TStringBuf TMonService2HttpRequest::GetCookie(TStringBuf name) const { - TStringBuf cookie = GetHeader("Cookie"); - size_t size = cookie.size(); - size_t start = 0; - while (start < size) { - size_t semicolon = cookie.find(';', start); - auto pair = cookie.substr(start, semicolon - start); - if (!pair.empty()) { - size_t equal = pair.find('='); - if (equal != TStringBuf::npos) { - auto cookieName = pair.substr(0, equal); - if (cookieName == name) { - size_t valueStart = equal + 1; - auto cookieValue = pair.substr(valueStart, semicolon - valueStart); - return cookieValue; - } - } - start = semicolon; - while (start < size && (cookie[start] == ' ' || cookie[start] == ';')) { - ++start; - } - } - } - return TStringBuf(); -} + TStringBuf cookie = GetHeader("Cookie"); + size_t size = cookie.size(); + size_t start = 0; + while (start < size) { + size_t semicolon = cookie.find(';', start); + auto pair = cookie.substr(start, semicolon - start); + if (!pair.empty()) { + size_t equal = pair.find('='); + if (equal != TStringBuf::npos) { + auto cookieName = pair.substr(0, equal); + if (cookieName == name) { + size_t valueStart = equal + 1; + auto cookieValue = pair.substr(valueStart, semicolon - valueStart); + return cookieValue; + } + } + start = semicolon; + while (start < size && (cookie[start] == ' ' || cookie[start] == ';')) { + ++start; + } + } + } + return TStringBuf(); +} |