CppCMS
|
This class represents all information related to the HTTP/CGI request. More...
#include <cppcms/http_request.h>
Public Types | |
typedef std::multimap< std::string, std::string > | form_type |
typedef std::map< std::string, cookie > | cookies_type |
typedef std::vector< booster::shared_ptr< file > > | files_type |
Public Member Functions | |
std::string | auth_type () |
unsigned long long | content_length () |
std::string | content_type () |
cppcms::http::content_type | content_type_parsed () |
std::string | gateway_interface () |
std::string | path_info () |
std::string | path_translated () |
std::string | query_string () |
std::string | remote_addr () |
std::string | remote_host () |
std::string | remote_ident () |
std::string | remote_user () |
std::string | request_method () |
std::string | script_name () |
std::string | server_name () |
unsigned | server_port () |
std::string | server_protocol () |
std::string | server_software () |
std::string | http_accept () |
std::string | http_accept_charset () |
std::string | http_accept_encoding () |
std::string | http_accept_language () |
std::string | http_accept_ranges () |
std::string | http_authorization () |
std::string | http_cache_control () |
std::string | http_connection () |
std::string | http_cookie () |
std::string | http_expect () |
std::string | http_form () |
std::string | http_host () |
std::string | http_if_match () |
std::string | http_if_none_match () |
std::pair< bool, unsigned > | http_max_forwards () |
std::string | http_pragma () |
std::string | http_proxy_authorization () |
std::string | http_range () |
std::string | http_referer () |
std::string | http_te () |
std::string | http_upgrade () |
std::string | http_user_agent () |
std::string | http_via () |
std::string | http_warn () |
std::string | getenv (std::string const &) |
std::string | getenv (char const *) |
char const * | cgetenv (char const *) |
std::map< std::string, std::string > | getenv () |
cookies_type const & | cookies () |
cookie const & | cookie_by_name (std::string const &name) |
std::string | get (std::string const &name) |
std::string | post (std::string const &name) |
form_type const & | get () |
form_type const & | post () |
form_type const & | post_or_get () |
files_type | files () |
std::pair< void *, size_t > | raw_post_data () |
content_limits & | limits () |
basic_content_filter * | content_filter () |
void | set_content_filter (basic_content_filter &flt) |
void | reset_content_filter (basic_content_filter *flt=0) |
basic_content_filter * | release_content_filter () |
bool | is_ready () |
void | setbuf (int size) |
Friends | |
class | context |
class | impl::cgi::connection |
This class represents all information related to the HTTP/CGI request.
It is usually accessed via http::context or application class
typedef std::map<std::string,cookie> cppcms::http::request::cookies_type |
Type of a map of cookie name to the cookie value
typedef std::vector<booster::shared_ptr<file> > cppcms::http::request::files_type |
Type that represents all files uploaded in this request
typedef std::multimap<std::string,std::string> cppcms::http::request::form_type |
Type that represents from-data key-value pairs
std::string cppcms::http::request::auth_type | ( | ) |
CGI AUTH_TYPE environment variable
char const* cppcms::http::request::cgetenv | ( | char const * | ) |
Get CGI environment variable by name. Returns empty string if the variable is not set
basic_content_filter* cppcms::http::request::content_filter | ( | ) |
Get installed content filter, returns 0 if it is not installed, no ownership is transfered
unsigned long long cppcms::http::request::content_length | ( | ) |
CGI CONTENT_LENGTH environment variable
std::string cppcms::http::request::content_type | ( | ) |
CGI CONTENT_TYPE environment variable
cppcms::http::content_type cppcms::http::request::content_type_parsed | ( | ) |
Parsed CGI CONTENT_TYPE environment variable
cookie const& cppcms::http::request::cookie_by_name | ( | std::string const & | name | ) |
Get cookie by its name, if not assigned returns empty cookie
cookies_type const& cppcms::http::request::cookies | ( | ) |
Get all cookies sent with this request
files_type cppcms::http::request::files | ( | ) |
Get all uploaded files
std::string cppcms::http::request::gateway_interface | ( | ) |
CGI GATEWAY_INTERFACE environment variable
std::string cppcms::http::request::get | ( | std::string const & | name | ) |
Fetch GET value by name, if name not exists or more then one entry with same name exists, empty string is returned
form_type const& cppcms::http::request::get | ( | ) |
form-data GET part of request
std::string cppcms::http::request::getenv | ( | std::string const & | ) |
Get CGI environment variable by name. Returns empty string if the variable is not set
std::string cppcms::http::request::getenv | ( | char const * | ) |
Get CGI environment variable by name. Returns empty string if the variable is not set
std::map<std::string,std::string> cppcms::http::request::getenv | ( | ) |
Get map of all CGI environment variable as key-value pairs.
std::string cppcms::http::request::http_accept | ( | ) |
CGI HTTP_ACCEPT variable representing Accept HTTP header
std::string cppcms::http::request::http_accept_charset | ( | ) |
CGI HTTP_ACCEPT_CHARSET variable representing Accept-Charset HTTP header
std::string cppcms::http::request::http_accept_encoding | ( | ) |
CGI HTTP_ACCEPT_ENCODING variable representing Accept-Encoding HTTP header
std::string cppcms::http::request::http_accept_language | ( | ) |
CGI HTTP_ACCEPT_LANGUAGE variable representing Accept-Language HTTP header
std::string cppcms::http::request::http_accept_ranges | ( | ) |
CGI HTTP_ACCEPT_RANGES variable representing Accept-Ranges HTTP header
std::string cppcms::http::request::http_authorization | ( | ) |
CGI HTTP_AUTHORIZATION variable representing Authorization HTTP header
std::string cppcms::http::request::http_cache_control | ( | ) |
CGI HTTP_CACHE_CONTROL variable representing Cache-Control HTTP header
std::string cppcms::http::request::http_connection | ( | ) |
CGI HTTP_CONNECTION variable representing Connection HTTP header
std::string cppcms::http::request::http_cookie | ( | ) |
CGI HTTP_COOKIE variable representing Cookie HTTP header
std::string cppcms::http::request::http_expect | ( | ) |
CGI HTTP_EXPECT variable representing Expect HTTP header
std::string cppcms::http::request::http_form | ( | ) |
CGI HTTP_FORM variable representing Form HTTP header
std::string cppcms::http::request::http_host | ( | ) |
CGI HTTP_HOST variable representing Host HTTP header
std::string cppcms::http::request::http_if_match | ( | ) |
CGI HTTP_IF_MATCH variable representing If-Match HTTP header
std::string cppcms::http::request::http_if_none_match | ( | ) |
CGI HTTP_IF_NONE_MATCH variable representing If-None-Match HTTP header
std::pair<bool,unsigned> cppcms::http::request::http_max_forwards | ( | ) |
GGI HTTP_MAX_FORWARDS variable representing Http-Max-Forwards
Returns a pair of {true,HTTP_MAX_FORWARDS} if set or {false,0} otherwise
std::string cppcms::http::request::http_pragma | ( | ) |
CGI HTTP_PRAGMA variable representing Pragma HTTP header
std::string cppcms::http::request::http_proxy_authorization | ( | ) |
CGI HTTP_PROXY_AUTHORIZATION variable representing Proxy-Authorization HTTP header
std::string cppcms::http::request::http_range | ( | ) |
CGI HTTP_RANGE variable representing Range HTTP header
std::string cppcms::http::request::http_referer | ( | ) |
CGI HTTP_REFERER variable representing Referer HTTP header
std::string cppcms::http::request::http_te | ( | ) |
CGI HTTP_TE variable representing Te HTTP header
std::string cppcms::http::request::http_upgrade | ( | ) |
CGI HTTP_UPGRADE variable representing Upgrade HTTP header
std::string cppcms::http::request::http_user_agent | ( | ) |
CGI HTTP_USER_AGENT variable representing User-Agent HTTP header
std::string cppcms::http::request::http_via | ( | ) |
CGI HTTP_VIA variable representing Via HTTP header
std::string cppcms::http::request::http_warn | ( | ) |
CGI HTTP_WARN variable representing Warn HTTP header
bool cppcms::http::request::is_ready | ( | ) |
Returns true when full request content is ready
content_limits& cppcms::http::request::limits | ( | ) |
Get content limits for incoming data processing
std::string cppcms::http::request::path_info | ( | ) |
CGI PATH_INFO environment variable
std::string cppcms::http::request::path_translated | ( | ) |
CGI PATH_TRANSLATED environment variable
std::string cppcms::http::request::post | ( | std::string const & | name | ) |
Fetch POST value by name, if name not exists or more then one entry with same name exists, empty string is returned
form_type const& cppcms::http::request::post | ( | ) |
form-data POST part of request
form_type const& cppcms::http::request::post_or_get | ( | ) |
form-data POST or GET according to reuqest_method()
Referenced by cppcms::widgets::numeric< T >::load().
std::string cppcms::http::request::query_string | ( | ) |
CGI QUERY_STRING environment variable
std::pair<void *,size_t> cppcms::http::request::raw_post_data | ( | ) |
Access to raw bits of POST (content) data. If the content is empty if raw_content_filter is installed or multipart/form-data is handled the read_post_data().second will be 0;
Note: when processing multipart/form-data returns chunk of zero size as such requests maybe huge (file uploads of multiple hundreds of MB or even GB) that are would be stored in temporary files instead of memory. In order to get access to POST data you'll have to use post(), get(), or files() member functions.
basic_content_filter* cppcms::http::request::release_content_filter | ( | ) |
Release existing content filter owned by request
std::string cppcms::http::request::remote_addr | ( | ) |
CGI REMOTE_ADDR environment variable
std::string cppcms::http::request::remote_host | ( | ) |
CGI REMOTE_HOST environment variable
std::string cppcms::http::request::remote_ident | ( | ) |
CGI REMOTE_IDENT environment variable
std::string cppcms::http::request::remote_user | ( | ) |
CGI REMOTE_USER environment variable
std::string cppcms::http::request::request_method | ( | ) |
CGI REQUEST_METHOD environment variable
void cppcms::http::request::reset_content_filter | ( | basic_content_filter * | flt = 0 | ) |
Installs new content filter (or removes existing), the ownership of new filter is transfered to the request object
std::string cppcms::http::request::script_name | ( | ) |
CGI SCRIPT_NAME environment variable
std::string cppcms::http::request::server_name | ( | ) |
CGI SERVER_NAME environment variable
unsigned cppcms::http::request::server_port | ( | ) |
CGI SERVER_PORT environment variable
std::string cppcms::http::request::server_protocol | ( | ) |
CGI SERVER_PROTOCOL environment variable
std::string cppcms::http::request::server_software | ( | ) |
CGI SERVER_SOFTWARE environment variable
void cppcms::http::request::set_content_filter | ( | basic_content_filter & | flt | ) |
Installs content filter. If another filter installed it is removed
void cppcms::http::request::setbuf | ( | int | size | ) |
Set the size of the buffer for content that isn't loaded to memory directly, like for example multipart/form-data, default is defined in configuration as service.input_buffer_size and defaults to 65536