diff options
author | Arslan Urtashev <urtashev@gmail.com> | 2022-02-10 16:48:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:55 +0300 |
commit | 1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/http | |
parent | b97740540e7302cec9efa181e106ae1990a0cc1c (diff) | |
download | ydb-1136f2ce7cce7bcc84e695272c0d92d4eb900c2b.tar.gz |
Restoring authorship annotation for Arslan Urtashev <urtashev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http')
-rw-r--r-- | library/cpp/http/misc/httpreqdata.cpp | 20 | ||||
-rw-r--r-- | library/cpp/http/misc/httpreqdata.h | 2 | ||||
-rw-r--r-- | library/cpp/http/misc/httpreqdata_ut.cpp | 30 |
3 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp index 035eccf7b9..f6951f68cd 100644 --- a/library/cpp/http/misc/httpreqdata.cpp +++ b/library/cpp/http/misc/httpreqdata.cpp @@ -1,7 +1,7 @@ #include "httpreqdata.h" -#include <util/stream/mem.h> - +#include <util/stream/mem.h> + TBaseServerRequestData::TBaseServerRequestData(SOCKET s) : Addr(nullptr) , Host() @@ -46,14 +46,14 @@ void TBaseServerRequestData::AppendQueryString(const char* str, size_t length) { SearchLength = ModifiedQueryString.size() - 1; // ignore terminator } -void TBaseServerRequestData::SetRemoteAddr(TStringBuf addr) { - TMemoryOutput out(AddrData, Y_ARRAY_SIZE(AddrData) - 1); - out.Write(addr.substr(0, Y_ARRAY_SIZE(AddrData) - 1)); - *out.Buf() = '\0'; - - Addr = AddrData; -} - +void TBaseServerRequestData::SetRemoteAddr(TStringBuf addr) { + TMemoryOutput out(AddrData, Y_ARRAY_SIZE(AddrData) - 1); + out.Write(addr.substr(0, Y_ARRAY_SIZE(AddrData) - 1)); + *out.Buf() = '\0'; + + Addr = AddrData; +} + const char* TBaseServerRequestData::RemoteAddr() const { if (!Addr) { *AddrData = 0; diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 6bc816fcf5..16e59c4d78 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -57,7 +57,7 @@ public: void AppendQueryString(const char* str, size_t length); const char* RemoteAddr() const; - void SetRemoteAddr(TStringBuf addr); + void SetRemoteAddr(TStringBuf addr); const char* HeaderIn(TStringBuf key) const; const THttpHeadersContainer& HeadersIn() const { diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp index 554a4c9645..e7f16ef27c 100644 --- a/library/cpp/http/misc/httpreqdata_ut.cpp +++ b/library/cpp/http/misc/httpreqdata_ut.cpp @@ -135,20 +135,20 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { } Y_UNIT_TEST(SetRemoteAddrSimple) { - static const TString TEST = "abacaba.search.yandex.net"; - - TServerRequestData rd; - rd.SetRemoteAddr(TEST); - UNIT_ASSERT_STRINGS_EQUAL(TEST, rd.RemoteAddr()); - } - + static const TString TEST = "abacaba.search.yandex.net"; + + TServerRequestData rd; + rd.SetRemoteAddr(TEST); + UNIT_ASSERT_STRINGS_EQUAL(TEST, rd.RemoteAddr()); + } + Y_UNIT_TEST(SetRemoteAddrRandom) { - for (size_t size = 0; size < 2 * INET6_ADDRSTRLEN; ++size) { - const TString test = NUnitTest::RandomString(size, size); - TServerRequestData rd; - rd.SetRemoteAddr(test); - UNIT_ASSERT_STRINGS_EQUAL(test.substr(0, INET6_ADDRSTRLEN - 1), rd.RemoteAddr()); - } - } - + for (size_t size = 0; size < 2 * INET6_ADDRSTRLEN; ++size) { + const TString test = NUnitTest::RandomString(size, size); + TServerRequestData rd; + rd.SetRemoteAddr(test); + UNIT_ASSERT_STRINGS_EQUAL(test.substr(0, INET6_ADDRSTRLEN - 1), rd.RemoteAddr()); + } + } + } // TRequestServerDataTest |