|
Fawkes API
Fawkes Development Version
|
Web request meta data carrier. More...
#include <>>
Public Types | |
| enum | Method { METHOD_CONNECT, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE } |
| HTTP transfer methods. More... | |
| enum | HttpVersion { HTTP_VERSION_1_0, HTTP_VERSION_1_1 } |
| HTTP version. More... | |
Public Member Functions | |
| WebRequest (const char *uri) | |
| Constructor. More... | |
| ~WebRequest () | |
| Destructor. More... | |
| const std::string & | url () const |
| Get URL. More... | |
| const std::string & | uri () const |
| Get URI. More... | |
| Method | method () const |
| Get HTTP transfer method. More... | |
| const char * | method_str () const |
| Get method as string. More... | |
| HttpVersion | http_version () const |
| Get HTTP version. More... | |
| const char * | http_version_str () const |
| Get HTTP version as string. More... | |
| const Time & | time () const |
| Get request time. More... | |
| const std::string & | user () const |
| Get name of authenticated user (basic auth). More... | |
| const std::string & | client_addr () const |
| Get client address as string. More... | |
| const std::map< std::string, std::string > & | cookies () const |
| Get map of cookies. More... | |
| std::string | cookie (std::string &key) const |
| Get specific cookie. More... | |
| bool | has_cookie (std::string key) const |
| Check if the named cookie has been received. More... | |
| const std::map< std::string, std::string > & | post_values () const |
| Get map of POST values. More... | |
| std::string | post_value (std::string &key) const |
| Get specific POST value. More... | |
| std::string | post_value (const char *key) const |
| Get specific POST value. More... | |
| bool | has_post_value (std::string key) const |
| Check if the named post value has been received. More... | |
| const std::map< std::string, std::string > & | get_values () const |
| Get map of GET values. More... | |
| std::string | get_value (std::string &key) const |
| Get specific GET value. More... | |
| std::string | get_value (const char *key) const |
| Get specific GET value. More... | |
| bool | has_get_value (std::string key) const |
| Check if the named get value has been received. More... | |
| const std::map< std::string, std::string > & | headers () const |
| Get map of header values. More... | |
| std::string | header (std::string &key) const |
| Header specific header value. More... | |
| std::string | header (const char *key) const |
| Get specific header value. More... | |
| bool | has_header (std::string key) const |
| Check if the named header value has been received. More... | |
| void | set_cookie (const std::string &key, const std::string &value) |
| Set a cookie. More... | |
| void | set_post_value (const char *key, const char *data, size_t size) |
| Set a POST value. More... | |
| void | set_get_value (const std::string &key, const std::string &value) |
| Set a GET value. More... | |
| void | set_header (const std::string &key, const std::string &value) |
| Set a header value. More... | |
| const std::string & | raw_post_data () const |
| Get raw post data. More... | |
| void | increment_reply_size (size_t increment_by) |
| Increment reply bytes counter. More... | |
| size_t | reply_size () const |
| Get number of bytes actually sent out so far. More... | |
| WebReply::Code | reply_code () const |
| Get HTTP code of reply. More... | |
| void | set_reply_code (WebReply::Code code) |
| Set HTTP code of the final reply. More... | |
Protected Member Functions | |
| void | set_cookies (const std::map< std::string, std::string > &cookies) |
| Set cookie map. More... | |
| void | set_raw_post_data (const char *data, size_t data_size) |
| Set raw post data. More... | |
Friends | |
| class | WebRequestDispatcher |
Web request meta data carrier.
For incoming web requests this class is instantiate to carry the necessary information for carriers like URL, request method, or cookie and POST form values.
| fawkes::WebRequest::WebRequest | ( | const char * | uri | ) |
Constructor.
| uri | URI of the request |
Definition at line 80 of file request.cpp.
References client_addr(), method(), METHOD_CONNECT, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE, and url().
| fawkes::WebRequest::~WebRequest | ( | ) |
Destructor.
Definition at line 154 of file request.cpp.
|
inline |
Get client address as string.
Definition at line 95 of file request.h.
Referenced by fawkes::WebviewAccessLog::log(), and WebRequest().
|
inline |
|
inline |
Get map of cookies.
Definition at line 99 of file request.h.
Referenced by set_cookies().
|
inline |
Get specific GET value.
| key | key of the get value |
Definition at line 151 of file request.h.
Referenced by WebviewBlackBoardRequestProcessor::process_request(), and WebviewPtzCamRequestProcessor::process_request().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Check if the named header value has been received.
| key | key of the requested header |
Definition at line 198 of file request.h.
Referenced by fawkes::WebviewAccessLog::log().
|
inline |
|
inline |
Header specific header value.
| key | key of the header value |
Definition at line 180 of file request.h.
Referenced by fawkes::WebviewAccessLog::log().
|
inline |
|
inline |
|
inline |
Get HTTP version.
Definition at line 82 of file request.h.
References http_version_str().
| const char * fawkes::WebRequest::http_version_str | ( | ) | const |
Get HTTP version as string.
Definition at line 235 of file request.cpp.
Referenced by http_version(), and fawkes::WebviewAccessLog::log().
| void fawkes::WebRequest::increment_reply_size | ( | size_t | increment_by | ) |
Increment reply bytes counter.
| increment_by | number of bytes sent |
Definition at line 196 of file request.cpp.
Referenced by fawkes::dynamic_reply_data_cb(), fawkes::dynamic_reply_free_cb(), and raw_post_data().
|
inline |
Get HTTP transfer method.
Definition at line 77 of file request.h.
References method_str().
Referenced by XmlRpcRequestProcessor::process_request(), set_cookies(), and WebRequest().
| const char * fawkes::WebRequest::method_str | ( | ) | const |
Get method as string.
Definition at line 215 of file request.cpp.
References METHOD_CONNECT, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, and METHOD_TRACE.
Referenced by fawkes::WebviewAccessLog::log(), and method().
|
inline |
Get specific POST value.
| key | key of the post value |
Definition at line 123 of file request.h.
Referenced by ClipsWebRequestProcessor::process_request().
|
inline |
|
inline |
|
inline |
Get raw post data.
Definition at line 230 of file request.h.
References increment_reply_size(), reply_code(), reply_size(), and set_reply_code().
Referenced by XmlRpcRequestProcessor::process_request().
| WebReply::Code fawkes::WebRequest::reply_code | ( | ) | const |
Get HTTP code of reply.
Definition at line 259 of file request.cpp.
Referenced by fawkes::WebviewAccessLog::log(), and raw_post_data().
| size_t fawkes::WebRequest::reply_size | ( | ) | const |
Get number of bytes actually sent out so far.
Definition at line 205 of file request.cpp.
Referenced by fawkes::WebviewAccessLog::log(), and raw_post_data().
|
inline |
Set a cookie.
| key | key of the cookie |
| value | value of the cookie |
Definition at line 205 of file request.h.
References set_post_value().
|
inlineprotected |
|
inline |
|
inline |
| void fawkes::WebRequest::set_post_value | ( | const char * | key, |
| const char * | data, | ||
| size_t | size | ||
| ) |
Set a POST value.
| key | key of the cookie |
| data | incoming data |
| size | size in bytes of data |
| key | key of the value |
| data | data of the value |
| size | size in bytes of data |
Definition at line 169 of file request.cpp.
Referenced by fawkes::dynamic_reply_free_cb(), and set_cookie().
|
protected |
Set raw post data.
The data is copied as is without assuming a human-readable string or even just zero-termination.
| data | data to copy |
| data_size | size in bytes of @p data |
Definition at line 187 of file request.cpp.
Referenced by fawkes::dynamic_reply_free_cb(), and set_cookies().
| void fawkes::WebRequest::set_reply_code | ( | WebReply::Code | code | ) |
Set HTTP code of the final reply.
| code | reply code |
Definition at line 249 of file request.cpp.
Referenced by fawkes::dynamic_reply_free_cb(), and raw_post_data().
|
inline |
Get request time.
Definition at line 87 of file request.h.
Referenced by fawkes::WebviewAccessLog::log().
|
inline |
Get URI.
Definition at line 73 of file request.h.
Referenced by fawkes::WebviewAccessLog::log().
|
inline |
Get URL.
Definition at line 69 of file request.h.
Referenced by WebviewStartPageRequestProcessor::process_request(), WebviewPluginsRequestProcessor::process_request(), RRDWebRequestProcessor::process_request(), WebviewStaticRequestProcessor::process_request(), WebviewImageRequestProcessor::process_request(), WebviewBlackBoardRequestProcessor::process_request(), ROSWebviewRequestProcessor::process_request(), WebviewTfRequestProcessor::process_request(), ClipsWebRequestProcessor::process_request(), WebviewPtzCamRequestProcessor::process_request(), set_cookies(), and WebRequest().
|
inline |
Get name of authenticated user (basic auth).
Definition at line 91 of file request.h.
Referenced by fawkes::WebviewAccessLog::log().