diff options
author | cherenkov-p-a <cherenkov-p-a@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
commit | 9011d1fa16370ec024d20180d440f7ae6fd0e1c8 (patch) | |
tree | cd688a9e90e30e02212a6ecaf664209db01c4c36 /library/cpp | |
parent | 9700ce2289436b557831d64eb47682c8c2a30ee2 (diff) | |
download | ydb-9011d1fa16370ec024d20180d440f7ae6fd0e1c8.tar.gz |
Restoring authorship annotation for <cherenkov-p-a@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/http/io/stream.cpp | 4 | ||||
-rw-r--r-- | library/cpp/http/io/stream.h | 2 | ||||
-rw-r--r-- | library/cpp/http/server/http.cpp | 8 | ||||
-rw-r--r-- | library/cpp/http/server/http_ut.cpp | 40 | ||||
-rw-r--r-- | library/cpp/http/server/options.h | 14 | ||||
-rw-r--r-- | library/cpp/iterator/concatenate.h | 4 | ||||
-rw-r--r-- | library/cpp/protobuf/ya.make | 6 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url.cpp | 40 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url.h | 6 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url_ut.cpp | 22 |
10 files changed, 73 insertions, 73 deletions
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684f..fcfd45b853 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -394,8 +394,8 @@ THttpInput::THttpInput(IInputStream* slave) { } -THttpInput::THttpInput(THttpInput&& httpInput) = default; - +THttpInput::THttpInput(THttpInput&& httpInput) = default; + THttpInput::~THttpInput() { } diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h index 78ca4fc814..66046532f9 100644 --- a/library/cpp/http/io/stream.h +++ b/library/cpp/http/io/stream.h @@ -25,7 +25,7 @@ struct THttpReadException: public THttpException { class THttpInput: public IInputStream { public: THttpInput(IInputStream* slave); - THttpInput(THttpInput&& httpInput); + THttpInput(THttpInput&& httpInput); ~THttpInput() override; /* diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 128583bdd7..12bf48a354 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -68,7 +68,7 @@ public: bool Reject_ = false; TInstant LastUsed; TInstant AcceptMoment; - size_t ReceivedRequests = 0; + size_t ReceivedRequests = 0; }; class THttpServer::TImpl { @@ -597,7 +597,7 @@ void TClientConnection::OnPollEvent(TInstant now) { void TClientConnection::Activate(TInstant now) noexcept { HttpServ_->Connections->Erase(this, now); LastUsed = now; - ++ReceivedRequests; + ++ReceivedRequests; } void TClientConnection::DeActivate() { @@ -690,8 +690,8 @@ void TClientRequest::Process(void* ThreadSpecificResource) { HttpConn_.Reset(new THttpServerConn(Socket())); } - auto maxRequestsPerConnection = HttpServ()->Options().MaxRequestsPerConnection; - HttpConn_->Output()->EnableKeepAlive(HttpServ()->Options().KeepAliveEnabled && (!maxRequestsPerConnection || Conn_->ReceivedRequests < maxRequestsPerConnection)); + auto maxRequestsPerConnection = HttpServ()->Options().MaxRequestsPerConnection; + HttpConn_->Output()->EnableKeepAlive(HttpServ()->Options().KeepAliveEnabled && (!maxRequestsPerConnection || Conn_->ReceivedRequests < maxRequestsPerConnection)); HttpConn_->Output()->EnableCompression(HttpServ()->Options().CompressionEnabled); } diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp index cc62bb988e..3216aab0ad 100644 --- a/library/cpp/http/server/http_ut.cpp +++ b/library/cpp/http/server/http_ut.cpp @@ -559,7 +559,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { UNIT_ASSERT_STRINGS_EQUAL(serverImpl.ExceptionMessage, "(yexception) some error"); }; - THttpInput SendRequest(TSocket& socket, ui16 port) { + THttpInput SendRequest(TSocket& socket, ui16 port) { TSocketInput si(socket); TSocketOutput so(socket); THttpOutput out(&so); @@ -571,7 +571,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { THttpInput input(&si); input.ReadAll(); - return input; + return input; } THttpInput SendRequestWithBody(TSocket& socket, ui16 port, TString body) { @@ -642,24 +642,24 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } - Y_UNIT_TEST(TTestCloseConnectionOnRequestLimit) { - TPortManager pm; - const ui16 port = pm.GetPort(); - - TEchoServer serverImpl("test_data"); - THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).SetMaxRequestsPerConnection(2)); - UNIT_ASSERT(server.Start()); - - TSocket socket(TNetworkAddress("localhost", port), TDuration::Seconds(10)); - - UNIT_ASSERT(SendRequest(socket, port).IsKeepAlive()); - UNIT_ASSERT(!SendRequest(socket, port).IsKeepAlive()); - - UNIT_ASSERT_EXCEPTION(SendRequest(socket, port), THttpReadException); - - server.Stop(); - } - + Y_UNIT_TEST(TTestCloseConnectionOnRequestLimit) { + TPortManager pm; + const ui16 port = pm.GetPort(); + + TEchoServer serverImpl("test_data"); + THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).SetMaxRequestsPerConnection(2)); + UNIT_ASSERT(server.Start()); + + TSocket socket(TNetworkAddress("localhost", port), TDuration::Seconds(10)); + + UNIT_ASSERT(SendRequest(socket, port).IsKeepAlive()); + UNIT_ASSERT(!SendRequest(socket, port).IsKeepAlive()); + + UNIT_ASSERT_EXCEPTION(SendRequest(socket, port), THttpReadException); + + server.Stop(); + } + Y_UNIT_TEST(TTestListenerSockAddrConnection) { TPortManager pm; const ui16 port1 = pm.GetPort(); diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h index 38eda0e5e7..864f7c09e5 100644 --- a/library/cpp/http/server/options.h +++ b/library/cpp/http/server/options.h @@ -118,12 +118,12 @@ public: return *this; } - inline THttpServerOptions& SetMaxRequestsPerConnection(size_t val) noexcept { - MaxRequestsPerConnection = val; - - return *this; - } - + inline THttpServerOptions& SetMaxRequestsPerConnection(size_t val) noexcept { + MaxRequestsPerConnection = val; + + return *this; + } + /// Use TElasticQueue instead of TThreadPool for request queues inline THttpServerOptions& EnableElasticQueues(bool enable) noexcept { UseElasticQueues = enable; @@ -164,7 +164,7 @@ public: TDuration ClientTimeout; size_t OutputBufferSize = 0; ui64 MaxInputContentLength = sizeof(size_t) <= 4 ? 2_GB : 64_GB; - size_t MaxRequestsPerConnection = 0; // If keep-alive is enabled, request limit before connection is closed + size_t MaxRequestsPerConnection = 0; // If keep-alive is enabled, request limit before connection is closed bool UseElasticQueues = false; TDuration PollTimeout; // timeout of TSocketPoller::WaitT call diff --git a/library/cpp/iterator/concatenate.h b/library/cpp/iterator/concatenate.h index 64d2cd451a..dc8e489111 100644 --- a/library/cpp/iterator/concatenate.h +++ b/library/cpp/iterator/concatenate.h @@ -77,9 +77,9 @@ namespace NPrivate { TValue operator*() const { return GetCurrentValue(Position_, Iterators_); } - TIterator& operator++() { + TIterator& operator++() { MaybeIncrementIteratorAndSkipExhaustedContainers<true>(); - return *this; + return *this; } bool operator!=(const TSentinel& other) const { // give compiler an opportunity to optimize sentinel case (-70% of time) diff --git a/library/cpp/protobuf/ya.make b/library/cpp/protobuf/ya.make index 618b542b4f..b5f98a8ee2 100644 --- a/library/cpp/protobuf/ya.make +++ b/library/cpp/protobuf/ya.make @@ -1,5 +1,5 @@ -RECURSE( - dynamic_prototype +RECURSE( + dynamic_prototype from_xml from_xml/ut interop @@ -16,4 +16,4 @@ RECURSE( yql/ut yandex_patches_ut yt -) +) diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..7471765c75 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -283,26 +283,26 @@ TStringBuf CutWWWPrefix(const TStringBuf url) noexcept { return url; } -TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept { - auto it = url.begin(); - - StripRangeBegin(it, url.end(), [](auto& it){ return *it == 'w' || *it == 'W'; }); - if (it == url.begin()) { - return url; - } - - StripRangeBegin(it, url.end(), [](auto& it){ return IsAsciiDigit(*it); }); - if (it == url.end()) { - return url; - } - - if (*it++ == '.') { - return url.Tail(it - url.begin()); - } - - return url; -} - +TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept { + auto it = url.begin(); + + StripRangeBegin(it, url.end(), [](auto& it){ return *it == 'w' || *it == 'W'; }); + if (it == url.begin()) { + return url; + } + + StripRangeBegin(it, url.end(), [](auto& it){ return IsAsciiDigit(*it); }); + if (it == url.end()) { + return url; + } + + if (*it++ == '.') { + return url.Tail(it - url.begin()); + } + + return url; +} + TStringBuf CutMPrefix(const TStringBuf url) noexcept { if (url.size() >= 2 && url[1] == '.' && (url[0] == 'm' || url[0] == 'M')) { return url.substr(2); diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h index 84137ccc57..0589534f38 100644 --- a/library/cpp/string_utils/url/url.h +++ b/library/cpp/string_utils/url/url.h @@ -142,9 +142,9 @@ TStringBuf GetZone(const TStringBuf host) noexcept; Y_PURE_FUNCTION TStringBuf CutWWWPrefix(const TStringBuf url) noexcept; -Y_PURE_FUNCTION -TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept; - +Y_PURE_FUNCTION +TStringBuf CutWWWNumberedPrefix(const TStringBuf url) noexcept; + /** * Cuts 'm.' prefix from url if and only if the url starts with it * Example: 'm.some-domain.com' -> 'some-domain.com'. diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp index 1588013893..a45f562884 100644 --- a/library/cpp/string_utils/url/url_ut.cpp +++ b/library/cpp/string_utils/url/url_ut.cpp @@ -110,17 +110,17 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) { UNIT_ASSERT_VALUES_EQUAL("www", CutWWWPrefix("www")); UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWPrefix("www.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("", CutWWWNumberedPrefix("www.")); - UNIT_ASSERT_VALUES_EQUAL("www", CutWWWNumberedPrefix("www")); - UNIT_ASSERT_VALUES_EQUAL("www27", CutWWWNumberedPrefix("www27")); - UNIT_ASSERT_VALUES_EQUAL("", CutWWWNumberedPrefix("www27.")); - UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www2.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www12.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("ww2.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("w1w2w3.ya.ru", CutWWWNumberedPrefix("w1w2w3.ya.ru")); - UNIT_ASSERT_VALUES_EQUAL("123.ya.ru", CutWWWNumberedPrefix("123.ya.ru")); - + UNIT_ASSERT_VALUES_EQUAL("", CutWWWNumberedPrefix("www.")); + UNIT_ASSERT_VALUES_EQUAL("www", CutWWWNumberedPrefix("www")); + UNIT_ASSERT_VALUES_EQUAL("www27", CutWWWNumberedPrefix("www27")); + UNIT_ASSERT_VALUES_EQUAL("", CutWWWNumberedPrefix("www27.")); + UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www2.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("www12.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("ya.ru", CutWWWNumberedPrefix("ww2.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("w1w2w3.ya.ru", CutWWWNumberedPrefix("w1w2w3.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("123.ya.ru", CutWWWNumberedPrefix("123.ya.ru")); + UNIT_ASSERT_VALUES_EQUAL("", CutMPrefix("m.")); UNIT_ASSERT_VALUES_EQUAL("", CutMPrefix("M.")); UNIT_ASSERT_VALUES_EQUAL("m", CutMPrefix("m")); |