wibble 1.1
|
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.
wibble::net::http::Params::Params | ( | ) |
wibble::net::http::Params::~Params | ( | ) |
References wibble::iterator().
Universal, automatic add method.
Add a file upload parameter to be parsed from the request.
Add a normal parameter to be parsed from the request.
References wibble::iterator().
Get a field by name.
References wibble::iterator().
Get a file field by 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::iterator().
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.
void wibble::net::http::Params::parse_get_or_post | ( | net::http::Request & | req | ) |
Parse parameters as GET or POST according to request method.
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::net::mime::Reader::discard_until_boundary(), wibble::net::mime::Reader::read_headers(), and wibble::net::mime::Reader::read_until_boundary().
void wibble::net::http::Params::parse_post | ( | net::http::Request & | req | ) |
Parse parameters from HTTP POST input.
References wibble::str::fmtf().
Parse parameters from urlencoded form data.
References wibble::str::urldecode().
bool wibble::net::http::Params::conf_accept_unknown_fields |
Whether to accept unknown fields.
If true, unkown fields are stored as ParamMulti
If false, unknown fields are ignored.
bool wibble::net::http::Params::conf_accept_unknown_file_fields |
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.
size_t wibble::net::http::Params::conf_max_field_size |
Maximum size of field data for one non-file field.
size_t wibble::net::http::Params::conf_max_input_size |
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.