Config

namespace HTTPServer
class Config

Public Static Functions

static void initDefault()
static void initFromFile(const std::string &path)
static const ServerConfig &get()

Private Static Attributes

static ServerConfig d_config = {}
struct ServerConfig

Public Members

Port kPort = {443}

Server Ports

Port kRedirectionPort = {80}
bool kEnableHttps = false

Https

std::string kCertFile = {}
std::string kKeyFile = {}
bool kEnableHttpRedirection = false
std::chrono::seconds kCleanupInterval = {600}

Periodic Idle IP Cleanup

std::chrono::seconds kIdleTimeout = {300}
int kClientTimeoutSec = 5

Networking

int kMaxRequestDurationSec = 30
int kRecvBufferSize = 4096
size_t kMinThreads = 4

Threading

size_t kMaxThreads = 32
int kMaxQueueSize = 1024
int kMaxConnectionsPerIp = 10

Rate Limiting

int kMaxKeepAliveRequests = 100
double kMaxTokens = 10.0
double kRefillRate = 5.0
int kMaxHeaderBytes = 16 * 1024

HTTP Limits

int kMaxHeaderCount = 100
int kMaxTotalHeaderSize = 64 * 1024
int kMaxBodyBytes = 10 * 1024 * 1024
std::unordered_set<std::string> kAllowedMethods = {"GET", "POST",}
std::unordered_set<std::string> kAllowedVersions = {"HTTP/1.0", "HTTP/1.1",}
LogLevel kLogLevel = {LogLevel::INFO}

Logging level

bool kFileLoggingEnabled = false
std::string kFileLoggingPath = {}