aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authortrofimenkov <trofimenkov@yandex-team.ru>2022-02-10 16:49:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:31 +0300
commit7c6139b61ced2798d1134b68b8facf6925a36b8e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parent30cebc2cfa79af3b577760a113e203a79450e6b6 (diff)
downloadydb-7c6139b61ced2798d1134b68b8facf6925a36b8e.tar.gz
Restoring authorship annotation for <trofimenkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/grpc/server/ut/stream_adaptor_ut.cpp2
-rw-r--r--library/cpp/http/io/headers.h6
-rw-r--r--library/cpp/http/io/headers_ut.cpp256
-rw-r--r--library/cpp/http/misc/httpreqdata.cpp8
-rw-r--r--library/cpp/http/misc/httpreqdata.h10
-rw-r--r--library/cpp/http/misc/httpreqdata_ut.cpp62
-rw-r--r--library/cpp/http/server/http.cpp38
-rw-r--r--library/cpp/http/server/options.h24
-rw-r--r--library/cpp/json/writer/json_value.cpp28
-rw-r--r--library/cpp/json/writer/json_value.h2
-rw-r--r--library/cpp/logger/element.cpp10
-rw-r--r--library/cpp/logger/element_ut.cpp64
-rw-r--r--library/cpp/logger/thread.cpp2
-rw-r--r--library/cpp/logger/ut/ya.make2
-rw-r--r--library/cpp/threading/task_scheduler/task_scheduler.cpp4
-rw-r--r--library/cpp/tvmauth/client/misc/threaded_updater.cpp4
16 files changed, 261 insertions, 261 deletions
diff --git a/library/cpp/grpc/server/ut/stream_adaptor_ut.cpp b/library/cpp/grpc/server/ut/stream_adaptor_ut.cpp
index 52c0417571..c34d3b8c2b 100644
--- a/library/cpp/grpc/server/ut/stream_adaptor_ut.cpp
+++ b/library/cpp/grpc/server/ut/stream_adaptor_ut.cpp
@@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(StreamAdaptor) {
const i64 max = 10000;
// Here we will emulate grpc stream (NextReply call after writing)
- std::unique_ptr<IThreadPool> consumerQueue(new TThreadPool(TThreadPool::TParams().SetBlocking(false).SetCatching(false)));
+ std::unique_ptr<IThreadPool> consumerQueue(new TThreadPool(TThreadPool::TParams().SetBlocking(false).SetCatching(false)));
// And make sure only one request inflight (see UNIT_ASSERT on adding to the queue)
consumerQueue->Start(threads, 1);
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index 5df294fa71..a71793d1c6 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -84,11 +84,11 @@ public:
/// Добавляет заголовок в контейнер.
void AddHeader(THttpInputHeader header);
- template <typename ValueType>
+ template <typename ValueType>
void AddHeader(TString name, const ValueType& value) {
AddHeader(THttpInputHeader(std::move(name), ToString(value)));
- }
-
+ }
+
/// Добавляет заголовок в контейнер, если тот не содержит заголовка
/// c таким же параметром. В противном случае, заменяет существующий
/// заголовок на новый.
diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp
index 2f6c19b812..1d23ef8fdc 100644
--- a/library/cpp/http/io/headers_ut.cpp
+++ b/library/cpp/http/io/headers_ut.cpp
@@ -1,78 +1,78 @@
-#include <util/generic/set.h>
+#include <util/generic/set.h>
#include <util/generic/string.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/strbuf.h>
#include <utility>
-
+
#include <library/cpp/http/io/headers.h>
#include <library/cpp/testing/unittest/registar.h>
-
-namespace {
- class THeadersExistence {
- public:
+
+namespace {
+ class THeadersExistence {
+ public:
THeadersExistence() = default;
-
- THeadersExistence(const THttpHeaders& headers) {
- for (THttpHeaders::TConstIterator it = headers.Begin();
+
+ THeadersExistence(const THttpHeaders& headers) {
+ for (THttpHeaders::TConstIterator it = headers.Begin();
it != headers.End();
++it) {
- Add(it->Name(), it->Value());
- }
- }
-
- public:
+ Add(it->Name(), it->Value());
+ }
+ }
+
+ public:
void Add(TStringBuf name, TStringBuf value) {
Impl.emplace(TString(name), TString(value));
- }
-
+ }
+
bool operator==(const THeadersExistence& rhs) const {
- return Impl == rhs.Impl;
- }
-
- private:
+ return Impl == rhs.Impl;
+ }
+
+ private:
typedef TMultiSet<std::pair<TString, TString>> TImpl;
- TImpl Impl;
- };
-}
-
+ TImpl Impl;
+ };
+}
+
bool operator==(const THeadersExistence& lhs, const THttpHeaders& rhs) {
- return lhs == THeadersExistence(rhs);
-}
-
+ return lhs == THeadersExistence(rhs);
+}
+
bool operator==(const THttpHeaders& lhs, const THeadersExistence& rhs) {
- return THeadersExistence(lhs) == rhs;
-}
-
-class THttpHeadersTest: public TTestBase {
- UNIT_TEST_SUITE(THttpHeadersTest);
- UNIT_TEST(TestAddOperation1Arg);
- UNIT_TEST(TestAddOperation2Args);
- UNIT_TEST(TestAddOrReplaceOperation1Arg);
- UNIT_TEST(TestAddOrReplaceOperation2Args);
- UNIT_TEST(TestAddHeaderTemplateness);
+ return THeadersExistence(lhs) == rhs;
+}
+
+class THttpHeadersTest: public TTestBase {
+ UNIT_TEST_SUITE(THttpHeadersTest);
+ UNIT_TEST(TestAddOperation1Arg);
+ UNIT_TEST(TestAddOperation2Args);
+ UNIT_TEST(TestAddOrReplaceOperation1Arg);
+ UNIT_TEST(TestAddOrReplaceOperation2Args);
+ UNIT_TEST(TestAddHeaderTemplateness);
UNIT_TEST(TestFindHeader);
- UNIT_TEST_SUITE_END();
-
-private:
+ UNIT_TEST_SUITE_END();
+
+private:
typedef void (*TAddHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value);
typedef void (*TAddOrReplaceHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value);
-
-public:
- void TestAddOperation1Arg();
- void TestAddOperation2Args();
- void TestAddOrReplaceOperation1Arg();
- void TestAddOrReplaceOperation2Args();
- void TestAddHeaderTemplateness();
+
+public:
+ void TestAddOperation1Arg();
+ void TestAddOperation2Args();
+ void TestAddOrReplaceOperation1Arg();
+ void TestAddOrReplaceOperation2Args();
+ void TestAddHeaderTemplateness();
void TestFindHeader();
-
-private:
+
+private:
static void AddHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
headers.AddHeader(THttpInputHeader(TString(name), TString(value)));
- }
-
+ }
+
static void AddHeaderImpl2Args(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
headers.AddHeader(TString(name), TString(value));
- }
-
+ }
+
static void AddOrReplaceHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
headers.AddOrReplaceHeader(THttpInputHeader(TString(name), TString(value)));
}
@@ -81,91 +81,91 @@ private:
headers.AddOrReplaceHeader(TString(name), TString(value));
}
- void DoTestAddOperation(TAddHeaderFunction);
+ void DoTestAddOperation(TAddHeaderFunction);
void DoTestAddOrReplaceOperation(TAddHeaderFunction, TAddOrReplaceHeaderFunction);
-};
-
-UNIT_TEST_SUITE_REGISTRATION(THttpHeadersTest);
-
-void THttpHeadersTest::TestAddOperation1Arg() {
- DoTestAddOperation(AddHeaderImpl1Arg);
-}
-void THttpHeadersTest::TestAddOperation2Args() {
- DoTestAddOperation(AddHeaderImpl2Args);
-}
-
-void THttpHeadersTest::TestAddOrReplaceOperation1Arg() {
+};
+
+UNIT_TEST_SUITE_REGISTRATION(THttpHeadersTest);
+
+void THttpHeadersTest::TestAddOperation1Arg() {
+ DoTestAddOperation(AddHeaderImpl1Arg);
+}
+void THttpHeadersTest::TestAddOperation2Args() {
+ DoTestAddOperation(AddHeaderImpl2Args);
+}
+
+void THttpHeadersTest::TestAddOrReplaceOperation1Arg() {
DoTestAddOrReplaceOperation(AddHeaderImpl1Arg, AddOrReplaceHeaderImpl1Arg);
-}
-void THttpHeadersTest::TestAddOrReplaceOperation2Args() {
+}
+void THttpHeadersTest::TestAddOrReplaceOperation2Args() {
DoTestAddOrReplaceOperation(AddHeaderImpl2Args, AddOrReplaceHeaderImpl2Args);
-}
-
-void THttpHeadersTest::DoTestAddOperation(TAddHeaderFunction addHeader) {
- THttpHeaders h1;
-
- addHeader(h1, "h1", "v1");
- addHeader(h1, "h2", "v1");
-
- addHeader(h1, "h3", "v1");
- addHeader(h1, "h3", "v2");
- addHeader(h1, "h3", "v2");
-
- THeadersExistence h2;
-
- h2.Add("h1", "v1");
- h2.Add("h2", "v1");
-
- h2.Add("h3", "v1");
- h2.Add("h3", "v2");
- h2.Add("h3", "v2");
-
- UNIT_ASSERT(h2 == h1);
-}
-
-// Sorry, but AddOrReplaceHeader replaces only first occurence
+}
+
+void THttpHeadersTest::DoTestAddOperation(TAddHeaderFunction addHeader) {
+ THttpHeaders h1;
+
+ addHeader(h1, "h1", "v1");
+ addHeader(h1, "h2", "v1");
+
+ addHeader(h1, "h3", "v1");
+ addHeader(h1, "h3", "v2");
+ addHeader(h1, "h3", "v2");
+
+ THeadersExistence h2;
+
+ h2.Add("h1", "v1");
+ h2.Add("h2", "v1");
+
+ h2.Add("h3", "v1");
+ h2.Add("h3", "v2");
+ h2.Add("h3", "v2");
+
+ UNIT_ASSERT(h2 == h1);
+}
+
+// Sorry, but AddOrReplaceHeader replaces only first occurence
void THttpHeadersTest::DoTestAddOrReplaceOperation(TAddHeaderFunction addHeader, TAddOrReplaceHeaderFunction addOrReplaceHeader) {
- THttpHeaders h1;
-
- addHeader(h1, "h1", "v1");
-
+ THttpHeaders h1;
+
+ addHeader(h1, "h1", "v1");
+
addOrReplaceHeader(h1, "h2", "v1");
addOrReplaceHeader(h1, "h2", "v2");
addOrReplaceHeader(h1, "h2", "v3");
- addHeader(h1, "h2", "v4");
-
- addHeader(h1, "h3", "v1");
- addHeader(h1, "h3", "v2");
+ addHeader(h1, "h2", "v4");
+
+ addHeader(h1, "h3", "v1");
+ addHeader(h1, "h3", "v2");
addOrReplaceHeader(h1, "h3", "v3");
-
- THeadersExistence h2;
-
- h2.Add("h1", "v1");
-
- h2.Add("h2", "v3");
- h2.Add("h2", "v4");
-
- h2.Add("h3", "v2");
- h2.Add("h3", "v3");
-
- UNIT_ASSERT(h2 == h1);
-}
-
-void THttpHeadersTest::TestAddHeaderTemplateness() {
- THttpHeaders h1;
- h1.AddHeader("h1", "v1");
+
+ THeadersExistence h2;
+
+ h2.Add("h1", "v1");
+
+ h2.Add("h2", "v3");
+ h2.Add("h2", "v4");
+
+ h2.Add("h3", "v2");
+ h2.Add("h3", "v3");
+
+ UNIT_ASSERT(h2 == h1);
+}
+
+void THttpHeadersTest::TestAddHeaderTemplateness() {
+ THttpHeaders h1;
+ h1.AddHeader("h1", "v1");
h1.AddHeader("h2", TString("v2"));
h1.AddHeader("h3", TStringBuf("v3"));
h1.AddHeader("h4", TStringBuf("v4"));
-
- THeadersExistence h2;
- h2.Add("h1", "v1");
- h2.Add("h2", "v2");
- h2.Add("h3", "v3");
- h2.Add("h4", "v4");
-
- UNIT_ASSERT(h1 == h2);
-}
+
+ THeadersExistence h2;
+ h2.Add("h1", "v1");
+ h2.Add("h2", "v2");
+ h2.Add("h3", "v3");
+ h2.Add("h4", "v4");
+
+ UNIT_ASSERT(h1 == h2);
+}
void THttpHeadersTest::TestFindHeader() {
THttpHeaders sut;
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp
index 4384caf0cf..f6951f68cd 100644
--- a/library/cpp/http/misc/httpreqdata.cpp
+++ b/library/cpp/http/misc/httpreqdata.cpp
@@ -21,7 +21,7 @@ TBaseServerRequestData::TBaseServerRequestData(const char* qs, SOCKET s)
, Path(nullptr)
, Search((char*)qs)
, SearchLength(qs ? strlen(qs) : 0)
- , OrigSearch(Search, SearchLength)
+ , OrigSearch(Search, SearchLength)
, Socket(s)
, BeginTime(MicroSeconds())
{
@@ -110,7 +110,7 @@ const char* TBaseServerRequestData::Environment(const char* key) const {
void TBaseServerRequestData::Clear() {
HeadersIn_.clear();
Addr = Path = Search = nullptr;
- OrigSearch = {};
+ OrigSearch = {};
SearchLength = 0;
Host.clear();
Port.clear();
@@ -174,8 +174,8 @@ bool TBaseServerRequestData::Parse(const char* origReq) {
} else {
SearchLength = 0;
}
- OrigSearch = {Search, SearchLength};
-
+ OrigSearch = {Search, SearchLength};
+
return true;
}
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h
index 09389fa4af..16e59c4d78 100644
--- a/library/cpp/http/misc/httpreqdata.h
+++ b/library/cpp/http/misc/httpreqdata.h
@@ -51,10 +51,10 @@ public:
return TStringBuf(Search, SearchLength);
}
- TStringBuf OrigQueryStringBuf() const {
- return OrigSearch;
- }
-
+ TStringBuf OrigQueryStringBuf() const {
+ return OrigSearch;
+ }
+
void AppendQueryString(const char* str, size_t length);
const char* RemoteAddr() const;
void SetRemoteAddr(TStringBuf addr);
@@ -94,7 +94,7 @@ private:
char* Path;
char* Search;
size_t SearchLength; // length of Search
- TStringBuf OrigSearch;
+ TStringBuf OrigSearch;
THttpHeadersContainer HeadersIn_;
mutable char AddrData[INET6_ADDRSTRLEN];
SOCKET Socket;
diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp
index a0ae26ea84..e7f16ef27c 100644
--- a/library/cpp/http/misc/httpreqdata_ut.cpp
+++ b/library/cpp/http/misc/httpreqdata_ut.cpp
@@ -51,9 +51,9 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
// This should work
UNIT_ASSERT(rd.Parse(" /yandsearch?&gta=fake&haha=da HTTP 1.1 OK"));
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "&gta=fake&haha=da");
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf());
-
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "&gta=fake&haha=da");
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf());
+
rd.Scan();
UNIT_ASSERT(rd.CgiParam.Has("gta", "fake"));
UNIT_ASSERT(rd.CgiParam.Has("haha", "da"));
@@ -63,27 +63,27 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
}
Y_UNIT_TEST(Ctor) {
- const TString qs("gta=fake&haha=da");
- TServerRequestData rd(qs.c_str());
-
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
- UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
-
+ const TString qs("gta=fake&haha=da");
+ TServerRequestData rd(qs.c_str());
+
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
+ UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
+
UNIT_ASSERT(rd.CgiParam.Has("gta"));
UNIT_ASSERT(rd.CgiParam.Has("haha"));
UNIT_ASSERT(!rd.CgiParam.Has("no-param"));
}
Y_UNIT_TEST(HashCut) {
- const TString qs("&gta=fake&haha=da");
- const TString header = " /yandsearch?" + qs + "#&uberParam=yes&q=? HTTP 1.1 OK";
-
+ const TString qs("&gta=fake&haha=da");
+ const TString header = " /yandsearch?" + qs + "#&uberParam=yes&q=? HTTP 1.1 OK";
+
TServerRequestData rd;
- rd.Parse(header.c_str());
+ rd.Parse(header.c_str());
+
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
+ UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
- UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
-
rd.Scan();
UNIT_ASSERT(rd.CgiParam.Has("gta"));
UNIT_ASSERT(rd.CgiParam.Has("haha"));
@@ -94,9 +94,9 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
TServerRequestData rd;
rd.Parse(" /y#ndsearch?&gta=fake&haha=da&uberParam=yes&q=? HTTP 1.1 OK");
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "");
- UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), "");
-
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "");
+ UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), "");
+
rd.Scan();
UNIT_ASSERT(rd.CgiParam.empty());
}
@@ -105,29 +105,29 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
TServerRequestData rd;
rd.Parse(" /yandsearch?#");
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), "");
- UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), "");
-
+ 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());
+ 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());
-
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs);
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf());
+
constexpr TStringBuf appendix = "gta=true&gta=new";
rd.AppendQueryString(appendix.data(), appendix.size());
-
- UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs + '&' + appendix);
- UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
-
+
+ UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs + '&' + appendix);
+ UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs);
+
rd.Scan();
UNIT_ASSERT(rd.CgiParam.Has("gta", "true"));
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 6683052c8e..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -321,8 +321,8 @@ public:
};
void ListenSocket() {
- TThread::SetCurrentThreadName(Options_.ListenThreadName.c_str());
-
+ TThread::SetCurrentThreadName(Options_.ListenThreadName.c_str());
+
ErrorCode = 0;
TIntrusiveListWithAutoDelete<TListenSocket, TDelete> Reqs;
@@ -410,8 +410,8 @@ public:
: TImpl(
parent,
cb,
- MakeThreadPool<TSimpleThreadPool>(factory, options.UseElasticQueues, cb, options.RequestsThreadName),
- MakeThreadPool<TThreadPool>(factory, options.UseElasticQueues, nullptr, options.FailRequestsThreadName),
+ MakeThreadPool<TSimpleThreadPool>(factory, options.UseElasticQueues, cb, options.RequestsThreadName),
+ MakeThreadPool<TThreadPool>(factory, options.UseElasticQueues, nullptr, options.FailRequestsThreadName),
options) {
}
@@ -461,17 +461,17 @@ public:
private:
template <class TThreadPool_>
- static THolder<IThreadPool> MakeThreadPool(IThreadFactory* factory, bool elastic, ICallBack* callback = nullptr, const TString& threadName = {}) {
+ static THolder<IThreadPool> MakeThreadPool(IThreadFactory* factory, bool elastic, ICallBack* callback = nullptr, const TString& threadName = {}) {
if (!factory) {
factory = SystemThreadFactory();
}
THolder<IThreadPool> pool;
- const auto params = IThreadPool::TParams().SetFactory(factory).SetThreadName(threadName);
+ const auto params = IThreadPool::TParams().SetFactory(factory).SetThreadName(threadName);
if (callback) {
- pool = MakeHolder<TThreadPoolBinder<TThreadPool_, THttpServer::ICallBack>>(callback, params);
+ pool = MakeHolder<TThreadPoolBinder<TThreadPool_, THttpServer::ICallBack>>(callback, params);
} else {
- pool = MakeHolder<TThreadPool_>(params);
+ pool = MakeHolder<TThreadPool_>(params);
}
if (elastic) {
@@ -631,20 +631,20 @@ bool TClientRequest::Reply(void* /*ThreadSpecificResource*/) {
bool TClientRequest::IsLocal() const {
return HasLocalAddress(Socket());
-}
-
-bool TClientRequest::CheckLoopback() {
- bool isLocal = false;
-
- try {
- isLocal = IsLocal();
- } catch (const yexception& e) {
+}
+
+bool TClientRequest::CheckLoopback() {
+ bool isLocal = false;
+
+ try {
+ isLocal = IsLocal();
+ } catch (const yexception& e) {
Output() << "HTTP/1.0 500 Oops\r\n\r\n"
<< e.what() << "\r\n";
return false;
- }
-
- if (!isLocal) {
+ }
+
+ if (!isLocal) {
Output() << "HTTP/1.0 403 Permission denied\r\n"
"Content-Type: text/html; charset=windows-1251\r\n"
"Connection: close\r\n"
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 8510261b72..38eda0e5e7 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -131,14 +131,14 @@ public:
return *this;
}
- inline THttpServerOptions& SetThreadsName(const TString& listenThreadName, const TString& requestsThreadName, const TString& failRequestsThreadName) noexcept {
- ListenThreadName = listenThreadName;
- RequestsThreadName = requestsThreadName;
- FailRequestsThreadName = failRequestsThreadName;
-
- return *this;
- }
-
+ inline THttpServerOptions& SetThreadsName(const TString& listenThreadName, const TString& requestsThreadName, const TString& failRequestsThreadName) noexcept {
+ ListenThreadName = listenThreadName;
+ RequestsThreadName = requestsThreadName;
+ FailRequestsThreadName = failRequestsThreadName;
+
+ return *this;
+ }
+
struct TAddr {
TString Addr;
ui16 Port;
@@ -169,8 +169,8 @@ public:
TDuration PollTimeout; // timeout of TSocketPoller::WaitT call
TDuration ExpirationTimeout; // drop inactive connections after ExpirationTimeout (should be > 0)
-
- TString ListenThreadName = "HttpListen";
- TString RequestsThreadName = "HttpServer";
- TString FailRequestsThreadName = "HttpServer";
+
+ TString ListenThreadName = "HttpListen";
+ TString RequestsThreadName = "HttpServer";
+ TString FailRequestsThreadName = "HttpServer";
};
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp
index 59dda03fe7..c61e8d1dc4 100644
--- a/library/cpp/json/writer/json_value.cpp
+++ b/library/cpp/json/writer/json_value.cpp
@@ -427,38 +427,38 @@ namespace NJson {
bool TJsonValue::GetBooleanSafe() const {
if (Type != JSON_BOOLEAN)
ythrow TJsonException() << "Not a boolean";
-
+
return Value.Boolean;
}
-
+
long long TJsonValue::GetIntegerSafe() const {
if (!IsInteger())
ythrow TJsonException() << "Not an integer";
-
+
return GetInteger();
}
-
+
unsigned long long TJsonValue::GetUIntegerSafe() const {
if (!IsUInteger())
ythrow TJsonException() << "Not an unsigned integer";
-
+
return GetUInteger();
}
-
+
double TJsonValue::GetDoubleSafe() const {
if (!IsDouble())
ythrow TJsonException() << "Not a double";
-
+
return GetDouble();
}
-
+
const TString& TJsonValue::GetStringSafe() const {
if (Type != JSON_STRING)
ythrow TJsonException() << "Not a string";
-
+
return Value.String;
}
-
+
bool TJsonValue::GetBooleanSafe(const bool defaultValue) const {
if (Type == JSON_UNDEFINED)
return defaultValue;
@@ -497,10 +497,10 @@ namespace NJson {
const TJsonValue::TMapType& TJsonValue::GetMapSafe() const {
if (Type != JSON_MAP)
ythrow TJsonException() << "Not a map";
-
+
return *Value.Map;
}
-
+
TJsonValue::TMapType& TJsonValue::GetMapSafe() {
return const_cast<TJsonValue::TMapType&>(const_cast<const TJsonValue*>(this)->GetMapSafe());
}
@@ -508,10 +508,10 @@ namespace NJson {
const TJsonValue::TArray& TJsonValue::GetArraySafe() const {
if (Type != JSON_ARRAY)
ythrow TJsonException() << "Not an array";
-
+
return *Value.Array;
}
-
+
TJsonValue::TArray& TJsonValue::GetArraySafe() {
return const_cast<TJsonValue::TArray&>(const_cast<const TJsonValue*>(this)->GetArraySafe());
}
diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h
index b634613f26..3f0f50bc4c 100644
--- a/library/cpp/json/writer/json_value.h
+++ b/library/cpp/json/writer/json_value.h
@@ -129,7 +129,7 @@ namespace NJson {
unsigned long long GetUIntegerSafe(unsigned long long defaultValue) const;
double GetDoubleSafe(double defaultValue) const;
TString GetStringSafe(const TString& defaultValue) const;
-
+
bool GetBooleanRobust() const noexcept;
long long GetIntegerRobust() const noexcept;
unsigned long long GetUIntegerRobust() const noexcept;
diff --git a/library/cpp/logger/element.cpp b/library/cpp/logger/element.cpp
index e39b4607bf..b510fe16e1 100644
--- a/library/cpp/logger/element.cpp
+++ b/library/cpp/logger/element.cpp
@@ -2,7 +2,7 @@
#include "element.h"
#include <utility>
-
+
TLogElement::TLogElement(const TLog* parent)
: Parent_(parent)
, Priority_(Parent_->DefaultPriority())
@@ -25,10 +25,10 @@ TLogElement::~TLogElement() {
}
void TLogElement::DoFlush() {
- if (IsNull()) {
- return;
- }
-
+ if (IsNull()) {
+ return;
+ }
+
const size_t filled = Filled();
if (filled) {
diff --git a/library/cpp/logger/element_ut.cpp b/library/cpp/logger/element_ut.cpp
index fa7fa835bf..32edc52dfb 100644
--- a/library/cpp/logger/element_ut.cpp
+++ b/library/cpp/logger/element_ut.cpp
@@ -1,39 +1,39 @@
-#include "log.h"
-#include "element.h"
-#include "stream.h"
-
+#include "log.h"
+#include "element.h"
+#include "stream.h"
+
#include <util/generic/string.h>
-#include <util/stream/str.h>
-#include <util/generic/ptr.h>
+#include <util/stream/str.h>
+#include <util/generic/ptr.h>
#include <utility>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-class TLogElementTest: public TTestBase {
- UNIT_TEST_SUITE(TLogElementTest);
- UNIT_TEST(TestMoveCtor);
- UNIT_TEST_SUITE_END();
-
-public:
- void TestMoveCtor();
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TLogElementTest);
-
-void TLogElementTest::TestMoveCtor() {
- TStringStream output;
+
+class TLogElementTest: public TTestBase {
+ UNIT_TEST_SUITE(TLogElementTest);
+ UNIT_TEST(TestMoveCtor);
+ UNIT_TEST_SUITE_END();
+
+public:
+ void TestMoveCtor();
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TLogElementTest);
+
+void TLogElementTest::TestMoveCtor() {
+ TStringStream output;
TLog log(MakeHolder<TStreamLogBackend>(&output));
-
+
THolder<TLogElement> src = MakeHolder<TLogElement>(&log);
-
+
TString message = "Hello, World!";
- (*src) << message;
-
+ (*src) << message;
+
THolder<TLogElement> dst = MakeHolder<TLogElement>(std::move(*src));
-
- src.Destroy();
- UNIT_ASSERT(output.Str() == "");
-
- dst.Destroy();
- UNIT_ASSERT(output.Str() == message);
-}
+
+ src.Destroy();
+ UNIT_ASSERT(output.Str() == "");
+
+ dst.Destroy();
+ UNIT_ASSERT(output.Str() == message);
+}
diff --git a/library/cpp/logger/thread.cpp b/library/cpp/logger/thread.cpp
index afda2404f5..0ccf9e374b 100644
--- a/library/cpp/logger/thread.cpp
+++ b/library/cpp/logger/thread.cpp
@@ -112,7 +112,7 @@ public:
private:
TLogBackend* Slave_;
- TThreadPool Queue_{"ThreadedLogBack"};
+ TThreadPool Queue_{"ThreadedLogBack"};
const std::function<void()> QueueOverflowCallback_;
};
diff --git a/library/cpp/logger/ut/ya.make b/library/cpp/logger/ut/ya.make
index 3e990ab8d2..2a461c1353 100644
--- a/library/cpp/logger/ut/ya.make
+++ b/library/cpp/logger/ut/ya.make
@@ -12,7 +12,7 @@ SRCDIR(library/cpp/logger)
SRCS(
log_ut.cpp
- element_ut.cpp
+ element_ut.cpp
rotating_file_ut.cpp
composite_ut.cpp
)
diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp
index a3f7827027..174dde4bf7 100644
--- a/library/cpp/threading/task_scheduler/task_scheduler.cpp
+++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp
@@ -189,8 +189,8 @@ void TTaskScheduler::ChooseFromQueue(TQueueIterator& toWait) {
}
void TTaskScheduler::WorkerFunc(TWorkerThread* thread) {
- TThread::SetCurrentThreadName("TaskSchedWorker");
-
+ TThread::SetCurrentThreadName("TaskSchedWorker");
+
TQueueIterator toWait = Queue_.end();
ITaskRef toDo;
diff --git a/library/cpp/tvmauth/client/misc/threaded_updater.cpp b/library/cpp/tvmauth/client/misc/threaded_updater.cpp
index c1b3cca5fd..5d21ce67a7 100644
--- a/library/cpp/tvmauth/client/misc/threaded_updater.cpp
+++ b/library/cpp/tvmauth/client/misc/threaded_updater.cpp
@@ -4,7 +4,7 @@
#include <util/string/builder.h>
#include <util/system/spin_wait.h>
-#include <util/system/thread.h>
+#include <util/system/thread.h>
namespace NTvmAuth {
TThreadedUpdaterBase::TThreadedUpdaterBase(TDuration workerAwakingPeriod,
@@ -86,7 +86,7 @@ namespace NTvmAuth {
}
void* TThreadedUpdaterBase::WorkerWrap(void* arg) {
- TThread::SetCurrentThreadName("TicketParserUpd");
+ TThread::SetCurrentThreadName("TicketParserUpd");
TThreadedUpdaterBase& this_ = *reinterpret_cast<TThreadedUpdaterBase*>(arg);
this_.Started_.Signal();
this_.LogDebug("Thread-worker started");