diff options
author | trofimenkov <trofimenkov@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
commit | 30cebc2cfa79af3b577760a113e203a79450e6b6 (patch) | |
tree | 49327bf3c28fab534b04b312a39179e70f7c2763 /library/cpp/http/server | |
parent | a2d2743094c8d255cda4011b317235874db4d01c (diff) | |
download | ydb-30cebc2cfa79af3b577760a113e203a79450e6b6.tar.gz |
Restoring authorship annotation for <trofimenkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/server')
-rw-r--r-- | library/cpp/http/server/http.cpp | 38 | ||||
-rw-r--r-- | library/cpp/http/server/options.h | 24 |
2 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 128583bdd7..6683052c8e 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 38eda0e5e7..8510261b72 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"; }; |