wibble
0.1.28
|
Parse and store HTTP query parameters. More...
#include <http.h>
Public Member Functions | |
Params () | |
~Params () | |
template<typename TYPE > | |
TYPE * | add (const std::string &name) |
Universal, automatic add method. | |
void | add (const std::string &name, Param *param) |
Add a normal parameter to be parsed from the request. | |
void | add (const std::string &name, FileParam *param) |
Add a file upload parameter to be parsed from the request. | |
Param * | obtain_field (const std::string &name) |
Get a normal fileld during form parsing. | |
FileParam * | obtain_file_field (const std::string &name) |
Get a normal fileld during form parsing. | |
Param * | field (const std::string &name) |
Get a field by name. | |
FileParam * | file_field (const std::string &name) |
Get a file field by name. | |
void | parse_get_or_post (net::http::Request &req) |
Parse parameters as GET or POST according to request method. | |
void | parse_urlencoded (const std::string &qstring) |
Parse parameters from urlencoded form data. | |
void | parse_multipart (net::http::Request &req, size_t inputsize, const std::string &content_type) |
Parse parameters from multipart/form-data. | |
void | parse_post (net::http::Request &req) |
Parse parameters from HTTP POST input. | |
Public Attributes | |
std::map< std::string, FileParam * > | files |
File parameters. | |
size_t | conf_max_input_size |
Maximum size of POST input data. | |
size_t | conf_max_field_size |
Maximum size of field data for one non-file field. | |
bool | conf_accept_unknown_fields |
Whether to accept unknown fields. | |
bool | conf_accept_unknown_file_fields |
Whether to accept unknown file upload fields. | |
std::string | conf_outdir |
Directory where we write uploaded files. | |
std::string | conf_fname_blacklist |
String containing blacklist characters that are replaced with "_" in the file name. |
Parse and store HTTP query parameters.
It is preconfigured by manipulating the various conf_* fields and using the add() methods, before calling one of the parse_* methods.
References wibble::list::begin(), wibble::list::end(), and wibble::iterator().
TYPE* wibble::net::http::Params::add | ( | const std::string & | name | ) | [inline] |
Universal, automatic add method.
void wibble::net::http::Params::add | ( | const std::string & | name, |
Param * | param | ||
) |
Add a normal parameter to be parsed from the request.
References wibble::list::end(), and wibble::iterator().
void wibble::net::http::Params::add | ( | const std::string & | name, |
FileParam * | param | ||
) |
Add a file upload parameter to be parsed from the request.
References wibble::iterator().
Param * wibble::net::http::Params::field | ( | const std::string & | name | ) |
Get a field by name.
References wibble::list::end(), and wibble::iterator().
FileParam * wibble::net::http::Params::file_field | ( | const std::string & | name | ) |
Get a file field by name.
References wibble::iterator().
Param * wibble::net::http::Params::obtain_field | ( | const std::string & | name | ) |
Get a normal fileld during form parsing.
Depending on the value of conf_accept_unknown_fields, when handling a field that has not been added before it will either create it if missing, or just return NULL.
References wibble::list::end(), and wibble::iterator().
FileParam * wibble::net::http::Params::obtain_file_field | ( | const std::string & | name | ) |
Get a normal fileld during form parsing.
Depending on the value of conf_accept_unknown_file_fields, when handling a field that has not been added before it will either create it if missing, or just return NULL.
References wibble::iterator().
Parse parameters as GET or POST according to request method.
References wibble::net::http::Request::method, and wibble::net::http::Request::url.
void wibble::net::http::Params::parse_multipart | ( | net::http::Request & | req, |
size_t | inputsize, | ||
const std::string & | content_type | ||
) |
Parse parameters from multipart/form-data.
References wibble::Splitter::begin(), wibble::net::mime::Reader::discard_until_boundary(), wibble::Splitter::end(), wibble::Regexp::match(), wibble::net::http::Param::parse(), wibble::net::http::FileParam::read(), wibble::net::mime::Reader::read_headers(), wibble::net::mime::Reader::read_until_boundary(), and wibble::net::http::Request::sock.
void wibble::net::http::Params::parse_post | ( | net::http::Request & | req | ) |
Parse parameters from HTTP POST input.
References wibble::net::http::Request::discard_input(), wibble::str::fmtf(), wibble::net::http::Request::headers, and wibble::net::http::Request::read_buf().
void wibble::net::http::Params::parse_urlencoded | ( | const std::string & | qstring | ) |
Parse parameters from urlencoded form data.
References wibble::str::Split::begin(), wibble::str::Split::end(), wibble::net::http::Param::parse(), and wibble::str::urldecode().
Whether to accept unknown fields.
If true, unkown fields are stored as ParamMulti
If false, unknown fields are ignored.
Whether to accept unknown file upload fields.
If true, unkown fields are stored as FileParamMulti
If false, unknown file upload fields are ignored.
std::string wibble::net::http::Params::conf_fname_blacklist |
String containing blacklist characters that are replaced with "_" in the file name.
If empty, nothing is replaced.
This only applies to the basename: the pathname is ignored when building the local file name.
Maximum size of field data for one non-file field.
Maximum size of POST input data.
std::string wibble::net::http::Params::conf_outdir |
Directory where we write uploaded files.
std::map<std::string, FileParam*> wibble::net::http::Params::files |
File parameters.