![]() |
D++ (DPP)
C++ Discord API Bot Library
|
#include <httplib.h>
Collaboration diagram for httplib::Server:Public Types | |
| using | ExceptionHandler = std::function< void(const Request &, Response &, std::exception &e)> |
| using | Expect100ContinueHandler = std::function< int(const Request &, Response &)> |
| using | Handler = std::function< void(const Request &, Response &)> |
| enum class | HandlerResponse { Handled , Unhandled } |
| using | HandlerWithContentReader = std::function< void(const Request &, Response &, const ContentReader &content_reader)> |
| using | HandlerWithResponse = std::function< HandlerResponse(const Request &, Response &)> |
Public Member Functions | |
| Server () | |
| virtual | ~Server () |
| int | bind_to_any_port (const char *host, int socket_flags=0) |
| bool | bind_to_port (const char *host, int port, int socket_flags=0) |
| Server & | Delete (const char *pattern, Handler handler) |
| Server & | Delete (const char *pattern, HandlerWithContentReader handler) |
| Server & | Delete (const char *pattern, size_t pattern_len, Handler handler) |
| Server & | Delete (const char *pattern, size_t pattern_len, HandlerWithContentReader handler) |
| Server & | Get (const char *pattern, Handler handler) |
| Server & | Get (const char *pattern, size_t pattern_len, Handler handler) |
| bool | is_running () const |
| virtual bool | is_valid () const |
| bool | listen (const char *host, int port, int socket_flags=0) |
| bool | listen_after_bind () |
| Server & | Options (const char *pattern, Handler handler) |
| Server & | Options (const char *pattern, size_t pattern_len, Handler handler) |
| Server & | Patch (const char *pattern, Handler handler) |
| Server & | Patch (const char *pattern, HandlerWithContentReader handler) |
| Server & | Patch (const char *pattern, size_t pattern_len, Handler handler) |
| Server & | Patch (const char *pattern, size_t pattern_len, HandlerWithContentReader handler) |
| Server & | Post (const char *pattern, Handler handler) |
| Server & | Post (const char *pattern, HandlerWithContentReader handler) |
| Server & | Post (const char *pattern, size_t pattern_len, Handler handler) |
| Server & | Post (const char *pattern, size_t pattern_len, HandlerWithContentReader handler) |
| Server & | Put (const char *pattern, Handler handler) |
| Server & | Put (const char *pattern, HandlerWithContentReader handler) |
| Server & | Put (const char *pattern, size_t pattern_len, Handler handler) |
| Server & | Put (const char *pattern, size_t pattern_len, HandlerWithContentReader handler) |
| bool | remove_mount_point (const char *mount_point) |
| Server & | set_address_family (int family) |
| bool | set_base_dir (const char *dir, const char *mount_point=nullptr) |
| Server & | set_error_handler (Handler handler) |
| Server & | set_error_handler (HandlerWithResponse handler) |
| Server & | set_exception_handler (ExceptionHandler handler) |
| Server & | set_expect_100_continue_handler (Expect100ContinueHandler handler) |
| Server & | set_file_extension_and_mimetype_mapping (const char *ext, const char *mime) |
| Server & | set_file_request_handler (Handler handler) |
| template<class Rep , class Period > | |
| Server & | set_idle_interval (const std::chrono::duration< Rep, Period > &duration) |
| Server & | set_idle_interval (time_t sec, time_t usec=0) |
| Server & | set_keep_alive_max_count (size_t count) |
| Server & | set_keep_alive_timeout (time_t sec) |
| Server & | set_logger (Logger logger) |
| bool | set_mount_point (const char *mount_point, const char *dir, Headers headers=Headers()) |
| Server & | set_payload_max_length (size_t length) |
| Server & | set_post_routing_handler (Handler handler) |
| Server & | set_pre_routing_handler (HandlerWithResponse handler) |
| template<class Rep , class Period > | |
| Server & | set_read_timeout (const std::chrono::duration< Rep, Period > &duration) |
| Server & | set_read_timeout (time_t sec, time_t usec=0) |
| Server & | set_socket_options (SocketOptions socket_options) |
| Server & | set_tcp_nodelay (bool on) |
| template<class Rep , class Period > | |
| Server & | set_write_timeout (const std::chrono::duration< Rep, Period > &duration) |
| Server & | set_write_timeout (time_t sec, time_t usec=0) |
| void | stop () |
Public Attributes | |
| std::function< TaskQueue *(void)> | new_task_queue |
Protected Member Functions | |
| bool | process_request (Stream &strm, bool close_connection, bool &connection_closed, const std::function< void(Request &)> &setup_request) |
Protected Attributes | |
| time_t | idle_interval_sec_ = 0 |
| time_t | idle_interval_usec_ = 0 |
| size_t | keep_alive_max_count_ = 5 |
| time_t | keep_alive_timeout_sec_ = 5 |
| size_t | payload_max_length_ = ((std::numeric_limits<size_t>::max)()) |
| time_t | read_timeout_sec_ = 5 |
| time_t | read_timeout_usec_ = 0 |
| std::atomic< socket_t > | svr_sock_ |
| time_t | write_timeout_sec_ = 5 |
| time_t | write_timeout_usec_ = 0 |
| using httplib::Server::ExceptionHandler = std::function<void(const Request &, Response &, std::exception &e)> |
| 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 |
| httplib::Server::Server | ( | ) |
|
virtual |
| int httplib::Server::bind_to_any_port | ( | const char * | host, |
| int | socket_flags = 0 |
||
| ) |
| bool httplib::Server::bind_to_port | ( | const char * | host, |
| int | port, | ||
| int | socket_flags = 0 |
||
| ) |
| Server & httplib::Server::Delete | ( | const char * | pattern, |
| HandlerWithContentReader | handler | ||
| ) |
| Server & httplib::Server::Delete | ( | const char * | pattern, |
| size_t | pattern_len, | ||
| HandlerWithContentReader | handler | ||
| ) |
| bool httplib::Server::is_running | ( | ) | const |
|
virtual |
| bool httplib::Server::listen | ( | const char * | host, |
| int | port, | ||
| int | socket_flags = 0 |
||
| ) |
| bool httplib::Server::listen_after_bind | ( | ) |
| Server & httplib::Server::Patch | ( | const char * | pattern, |
| HandlerWithContentReader | handler | ||
| ) |
| Server & httplib::Server::Patch | ( | const char * | pattern, |
| size_t | pattern_len, | ||
| HandlerWithContentReader | handler | ||
| ) |
| Server & httplib::Server::Post | ( | const char * | pattern, |
| HandlerWithContentReader | handler | ||
| ) |
| Server & httplib::Server::Post | ( | const char * | pattern, |
| size_t | pattern_len, | ||
| HandlerWithContentReader | handler | ||
| ) |
|
protected |
| Server & httplib::Server::Put | ( | const char * | pattern, |
| HandlerWithContentReader | handler | ||
| ) |
| Server & httplib::Server::Put | ( | const char * | pattern, |
| size_t | pattern_len, | ||
| HandlerWithContentReader | handler | ||
| ) |
| bool httplib::Server::remove_mount_point | ( | const char * | mount_point | ) |
| Server & httplib::Server::set_address_family | ( | int | family | ) |
| bool httplib::Server::set_base_dir | ( | const char * | dir, |
| const char * | mount_point = nullptr |
||
| ) |
| Server & httplib::Server::set_error_handler | ( | HandlerWithResponse | handler | ) |
| Server & httplib::Server::set_exception_handler | ( | ExceptionHandler | handler | ) |
| Server & httplib::Server::set_expect_100_continue_handler | ( | Expect100ContinueHandler | handler | ) |
| Server & httplib::Server::set_file_extension_and_mimetype_mapping | ( | const char * | ext, |
| const char * | mime | ||
| ) |
| Server & httplib::Server::set_idle_interval | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
| Server & httplib::Server::set_idle_interval | ( | time_t | sec, |
| time_t | usec = 0 |
||
| ) |
| Server & httplib::Server::set_keep_alive_max_count | ( | size_t | count | ) |
| Server & httplib::Server::set_keep_alive_timeout | ( | time_t | sec | ) |
| bool httplib::Server::set_mount_point | ( | const char * | mount_point, |
| const char * | dir, | ||
| Headers | headers = Headers() |
||
| ) |
| Server & httplib::Server::set_payload_max_length | ( | size_t | length | ) |
| Server & httplib::Server::set_pre_routing_handler | ( | HandlerWithResponse | handler | ) |
| Server & httplib::Server::set_read_timeout | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
| Server & httplib::Server::set_read_timeout | ( | time_t | sec, |
| time_t | usec = 0 |
||
| ) |
| Server & httplib::Server::set_socket_options | ( | SocketOptions | socket_options | ) |
| Server & httplib::Server::set_tcp_nodelay | ( | bool | on | ) |
| Server & httplib::Server::set_write_timeout | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
| Server & httplib::Server::set_write_timeout | ( | time_t | sec, |
| time_t | usec = 0 |
||
| ) |
| void httplib::Server::stop | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
| std::function<TaskQueue *(void)> httplib::Server::new_task_queue |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |