|
Fawkes API
Fawkes Development Version
|
Web request dispatcher. More...
#include "request_dispatcher.h"
Public Member Functions | |
| WebRequestDispatcher (WebUrlManager *url_manager, WebPageHeaderGenerator *headergen=0, WebPageFooterGenerator *footergen=0) | |
| Constructor. More... | |
| ~WebRequestDispatcher () | |
| Destructor. More... | |
| void | setup_basic_auth (const char *realm, WebUserVerifier *verifier) |
| Setup basic authentication. More... | |
| void | setup_access_log (const char *filename) |
| Setup access log. More... | |
| void | setup_cors (bool allow_all, std::vector< std::string > &&origins, unsigned int max_age) |
| Setup cross-origin resource sharing. More... | |
| unsigned int | active_requests () const |
| Get number of active requests. More... | |
| Time | last_request_completion_time () const |
| Get time when last request was completed. More... | |
Static Public Member Functions | |
| static MHD_RESULT | process_request_cb (void *callback_data, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **session_data) |
| Process request callback for libmicrohttpd. More... | |
| static void | request_completed_cb (void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe) |
| Process request completion. More... | |
| static void * | uri_log_cb (void *cls, const char *uri) |
| Callback for new requests. More... | |
Web request dispatcher.
Takes web request received via a webserver run by libmicrohttpd and dispatches pages to registered URL handlers or gives a 404 error if no handler was registered for the given url.
Definition at line 48 of file request_dispatcher.h.
| fawkes::WebRequestDispatcher::WebRequestDispatcher | ( | WebUrlManager * | url_manager, |
| WebPageHeaderGenerator * | headergen = 0, |
||
| WebPageFooterGenerator * | footergen = 0 |
||
| ) |
Constructor.
| url_manager | URL manager to use for URL to processor mapping |
| headergen | page header generator |
| footergen | page footer generator |
Definition at line 66 of file request_dispatcher.cpp.
| fawkes::WebRequestDispatcher::~WebRequestDispatcher | ( | ) |
Destructor.
Definition at line 84 of file request_dispatcher.cpp.
| unsigned int fawkes::WebRequestDispatcher::active_requests | ( | ) | const |
Get number of active requests.
Definition at line 553 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::active_requests().
| Time fawkes::WebRequestDispatcher::last_request_completion_time | ( | ) | const |
Get time when last request was completed.
Definition at line 563 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::last_request_completion_time().
|
static |
Process request callback for libmicrohttpd.
| callback_data | instance of WebRequestDispatcher to call |
| connection | libmicrohttpd connection instance |
| url | URL, may contain escape sequences |
| method | HTTP method |
| version | HTTP version |
| upload_data | uploaded data |
| upload_data_size | size of upload_data parameter |
| session_data | session data pointer |
Definition at line 167 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::start().
|
static |
Process request completion.
| cls | closure which is a pointer to the request dispatcher |
| connection | connection on which the request completed |
| con_cls | connection specific data, for us the request |
| toe | termination code |
Definition at line 188 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::start().
| void fawkes::WebRequestDispatcher::setup_access_log | ( | const char * | filename | ) |
Setup access log.
| filename | access log file name |
Definition at line 121 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::setup_access_log().
| void fawkes::WebRequestDispatcher::setup_basic_auth | ( | const char * | realm, |
| WebUserVerifier * | verifier | ||
| ) |
Setup basic authentication.
| realm | authentication realm to display to the user. If NULL basic authentication will be disabled. |
| verifier | verifier to use for checking credentials. If NULL basic authentication will be disabled. |
Definition at line 100 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::setup_basic_auth().
| void fawkes::WebRequestDispatcher::setup_cors | ( | bool | allow_all, |
| std::vector< std::string > && | origins, | ||
| unsigned int | max_age | ||
| ) |
Setup cross-origin resource sharing.
| allow_all | allow access to all hosts |
| origins | allow access from these specific origins |
| max_age | maximum cache time to send to the client, zero to disable |
Definition at line 134 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::start().
|
static |
Callback for new requests.
| cls | closure, must be WebRequestDispatcher |
| uri | requested URI |
Definition at line 149 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::start().