Project Alice
|
#include <httplib.h>
Public Types | |
enum class | HandlerResponse { Handled , Unhandled } |
using | Handler = std::function< void(const Request &, Response &)> |
using | ExceptionHandler = std::function< void(const Request &, Response &, std::exception_ptr ep)> |
using | HandlerWithResponse = std::function< HandlerResponse(const Request &, Response &)> |
using | HandlerWithContentReader = std::function< void(const Request &, Response &, const ContentReader &content_reader)> |
using | Expect100ContinueHandler = std::function< int(const Request &, Response &)> |
Public Member Functions | |
Server () | |
virtual | ~Server () |
virtual bool | is_valid () const |
Server & | Get (const std::string &pattern, Handler handler) |
Server & | Post (const std::string &pattern, Handler handler) |
Server & | Post (const std::string &pattern, HandlerWithContentReader handler) |
Server & | Put (const std::string &pattern, Handler handler) |
Server & | Put (const std::string &pattern, HandlerWithContentReader handler) |
Server & | Patch (const std::string &pattern, Handler handler) |
Server & | Patch (const std::string &pattern, HandlerWithContentReader handler) |
Server & | Delete (const std::string &pattern, Handler handler) |
Server & | Delete (const std::string &pattern, HandlerWithContentReader handler) |
Server & | Options (const std::string &pattern, Handler handler) |
bool | set_base_dir (const std::string &dir, const std::string &mount_point=std::string()) |
bool | set_mount_point (const std::string &mount_point, const std::string &dir, Headers headers=Headers()) |
bool | remove_mount_point (const std::string &mount_point) |
Server & | set_file_extension_and_mimetype_mapping (const std::string &ext, const std::string &mime) |
Server & | set_default_file_mimetype (const std::string &mime) |
Server & | set_file_request_handler (Handler handler) |
template<class ErrorHandlerFunc > | |
Server & | set_error_handler (ErrorHandlerFunc &&handler) |
Server & | set_exception_handler (ExceptionHandler handler) |
Server & | set_pre_routing_handler (HandlerWithResponse handler) |
Server & | set_post_routing_handler (Handler handler) |
Server & | set_expect_100_continue_handler (Expect100ContinueHandler handler) |
Server & | set_logger (Logger logger) |
Server & | set_address_family (int family) |
Server & | set_tcp_nodelay (bool on) |
Server & | set_ipv6_v6only (bool on) |
Server & | set_socket_options (SocketOptions socket_options) |
Server & | set_default_headers (Headers headers) |
Server & | set_header_writer (std::function< ssize_t(Stream &, Headers &)> const &writer) |
Server & | set_keep_alive_max_count (size_t count) |
Server & | set_keep_alive_timeout (time_t sec) |
Server & | set_read_timeout (time_t sec, time_t usec=0) |
template<class Rep , class Period > | |
Server & | set_read_timeout (const std::chrono::duration< Rep, Period > &duration) |
Server & | set_write_timeout (time_t sec, time_t usec=0) |
template<class Rep , class Period > | |
Server & | set_write_timeout (const std::chrono::duration< Rep, Period > &duration) |
Server & | set_idle_interval (time_t sec, time_t usec=0) |
template<class Rep , class Period > | |
Server & | set_idle_interval (const std::chrono::duration< Rep, Period > &duration) |
Server & | set_payload_max_length (size_t length) |
bool | bind_to_port (const std::string &host, int port, int socket_flags=0) |
int | bind_to_any_port (const std::string &host, int socket_flags=0) |
bool | listen_after_bind () |
bool | listen (const std::string &host, int port, int socket_flags=0) |
bool | start_server (const std::string &host, int port, int socket_flags=0) |
bool | is_running () const |
void | wait_until_ready () const |
void | stop () |
void | decommission () |
Public Attributes | |
std::function< TaskQueue *(void)> | new_task_queue |
Protected Member Functions | |
bool | process_request (Stream &strm, const std::string &remote_addr, int remote_port, const std::string &local_addr, int local_port, bool close_connection, bool &connection_closed, const std::function< void(Request &)> &setup_request) |
Protected Attributes | |
std::atomic< socket_t > | svr_sock_ {INVALID_SOCKET} |
size_t | keep_alive_max_count_ = CPPHTTPLIB_KEEPALIVE_MAX_COUNT |
time_t | keep_alive_timeout_sec_ = CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND |
time_t | read_timeout_sec_ = CPPHTTPLIB_SERVER_READ_TIMEOUT_SECOND |
time_t | read_timeout_usec_ = CPPHTTPLIB_SERVER_READ_TIMEOUT_USECOND |
time_t | write_timeout_sec_ = CPPHTTPLIB_SERVER_WRITE_TIMEOUT_SECOND |
time_t | write_timeout_usec_ = CPPHTTPLIB_SERVER_WRITE_TIMEOUT_USECOND |
time_t | idle_interval_sec_ = CPPHTTPLIB_IDLE_INTERVAL_SECOND |
time_t | idle_interval_usec_ = CPPHTTPLIB_IDLE_INTERVAL_USECOND |
size_t | payload_max_length_ = CPPHTTPLIB_PAYLOAD_MAX_LENGTH |
using httplib::Server::ExceptionHandler = std::function<void(const Request &, Response &, std::exception_ptr ep)> |
using httplib::Server::Expect100ContinueHandler = std::function<int(const Request &, Response &)> |
using httplib::Server::Handler = std::function<void(const Request &, Response &)> |
using httplib::Server::HandlerWithContentReader = std::function<void( const Request &, Response &, const ContentReader &content_reader)> |
using httplib::Server::HandlerWithResponse = std::function<HandlerResponse(const Request &, Response &)> |
|
strong |
|
inlinevirtualdefault |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
std::function<TaskQueue *(void)> httplib::Server::new_task_queue |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |