diff options
author | feldsherov <feldsherov@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
commit | 077ab504815199e62ffc54daee873cf1d6b64297 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/http/server | |
parent | e73723ec73b27276cd45b9b46b752138a51d669c (diff) | |
download | ydb-077ab504815199e62ffc54daee873cf1d6b64297.tar.gz |
Restoring authorship annotation for <feldsherov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/server')
-rw-r--r-- | library/cpp/http/server/conn.cpp | 24 | ||||
-rw-r--r-- | library/cpp/http/server/conn.h | 4 | ||||
-rw-r--r-- | library/cpp/http/server/http.cpp | 16 | ||||
-rw-r--r-- | library/cpp/http/server/http.h | 4 | ||||
-rw-r--r-- | library/cpp/http/server/http_ut.cpp | 74 |
5 files changed, 61 insertions, 61 deletions
diff --git a/library/cpp/http/server/conn.cpp b/library/cpp/http/server/conn.cpp index eee1e95a5f..38a76c4c30 100644 --- a/library/cpp/http/server/conn.cpp +++ b/library/cpp/http/server/conn.cpp @@ -26,14 +26,14 @@ public: return &HO_; } - inline void Reset() { - if (S_ != INVALID_SOCKET) { - // send RST packet to client - S_.SetLinger(true, 0); - S_.Close(); - } - } - + inline void Reset() { + if (S_ != INVALID_SOCKET) { + // send RST packet to client + S_.SetLinger(true, 0); + S_.Close(); + } + } + private: TSocket S_; TSocketInput SI_; @@ -63,7 +63,7 @@ THttpInput* THttpServerConn::Input() noexcept { THttpOutput* THttpServerConn::Output() noexcept { return Impl_->Output(); } - -void THttpServerConn::Reset() { - return Impl_->Reset(); -} + +void THttpServerConn::Reset() { + return Impl_->Reset(); +} diff --git a/library/cpp/http/server/conn.h b/library/cpp/http/server/conn.h index 181bc3fc5c..3aa5329af4 100644 --- a/library/cpp/http/server/conn.h +++ b/library/cpp/http/server/conn.h @@ -29,8 +29,8 @@ public: return Output()->CanBeKeepAlive(); } - void Reset(); - + void Reset(); + private: class TImpl; THolder<TImpl> Impl_; diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 00ca18e1cb..128583bdd7 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -668,14 +668,14 @@ void TClientRequest::ReleaseConnection() { } } -void TClientRequest::ResetConnection() { - if (HttpConn_) { - // send RST packet to client - HttpConn_->Reset(); - HttpConn_.Destroy(); - } -} - +void TClientRequest::ResetConnection() { + if (HttpConn_) { + // send RST packet to client + HttpConn_->Reset(); + HttpConn_.Destroy(); + } +} + void TClientRequest::Process(void* ThreadSpecificResource) { THolder<TClientRequest> this_(this); diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h index 1328bdce3f..b292d38f27 100644 --- a/library/cpp/http/server/http.h +++ b/library/cpp/http/server/http.h @@ -128,8 +128,8 @@ public: void ReleaseConnection(); - void ResetConnection(); - + void ResetConnection(); + private: /* * Processes the request after 'connection' been created and 'Headers' been read diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp index 16f72df972..cc62bb988e 100644 --- a/library/cpp/http/server/http_ut.cpp +++ b/library/cpp/http/server/http_ut.cpp @@ -481,29 +481,29 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { ExceptionMessage = CurrentExceptionMessage(); } - TString ExceptionMessage; - }; - - class TResetConnectionServer: public THttpServer::ICallBack { - class TRequest: public TClientRequest { - public: - bool Reply(void* /*tsr*/) override { - Output() << "HTTP/1.1"; - ResetConnection(); - - return true; - } - }; - + TString ExceptionMessage; + }; + + class TResetConnectionServer: public THttpServer::ICallBack { + class TRequest: public TClientRequest { + public: + bool Reply(void* /*tsr*/) override { + Output() << "HTTP/1.1"; + ResetConnection(); + + return true; + } + }; + public: - TClientRequest* CreateClient() override { - return new TRequest(); - } - - void OnException() override { - ExceptionMessage = CurrentExceptionMessage(); - } - + TClientRequest* CreateClient() override { + return new TRequest(); + } + + void OnException() override { + ExceptionMessage = CurrentExceptionMessage(); + } + TString ExceptionMessage; }; @@ -526,21 +526,21 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } }; - Y_UNIT_TEST(TTestResetConnection) { - TPortManager pm; - const ui16 port = pm.GetPort(); - - TResetConnectionServer serverImpl; - THttpServer server(&serverImpl, THttpServer::TOptions(port)); - UNIT_ASSERT(server.Start()); - - TTestRequest r(port, "request"); - - UNIT_ASSERT_EXCEPTION_CONTAINS(r.Execute(), TSystemError, "Connection reset by peer"); - - server.Stop(); - }; - + Y_UNIT_TEST(TTestResetConnection) { + TPortManager pm; + const ui16 port = pm.GetPort(); + + TResetConnectionServer serverImpl; + THttpServer server(&serverImpl, THttpServer::TOptions(port)); + UNIT_ASSERT(server.Start()); + + TTestRequest r(port, "request"); + + UNIT_ASSERT_EXCEPTION_CONTAINS(r.Execute(), TSystemError, "Connection reset by peer"); + + server.Stop(); + }; + Y_UNIT_TEST(TTestReleaseConnection) { TPortManager pm; const ui16 port = pm.GetPort(); |