diff options
author | hcpp <[email protected]> | 2023-11-08 22:36:26 +0300 |
---|---|---|
committer | hcpp <[email protected]> | 2023-11-08 22:59:37 +0300 |
commit | 202a1ac82d1e5912c218f715e2b51eedca69d71b (patch) | |
tree | 820c756d93da98ab7b9645687587f102507ac275 /library/cpp/http | |
parent | 56be5c51d62e26ec258cc3171e3417ab1516a178 (diff) |
Revert "metrics have been added"
This reverts commit 16e792be75335b09a4f9f254e3972030af83b1ad, reversing
changes made to 3790f3d771d1a65ed6c0d05f3e0d79ff13308142.
Diffstat (limited to 'library/cpp/http')
-rw-r--r-- | library/cpp/http/cookies/cookies.cpp | 33 | ||||
-rw-r--r-- | library/cpp/http/cookies/cookies.h | 17 | ||||
-rw-r--r-- | library/cpp/http/cookies/lctable.h | 86 | ||||
-rw-r--r-- | library/cpp/http/cookies/ya.make | 14 |
4 files changed, 0 insertions, 150 deletions
diff --git a/library/cpp/http/cookies/cookies.cpp b/library/cpp/http/cookies/cookies.cpp deleted file mode 100644 index 12b66c7f9df..00000000000 --- a/library/cpp/http/cookies/cookies.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "cookies.h" - -#include <library/cpp/string_utils/scan/scan.h> -#include <util/string/strip.h> -#include <util/string/builder.h> - -namespace { - struct TCookiesScanner { - THttpCookies* C; - - inline void operator()(const TStringBuf& key, const TStringBuf& val) { - C->Add(StripString(key), StripString(val)); - } - }; -} - -void THttpCookies::Scan(const TStringBuf& s) { - Clear(); - TCookiesScanner scan = {this}; - ScanKeyValue<true, ';', '='>(s, scan); -} - -/*** https://datatracker.ietf.org/doc/html/rfc6265#section-5.4 ***/ -TString THttpCookies::ToString() const { - TStringBuilder result; - for (const auto& [key, value] : *this) { - if (!result.empty()) { - result << "; "; - } - result << key << "=" << value; - } - return result; -} diff --git a/library/cpp/http/cookies/cookies.h b/library/cpp/http/cookies/cookies.h deleted file mode 100644 index d7a0030c8ba..00000000000 --- a/library/cpp/http/cookies/cookies.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "lctable.h" - -class THttpCookies: public TLowerCaseTable<TStringBuf> { -public: - inline THttpCookies(const TStringBuf& cookieString) { - Scan(cookieString); - } - - inline THttpCookies() noexcept { - } - - void Scan(const TStringBuf& cookieString); - - TString ToString() const; -}; diff --git a/library/cpp/http/cookies/lctable.h b/library/cpp/http/cookies/lctable.h deleted file mode 100644 index 09c88eafb80..00000000000 --- a/library/cpp/http/cookies/lctable.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include <library/cpp/digest/lower_case/lchash.h> - -#include <util/generic/hash_multi_map.h> -#include <util/generic/strbuf.h> -#include <util/generic/algorithm.h> -#include <util/generic/singleton.h> - -struct TStrBufHash { - inline size_t operator()(const TStringBuf& s) const noexcept { - return FnvCaseLess<size_t>(s); - } -}; - -struct TStrBufEqualToCaseLess { - inline bool operator()(const TStringBuf& c1, const TStringBuf& c2) const noexcept { - typedef TLowerCaseIterator<const TStringBuf::TChar> TIter; - - return (c1.size() == c2.size()) && std::equal(TIter(c1.begin()), TIter(c1.end()), TIter(c2.begin())); - } -}; - -template <class T> -class TLowerCaseTable: private THashMultiMap<TStringBuf, T, TStrBufHash, TStrBufEqualToCaseLess> { - typedef THashMultiMap<TStringBuf, T, TStrBufHash, TStrBufEqualToCaseLess> TBase; - -public: - typedef typename TBase::const_iterator const_iterator; - typedef std::pair<const_iterator, const_iterator> TConstIteratorPair; - - using TBase::TBase; - using TBase::begin; - using TBase::end; - - inline TConstIteratorPair EqualRange(const TStringBuf& name) const { - return TBase::equal_range(name); - } - - inline const T& Get(const TStringBuf& name, size_t numOfValue = 0) const { - TConstIteratorPair range = EqualRange(name); - - if (range.first == TBase::end()) - return Default<T>(); - - if (numOfValue == 0) - return range.first->second; - - const_iterator next = range.first; - for (size_t c = 0; c < numOfValue; ++c) { - ++next; - if (next == range.second) - return Default<T>(); - } - - return next->second; - } - - inline bool Has(const TStringBuf& name) const { - return TBase::find(name) != TBase::end(); - } - - size_t NumOfValues(const TStringBuf& name) const { - return TBase::count(name); - } - - inline size_t Size() const noexcept { - return TBase::size(); - } - - inline bool Empty() const noexcept { - return TBase::empty(); - } - - inline void Add(const TStringBuf& key, const T& val) { - TBase::insert(typename TBase::value_type(key, val)); - } - - inline void Clear() noexcept { - TBase::clear(); - } - - inline size_t Erase(const TStringBuf& key) { - return TBase::erase(key); - } -}; diff --git a/library/cpp/http/cookies/ya.make b/library/cpp/http/cookies/ya.make deleted file mode 100644 index 70c1e8f2504..00000000000 --- a/library/cpp/http/cookies/ya.make +++ /dev/null @@ -1,14 +0,0 @@ -LIBRARY() - -SRCS( - cookies.cpp -) - -PEERDIR( - library/cpp/digest/lower_case - library/cpp/string_utils/scan -) - -END() - -RECURSE_FOR_TESTS(ut) |