aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/options.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/http/server/options.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/server/options.h')
-rw-r--r--library/cpp/http/server/options.h130
1 files changed, 65 insertions, 65 deletions
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 38eda0e5e7..28ce8be0e1 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -1,49 +1,49 @@
#pragma once
-
-#include <util/network/ip.h>
-#include <util/network/init.h>
+
+#include <util/network/ip.h>
+#include <util/network/init.h>
#include <util/network/address.h>
#include <util/generic/size_literals.h>
#include <util/generic/string.h>
-#include <util/generic/vector.h>
+#include <util/generic/vector.h>
#include <util/datetime/base.h>
-
-class THttpServerOptions {
-public:
+
+class THttpServerOptions {
+public:
inline THttpServerOptions(ui16 port = 17000) noexcept
: Port(port)
- {
- }
-
+ {
+ }
+
using TBindAddresses = TVector<TNetworkAddress>;
- void BindAddresses(TBindAddresses& ret) const;
-
+ void BindAddresses(TBindAddresses& ret) const;
+
inline THttpServerOptions& AddBindAddress(const TString& address, ui16 port) {
const TAddr addr = {
- address,
- port,
- };
-
+ address,
+ port,
+ };
+
BindSockaddr.push_back(addr);
return *this;
}
inline THttpServerOptions& AddBindAddress(const TString& address) {
return AddBindAddress(address, 0);
- }
-
+ }
+
inline THttpServerOptions& EnableKeepAlive(bool enable) noexcept {
- KeepAliveEnabled = enable;
-
- return *this;
- }
-
+ KeepAliveEnabled = enable;
+
+ return *this;
+ }
+
inline THttpServerOptions& EnableCompression(bool enable) noexcept {
- CompressionEnabled = enable;
-
- return *this;
- }
-
+ CompressionEnabled = enable;
+
+ return *this;
+ }
+
inline THttpServerOptions& EnableRejectExcessConnections(bool enable) noexcept {
RejectExcessConnections = enable;
@@ -63,11 +63,11 @@ public:
}
inline THttpServerOptions& SetThreads(ui32 threads) noexcept {
- nThreads = threads;
-
- return *this;
- }
-
+ nThreads = threads;
+
+ return *this;
+ }
+
/// Default interface name to bind the server. Used when none of BindAddress are provided.
inline THttpServerOptions& SetHost(const TString& host) noexcept {
Host = host;
@@ -77,35 +77,35 @@ public:
/// Default port to bind the server. Used when none of BindAddress are provided.
inline THttpServerOptions& SetPort(ui16 port) noexcept {
- Port = port;
-
- return *this;
- }
-
+ Port = port;
+
+ return *this;
+ }
+
inline THttpServerOptions& SetMaxConnections(ui32 mc = 0) noexcept {
- MaxConnections = mc;
-
- return *this;
- }
-
+ MaxConnections = mc;
+
+ return *this;
+ }
+
inline THttpServerOptions& SetMaxQueueSize(ui32 mqs = 0) noexcept {
- MaxQueueSize = mqs;
-
- return *this;
- }
+ MaxQueueSize = mqs;
+
+ return *this;
+ }
inline THttpServerOptions& SetClientTimeout(const TDuration& timeout) noexcept {
- ClientTimeout = timeout;
-
- return *this;
- }
+ ClientTimeout = timeout;
+ return *this;
+ }
+
inline THttpServerOptions& SetListenBacklog(int val) noexcept {
- ListenBacklog = val;
-
- return *this;
- }
-
+ ListenBacklog = val;
+
+ return *this;
+ }
+
inline THttpServerOptions& SetOutputBufferSize(size_t val) noexcept {
OutputBufferSize = val;
@@ -149,19 +149,19 @@ public:
bool KeepAliveEnabled = true;
bool CompressionEnabled = false;
bool RejectExcessConnections = false;
- bool ReusePort = false; // set SO_REUSEPORT socket option
+ bool ReusePort = false; // set SO_REUSEPORT socket option
bool ReuseAddress = true; // set SO_REUSEADDR socket option
- TAddrs BindSockaddr;
- ui16 Port = 17000; // The port on which to run the web server
- TString Host; // DNS entry
- const char* ServerName = "YWS/1.0"; // The Web server name to return in HTTP headers
- ui32 nThreads = 0; // Thread count for requests processing
- ui32 MaxQueueSize = 0; // Max allowed request count in queue
+ TAddrs BindSockaddr;
+ ui16 Port = 17000; // The port on which to run the web server
+ TString Host; // DNS entry
+ const char* ServerName = "YWS/1.0"; // The Web server name to return in HTTP headers
+ ui32 nThreads = 0; // Thread count for requests processing
+ ui32 MaxQueueSize = 0; // Max allowed request count in queue
ui32 nFThreads = 1;
ui32 MaxFQueueSize = 0;
ui32 MaxConnections = 100;
int ListenBacklog = SOMAXCONN;
- TDuration ClientTimeout;
+ 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
@@ -173,4 +173,4 @@ public:
TString ListenThreadName = "HttpListen";
TString RequestsThreadName = "HttpServer";
TString FailRequestsThreadName = "HttpServer";
-};
+};