.TH "include/apreq_param.h" 3 "Wed Mar 10 2021" "Version 2.16" "libapreq2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
include/apreq_param.h \- Request parsing and parameter API\&.  

.SH SYNOPSIS
.br
.PP
\fC#include 'apreq\&.h'\fP
.br
\fC#include 'apr_buckets\&.h'\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBapreq_param_t\fP"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef struct \fBapreq_param_t\fP \fBapreq_param_t\fP"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "static APR_INLINE unsigned \fBapreq_param_is_tainted\fP (const \fBapreq_param_t\fP *p)"
.br
.ti -1c
.RI "static APR_INLINE void \fBapreq_param_tainted_on\fP (\fBapreq_param_t\fP *p)"
.br
.ti -1c
.RI "static APR_INLINE void \fBapreq_param_tainted_off\fP (\fBapreq_param_t\fP *p)"
.br
.ti -1c
.RI "static APR_INLINE \fBapreq_charset_t\fP \fBapreq_param_charset_set\fP (\fBapreq_param_t\fP *p, \fBapreq_charset_t\fP c)"
.br
.ti -1c
.RI "static APR_INLINE \fBapreq_charset_t\fP \fBapreq_param_charset_get\fP (\fBapreq_param_t\fP *p)"
.br
.ti -1c
.RI "static APR_INLINE \fBapreq_param_t\fP * \fBapreq_value_to_param\fP (const char *val)"
.br
.ti -1c
.RI "\fBapreq_param_t\fP * \fBapreq_param_make\fP (apr_pool_t *p, const char *name, const apr_size_t nlen, const char *val, const apr_size_t vlen)"
.br
.ti -1c
.RI "apr_status_t \fBapreq_param_decode\fP (\fBapreq_param_t\fP **param, apr_pool_t *pool, const char *word, apr_size_t nlen, apr_size_t vlen)"
.br
.ti -1c
.RI "char * \fBapreq_param_encode\fP (apr_pool_t *pool, const \fBapreq_param_t\fP *param)"
.br
.ti -1c
.RI "apr_status_t \fBapreq_parse_query_string\fP (apr_pool_t *pool, apr_table_t *t, const char *qs)"
.br
.ti -1c
.RI "apr_array_header_t * \fBapreq_params_as_array\fP (apr_pool_t *p, const apr_table_t *t, const char *key)"
.br
.ti -1c
.RI "const char * \fBapreq_params_as_string\fP (apr_pool_t *p, const apr_table_t *t, const char *key, \fBapreq_join_t\fP mode)"
.br
.ti -1c
.RI "const apr_table_t * \fBapreq_uploads\fP (const apr_table_t *body, apr_pool_t *pool)"
.br
.ti -1c
.RI "const \fBapreq_param_t\fP * \fBapreq_upload\fP (const apr_table_t *body, const char *name)"
.br
.in -1c
.SH "Detailed Description"
.PP 
Request parsing and parameter API\&. 


.SH "Typedef Documentation"
.PP 
.SS "typedef struct \fBapreq_param_t\fP \fBapreq_param_t\fP"
Common data structure for params and file uploads 
.SH "Function Documentation"
.PP 
.SS "static APR_INLINE \fBapreq_charset_t\fP apreq_param_charset_get (\fBapreq_param_t\fP * p)\fC [static]\fP"
Gets the character encoding for this parameter\&. 
.SS "static APR_INLINE \fBapreq_charset_t\fP apreq_param_charset_set (\fBapreq_param_t\fP * p, \fBapreq_charset_t\fP c)\fC [static]\fP"
Sets the character encoding for this parameter\&. 
.SS "apr_status_t apreq_param_decode (\fBapreq_param_t\fP ** param, apr_pool_t * pool, const char * word, apr_size_t nlen, apr_size_t vlen)"
Url-decodes a name=value pair into a param\&.
.PP
\fBParameters\fP
.RS 4
\fIparam\fP points to the decoded parameter on success 
.br
\fIpool\fP Pool from which the param is allocated\&. 
.br
\fIword\fP Start of the name=value pair\&. 
.br
\fInlen\fP Length of urlencoded name\&. 
.br
\fIvlen\fP Length of urlencoded value\&.
.RE
.PP
\fBReturns\fP
.RS 4
APR_SUCCESS on success\&. 
.PP
\fBAPREQ_ERROR_BADSEQ\fP or \fBAPREQ_ERROR_BADCHAR\fP on malformed input\&.
.RE
.PP
\fBRemarks\fP
.RS 4
Unless vlen == 0, this function assumes there is exactly one character ('=') which separates the pair\&. 
.RE
.PP

.SS "char* apreq_param_encode (apr_pool_t * pool, const \fBapreq_param_t\fP * param)"
Url-encodes the param into a name-value pair\&. 
.PP
\fBParameters\fP
.RS 4
\fIpool\fP Pool which allocates the returned string\&. 
.br
\fIparam\fP Param to encode\&. 
.RE
.PP
\fBReturns\fP
.RS 4
name-value pair representing the param\&. 
.RE
.PP

.SS "static APR_INLINE unsigned apreq_param_is_tainted (const \fBapreq_param_t\fP * p)\fC [static]\fP"

.PP
\fBReturns\fP
.RS 4
1 if the taint flag is set, 0 otherwise\&. 
.RE
.PP

.SS "\fBapreq_param_t\fP* apreq_param_make (apr_pool_t * p, const char * name, const apr_size_t nlen, const char * val, const apr_size_t vlen)"
creates a param from name/value information 
.SS "static APR_INLINE void apreq_param_tainted_off (\fBapreq_param_t\fP * p)\fC [static]\fP"
Turns off the taint flag\&. 
.SS "static APR_INLINE void apreq_param_tainted_on (\fBapreq_param_t\fP * p)\fC [static]\fP"
Sets the tainted flag\&. 
.SS "apr_array_header_t* apreq_params_as_array (apr_pool_t * p, const apr_table_t * t, const char * key)"
Returns an array of parameters (\fBapreq_param_t\fP *) matching the given key\&. The key is case-insensitive\&. 
.PP
\fBParameters\fP
.RS 4
\fIp\fP Allocates the returned array\&. 
.br
\fIt\fP the parameter table returned by \fBapreq_args()\fP, \fBapreq_body()\fP or \fBapreq_params()\fP 
.br
\fIkey\fP Null-terminated search key, case insensitive\&. key==NULL fetches all parameters\&. 
.RE
.PP
\fBReturns\fP
.RS 4
an array of apreq_param_t* (pointers) 
.RE
.PP
\fBRemarks\fP
.RS 4
Also parses the request if necessary\&. 
.RE
.PP

.SS "const char* apreq_params_as_string (apr_pool_t * p, const apr_table_t * t, const char * key, \fBapreq_join_t\fP mode)"
Returns a ', ' -joined string containing all parameters for the requested key, an empty string if none are found\&. The key is case-insensitive\&.
.PP
\fBParameters\fP
.RS 4
\fIp\fP Allocates the return string\&. 
.br
\fIt\fP the parameter table returned by \fBapreq_args()\fP, \fBapreq_body()\fP or \fBapreq_params()\fP 
.br
\fIkey\fP Null-terminated parameter name, case insensitive\&. key==NULL fetches all values\&. 
.br
\fImode\fP Join type- see \fBapreq_join()\fP\&. 
.RE
.PP
\fBReturns\fP
.RS 4
the joined string or NULL on error 
.RE
.PP
\fBRemarks\fP
.RS 4
Also parses the request if necessary\&. 
.RE
.PP

.SS "apr_status_t apreq_parse_query_string (apr_pool_t * pool, apr_table_t * t, const char * qs)"
Parse a url-encoded string into a param table\&. 
.PP
\fBParameters\fP
.RS 4
\fIpool\fP pool used to allocate the param data\&. 
.br
\fIt\fP table to which the params are added\&. 
.br
\fIqs\fP Query string to url-decode\&. 
.RE
.PP
\fBReturns\fP
.RS 4
APR_SUCCESS if successful, error otherwise\&. 
.RE
.PP
\fBRemarks\fP
.RS 4
This function uses [&;] as the set of tokens to delineate words, and will treat a word w/o '=' as a name-value pair with value-length = 0\&. 
.RE
.PP

.SS "const \fBapreq_param_t\fP* apreq_upload (const apr_table_t * body, const char * name)"
Returns the first param in req->body which has both param->v\&.name matching key (case insensitive) and param->upload != NULL\&. 
.PP
\fBParameters\fP
.RS 4
\fIbody\fP parameter table returned by \fBapreq_body()\fP or \fBapreq_params()\fP 
.br
\fIname\fP Parameter name\&. key == NULL returns first upload\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Corresponding upload, NULL if none found\&. 
.RE
.PP
\fBRemarks\fP
.RS 4
Will parse the request as necessary\&. 
.RE
.PP

.SS "const apr_table_t* apreq_uploads (const apr_table_t * body, apr_pool_t * pool)"
Returns a table of all params in req->body with non-NULL upload brigades\&. 
.PP
\fBParameters\fP
.RS 4
\fIbody\fP parameter table returned by \fBapreq_body()\fP or \fBapreq_params()\fP 
.br
\fIpool\fP Pool which allocates the table struct\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Upload table\&. 
.RE
.PP
\fBRemarks\fP
.RS 4
Will parse the request if necessary\&. 
.RE
.PP

.SS "static APR_INLINE \fBapreq_param_t\fP* apreq_value_to_param (const char * val)\fC [static]\fP"
Upgrades args and body table values to \fBapreq_param_t\fP structs\&. 
.SH "Author"
.PP 
Generated automatically by Doxygen for libapreq2 from the source code\&.