Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.cpp
Show All 33 Lines | |||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <cstring> | #include <cstring> | ||||
#include <future> | #include <future> | ||||
/** Maximum size of http request (request line + headers) */ | /** Maximum size of http request (request line + headers) */ | ||||
static const size_t MAX_HEADERS_SIZE = 8192; | static const size_t MAX_HEADERS_SIZE = 8192; | ||||
/** HTTP request work item */ | /** HTTP request work item */ | ||||
class HTTPWorkItem : public HTTPClosure { | class HTTPWorkItem final : public HTTPClosure { | ||||
public: | public: | ||||
HTTPWorkItem(Config &_config, std::unique_ptr<HTTPRequest> _req, | HTTPWorkItem(Config &_config, std::unique_ptr<HTTPRequest> _req, | ||||
const std::string &_path, const HTTPRequestHandler &_func) | const std::string &_path, const HTTPRequestHandler &_func) | ||||
: req(std::move(_req)), path(_path), func(_func), config(&_config) {} | : req(std::move(_req)), path(_path), func(_func), config(&_config) {} | ||||
void operator()() override { func(*config, req.get(), path); } | void operator()() override { func(*config, req.get(), path); } | ||||
std::unique_ptr<HTTPRequest> req; | std::unique_ptr<HTTPRequest> req; | ||||
▲ Show 20 Lines • Show All 621 Lines • Show Last 20 Lines |