|
Kyoto Tycoon
|
HTTP server. More...
#include <kthttp.h>
Classes | |
| class | Logger |
| Interface to log internal information and errors. More... | |
| class | Session |
| Interface to access each session data. More... | |
| class | Worker |
| Interface to process each request. More... | |
| class | WorkerAdapter |
| Adapter for the worker. | |
Public Member Functions | |
| HTTPServer () | |
| Default constructor. | |
| ~HTTPServer () | |
| Destructor. | |
| void | set_network (const std::string &expr, double timeout=-1, const std::string &name="") |
| Set the network configurations. | |
| void | set_logger (Logger *logger, uint32_t kinds=Logger::SYSTEM|Logger::ERROR) |
| Set the logger to process each log message. | |
| void | set_worker (Worker *worker, size_t thnum=1) |
| Set the worker to process each request. | |
| bool | start () |
| Start the service. | |
| bool | stop () |
| Stop the service. | |
| bool | finish () |
| Finish the service. | |
| void | log (Logger::Kind kind, const char *format,...) |
| Log a message. | |
| void | log_v (Logger::Kind kind, const char *format, va_list ap) |
| Log a message. | |
| ThreadedServer * | reveal_core () |
| Reveal the internal TCP server. | |
Static Public Member Functions | |
| static const char * | status_name (int32_t code) |
| Get the name of a status code. | |
| static const char * | media_type (const std::string &url) |
| Guess the media type of a URL. | |
| static std::string | localize_path (const std::string &path) |
| Convert the path element of a URL into the local path. | |
HTTP server.
| kyototycoon::HTTPServer::HTTPServer | ( | ) | [explicit] |
Default constructor.
Destructor.
| void kyototycoon::HTTPServer::set_network | ( | const std::string & | expr, |
| double | timeout = -1, |
||
| const std::string & | name = "" |
||
| ) |
Set the network configurations.
| expr | an expression of the address and the port of the server. |
| timeout | the timeout of each network operation in seconds. If it is not more than 0, no timeout is specified. |
| name | the name of the server. If it is an empty string, the host name is specified. |
| void kyototycoon::HTTPServer::set_logger | ( | Logger * | logger, |
| uint32_t | kinds = Logger::SYSTEM | Logger::ERROR |
||
| ) |
Set the logger to process each log message.
| logger | the logger object. |
| kinds | kinds of logged messages by bitwise-or: Logger::DEBUG for debugging, Logger::INFO for normal information, Logger::SYSTEM for system information, and Logger::ERROR for fatal error. |
| void kyototycoon::HTTPServer::set_worker | ( | Worker * | worker, |
| size_t | thnum = 1 |
||
| ) |
Set the worker to process each request.
| worker | the worker object. |
| thnum | the number of worker threads. |
| bool kyototycoon::HTTPServer::start | ( | ) |
Start the service.
| bool kyototycoon::HTTPServer::stop | ( | ) |
Stop the service.
| bool kyototycoon::HTTPServer::finish | ( | ) |
Finish the service.
| void kyototycoon::HTTPServer::log | ( | Logger::Kind | kind, |
| const char * | format, | ||
| ... | |||
| ) |
Log a message.
| kind | the kind of the event. Logger::DEBUG for debugging, Logger::INFO for normal information, Logger::SYSTEM for system information, and Logger::ERROR for fatal error. |
| format | the printf-like format string. The conversion character `' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', and `'. |
| ... | used according to the format string. |
| void kyototycoon::HTTPServer::log_v | ( | Logger::Kind | kind, |
| const char * | format, | ||
| va_list | ap | ||
| ) |
Log a message.
Reveal the internal TCP server.
| static const char* kyototycoon::HTTPServer::status_name | ( | int32_t | code | ) | [static] |
Get the name of a status code.
| static const char* kyototycoon::HTTPServer::media_type | ( | const std::string & | url | ) | [static] |
| static std::string kyototycoon::HTTPServer::localize_path | ( | const std::string & | path | ) | [static] |
1.7.6.1