wibble 0.1.28
Public Member Functions | Public Attributes
wibble::net::http::Params Struct Reference

Parse and store HTTP query parameters. More...

#include <http.h>

List of all members.

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.
Paramobtain_field (const std::string &name)
 Get a normal fileld during form parsing.
FileParamobtain_file_field (const std::string &name)
 Get a normal fileld during form parsing.
Paramfield (const std::string &name)
 Get a field by name.
FileParamfile_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.

Detailed Description

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.


Constructor & Destructor Documentation

wibble::net::http::Params::Params ( )
wibble::net::http::Params::~Params ( )

Member Function Documentation

template<typename TYPE >
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().

void wibble::net::http::Params::parse_get_or_post ( net::http::Request req)

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 
)
void wibble::net::http::Params::parse_post ( net::http::Request req)
void wibble::net::http::Params::parse_urlencoded ( const std::string &  qstring)

Member Data Documentation

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.

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.

Directory where we write uploaded files.

Warning:
: if it is not set to anything, it ignores all file uploads

File parameters.


The documentation for this struct was generated from the following files: