aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/http.h
diff options
context:
space:
mode:
authorsomov <somov@yandex-team.ru>2022-02-10 16:45:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:47 +0300
commita5950576e397b1909261050b8c7da16db58f10b1 (patch)
tree7ba7677f6a4c3e19e2cefab34d16df2c8963b4d4 /library/cpp/http/server/http.h
parent81eddc8c0b55990194e112b02d127b87d54164a9 (diff)
downloadydb-a5950576e397b1909261050b8c7da16db58f10b1.tar.gz
Restoring authorship annotation for <somov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/server/http.h')
-rw-r--r--library/cpp/http/server/http.h126
1 files changed, 63 insertions, 63 deletions
diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h
index b292d38f27..d0bc92ff7d 100644
--- a/library/cpp/http/server/http.h
+++ b/library/cpp/http/server/http.h
@@ -15,75 +15,75 @@ class TClientRequest;
class TClientConnection;
class THttpServer {
- friend class TClientRequest;
- friend class TClientConnection;
+ friend class TClientRequest;
+ friend class TClientConnection;
-public:
- class ICallBack {
+public:
+ class ICallBack {
public:
- struct TFailLogData {
- int failstate;
+ struct TFailLogData {
+ int failstate;
TString url;
- };
+ };
- virtual ~ICallBack() {
- }
+ virtual ~ICallBack() {
+ }
- virtual void OnFailRequest(int /*failstate*/) {
- }
+ virtual void OnFailRequest(int /*failstate*/) {
+ }
- virtual void OnFailRequestEx(const TFailLogData& d) {
- OnFailRequest(d.failstate);
- }
+ virtual void OnFailRequestEx(const TFailLogData& d) {
+ OnFailRequest(d.failstate);
+ }
- virtual void OnException() {
- }
+ virtual void OnException() {
+ }
- virtual void OnMaxConn() {
- }
+ virtual void OnMaxConn() {
+ }
- virtual TClientRequest* CreateClient() = 0;
+ virtual TClientRequest* CreateClient() = 0;
- virtual void OnListenStart() {
- }
+ virtual void OnListenStart() {
+ }
- virtual void OnListenStop() {
- }
+ virtual void OnListenStop() {
+ }
- virtual void OnWait() {
- }
+ virtual void OnWait() {
+ }
virtual void* CreateThreadSpecificResource() {
return nullptr;
- }
+ }
- virtual void DestroyThreadSpecificResource(void*) {
- }
- };
+ virtual void DestroyThreadSpecificResource(void*) {
+ }
+ };
- typedef THttpServerOptions TOptions;
+ typedef THttpServerOptions TOptions;
typedef TSimpleSharedPtr<IThreadPool> TMtpQueueRef;
THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr);
THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options = TOptions());
- virtual ~THttpServer();
+ virtual ~THttpServer();
- bool Start();
+ bool Start();
- // shutdown a.s.a.p.
- void Stop();
+ // shutdown a.s.a.p.
+ void Stop();
// graceful shutdown with serving all already open connections
- void Shutdown();
+ void Shutdown();
- void Wait();
- int GetErrorCode();
- const char* GetError();
- void RestartRequestThreads(ui32 nTh, ui32 maxQS);
+ void Wait();
+ int GetErrorCode();
+ const char* GetError();
+ void RestartRequestThreads(ui32 nTh, ui32 maxQS);
const TOptions& Options() const noexcept;
- i64 GetClientCount() const;
+ i64 GetClientCount() const;
- class TImpl;
+ class TImpl;
size_t GetRequestQueueSize() const;
size_t GetFailQueueSize() const;
@@ -92,30 +92,30 @@ public:
static TAtomicBase AcceptReturnsInvalidSocketCounter();
-private:
+private:
bool MaxRequestsReached() const;
private:
- THolder<TImpl> Impl_;
+ THolder<TImpl> Impl_;
};
/**
* @deprecated Use TRequestReplier instead
*/
class TClientRequest: public IObjectInQueue {
- friend class THttpServer::TImpl;
+ friend class THttpServer::TImpl;
-public:
- TClientRequest();
+public:
+ TClientRequest();
~TClientRequest() override;
inline THttpInput& Input() noexcept {
- return *HttpConn_->Input();
- }
+ return *HttpConn_->Input();
+ }
inline THttpOutput& Output() noexcept {
- return *HttpConn_->Output();
- }
+ return *HttpConn_->Output();
+ }
THttpServer* HttpServ() const noexcept;
const TSocket& Socket() const noexcept;
@@ -123,29 +123,29 @@ public:
TInstant AcceptMoment() const noexcept;
bool IsLocal() const;
- bool CheckLoopback();
- void ProcessFailRequest(int failstate);
+ bool CheckLoopback();
+ void ProcessFailRequest(int failstate);
void ReleaseConnection();
void ResetConnection();
-private:
- /*
- * Processes the request after 'connection' been created and 'Headers' been read
- * Returns 'false' if the processing must be continued by the next handler,
- * 'true' otherwise ('this' will be deleted)
- */
- virtual bool Reply(void* ThreadSpecificResource);
+private:
+ /*
+ * Processes the request after 'connection' been created and 'Headers' been read
+ * Returns 'false' if the processing must be continued by the next handler,
+ * 'true' otherwise ('this' will be deleted)
+ */
+ virtual bool Reply(void* ThreadSpecificResource);
void Process(void* ThreadSpecificResource) override;
-public:
+public:
TVector<std::pair<TString, TString>> ParsedHeaders;
TString RequestString;
-private:
- THolder<TClientConnection> Conn_;
- THolder<THttpServerConn> HttpConn_;
+private:
+ THolder<TClientConnection> Conn_;
+ THolder<THttpServerConn> HttpConn_;
};
class TRequestReplier: public TClientRequest {