diff options
author | mvel <mvel@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
commit | bd30392c4cc92487950adc375c07adf52da1d592 (patch) | |
tree | e8d1a3f19b7fc890bcef6e4cc5de41f1d88c9ac3 /library/cpp/http/misc | |
parent | 5d50718e66d9c037dc587a0211110b7d25a66185 (diff) | |
download | ydb-bd30392c4cc92487950adc375c07adf52da1d592.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/misc')
-rw-r--r-- | library/cpp/http/misc/httpreqdata.h | 10 | ||||
-rw-r--r-- | library/cpp/http/misc/httpreqdata_ut.cpp | 38 | ||||
-rw-r--r-- | library/cpp/http/misc/ya.make | 6 |
3 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78..c8d6e66dc7 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -10,7 +10,7 @@ #include <util/network/address.h> #include <util/network/socket.h> #include <util/generic/hash.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> #include <util/generic/string.h> #include <util/datetime/base.h> #include <util/generic/buffer.h> @@ -47,9 +47,9 @@ public: return Search; } - TStringBuf QueryStringBuf() const { - return TStringBuf(Search, SearchLength); - } + TStringBuf QueryStringBuf() const { + return TStringBuf(Search, SearchLength); + } TStringBuf OrigQueryStringBuf() const { return OrigSearch; @@ -93,7 +93,7 @@ private: TString Port; char* Path; char* Search; - size_t SearchLength; // length of Search + size_t SearchLength; // length of Search TStringBuf OrigSearch; THttpHeadersContainer HeadersIn_; mutable char AddrData[INET6_ADDRSTRLEN]; diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp index e7f16ef27c..e1d7156656 100644 --- a/library/cpp/http/misc/httpreqdata_ut.cpp +++ b/library/cpp/http/misc/httpreqdata_ut.cpp @@ -1,7 +1,7 @@ -#include "httpreqdata.h" - +#include "httpreqdata.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TRequestServerDataTest) { Y_UNIT_TEST(Headers) { TServerRequestData sd; @@ -44,13 +44,13 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { Y_UNIT_TEST(ParseScan) { TServerRequestData rd; - + // Parse parses url without host UNIT_ASSERT(!rd.Parse(" http://yandex.ru/yandsearch?>a=fake&haha=da HTTP 1.1 OK")); - + // This should work UNIT_ASSERT(rd.Parse(" /yandsearch?>a=fake&haha=da HTTP 1.1 OK")); - + UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), ">a=fake&haha=da"); UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf()); @@ -58,10 +58,10 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT(rd.CgiParam.Has("gta", "fake")); UNIT_ASSERT(rd.CgiParam.Has("haha", "da")); UNIT_ASSERT(!rd.CgiParam.Has("no-param")); - + rd.Clear(); } - + Y_UNIT_TEST(Ctor) { const TString qs("gta=fake&haha=da"); TServerRequestData rd(qs.c_str()); @@ -73,14 +73,14 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT(rd.CgiParam.Has("haha")); UNIT_ASSERT(!rd.CgiParam.Has("no-param")); } - + Y_UNIT_TEST(HashCut) { const TString qs(">a=fake&haha=da"); const TString header = " /yandsearch?" + qs + "#&uberParam=yes&q=? HTTP 1.1 OK"; TServerRequestData rd; rd.Parse(header.c_str()); - + UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs); UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs); @@ -89,36 +89,36 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT(rd.CgiParam.Has("haha")); UNIT_ASSERT(!rd.CgiParam.Has("uberParam")); } - + Y_UNIT_TEST(MisplacedHashCut) { TServerRequestData rd; rd.Parse(" /y#ndsearch?>a=fake&haha=da&uberParam=yes&q=? HTTP 1.1 OK"); - + UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), ""); UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), ""); rd.Scan(); UNIT_ASSERT(rd.CgiParam.empty()); } - + Y_UNIT_TEST(CornerCase) { TServerRequestData rd; rd.Parse(" /yandsearch?#"); - + UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), ""); UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), ""); rd.Scan(); UNIT_ASSERT(rd.CgiParam.empty()); } - + Y_UNIT_TEST(AppendQueryString) { const TString qs("gta=fake&haha=da"); TServerRequestData rd(qs.c_str()); - + UNIT_ASSERT(rd.CgiParam.Has("gta", "fake")); UNIT_ASSERT(rd.CgiParam.Has("haha", "da")); - + UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs); UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf()); @@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs); rd.Scan(); - + UNIT_ASSERT(rd.CgiParam.Has("gta", "true")); UNIT_ASSERT(rd.CgiParam.Has("gta", "new")); } @@ -151,4 +151,4 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { } } -} // TRequestServerDataTest +} // TRequestServerDataTest diff --git a/library/cpp/http/misc/ya.make b/library/cpp/http/misc/ya.make index fceb3cf79c..298be41adc 100644 --- a/library/cpp/http/misc/ya.make +++ b/library/cpp/http/misc/ya.make @@ -1,9 +1,9 @@ LIBRARY() -OWNER( +OWNER( g:util - mvel -) + mvel +) GENERATE_ENUM_SERIALIZATION(httpcodes.h) |