libapreq2-2.08: libapreq2: include/apreq_param.h File Reference

Apache HTTP Server Request Library

- Main Page
- Modules
- Data Structures
- Files
- Related Pages
- Examples

- File List
- Globals

# include/apreq_param.h File Reference

Request parsing and parameter API. More...

`#include "apreq.h"`
`#include "apr_buckets.h"`

Go to the source code of this file.

## Data Structures
struct | apreq_param_t
## Functions
static APR_INLINE unsigned | apreq_param_is_tainted (const apreq_param_t *p)
static APR_INLINE void | apreq_param_tainted_on (apreq_param_t *p)
static APR_INLINE void | apreq_param_tainted_off (apreq_param_t *p)
static APR_INLINE apreq_charset_t | apreq_param_charset_set (apreq_param_t *p, apreq_charset_t c)
static APR_INLINE apreq_charset_t | apreq_param_charset_get (apreq_param_t *p)
static APR_INLINE apreq_param_t * | apreq_value_to_param (const char *val)
apreq_param_t * | apreq_param_make (apr_pool_t *p, const char *name, const apr_size_t nlen, const char *val, const apr_size_t vlen)
apr_status_t | apreq_param_decode (apreq_param_t **param, apr_pool_t *pool, const char *word, apr_size_t nlen, apr_size_t vlen)
char * | apreq_param_encode (apr_pool_t *pool, const apreq_param_t *param)
apr_status_t | apreq_parse_query_string (apr_pool_t *pool, apr_table_t *t, const char *qs)
apr_array_header_t * | apreq_params_as_array (apr_pool_t *p, const apr_table_t *t, const char *key)
const char * | apreq_params_as_string (apr_pool_t *p, const apr_table_t *t, const char *key, apreq_join_t mode)
const apr_table_t * | apreq_uploads (const apr_table_t *body, apr_pool_t *pool)
const apreq_param_t * | apreq_upload (const apr_table_t *body, const char *name)

## Detailed Description

Request parsing and parameter API.

## Function Documentation

static APR_INLINE apreq_charset_t apreq_param_charset_get | ( | apreq_param_t * | p | ) | `[static]`

| Gets the character encoding for this parameter.

static APR_INLINE apreq_charset_t apreq_param_charset_set | ( | apreq_param_t * | p,
|  | apreq_charset_t | c
| ) | `[static]`

| Sets the character encoding for this parameter.

apr_status_t apreq_param_decode | ( | apreq_param_t ** | 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. Parameters:
  | param | points to the decoded parameter on success
  | pool | Pool from which the param is allocated.
  | word | Start of the name=value pair.
  | nlen | Length of urlencoded name.
  | vlen | Length of urlencoded value.
Returns: APR_SUCCESS on success. APREQ_ERROR_BADSEQ or APREQ_ERROR_BADCHAR on malformed input. Remarks: Unless vlen == 0, this function assumes there is exactly one character ('=') which separates the pair.

char* apreq_param_encode | ( | apr_pool_t * | pool,
|  | const apreq_param_t * | param
| ) |

  | Url-encodes the param into a name-value pair. Parameters:
  | pool | Pool which allocates the returned string.
  | param | Param to encode.
Returns: name-value pair representing the param.

static APR_INLINE unsigned apreq_param_is_tainted | ( | const apreq_param_t * | p | ) | `[static]`

| Returns: 1 if the taint flag is set, 0 otherwise.

apreq_param_t* 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

static APR_INLINE void apreq_param_tainted_off | ( | apreq_param_t * | p | ) | `[static]`

| Turns off the taint flag.

static APR_INLINE void apreq_param_tainted_on | ( | apreq_param_t * | p | ) | `[static]`

| Sets the tainted flag.

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 (apreq_param_t *) matching the given key. The key is case-insensitive. Parameters:
  | p | Allocates the returned array.
  | t | the parameter table returned by apreq_args(), apreq_body() or apreq_params()
  | key | Null-terminated search key, case insensitive. key==NULL fetches all parameters.
Returns: an array of apreq_param_t* (pointers) Remarks: Also parses the request if necessary.

const char* apreq_params_as_string | ( | apr_pool_t * | p,
|  | const apr_table_t * | t,
|  | const char * | key,
|  | apreq_join_t | mode
| ) |

  | Returns a ", " -joined string containing all parameters for the requested key, an empty string if none are found. The key is case-insensitive. Parameters:
  | p | Allocates the return string.
  | t | the parameter table returned by apreq_args(), apreq_body() or apreq_params()
  | key | Null-terminated parameter name, case insensitive. key==NULL fetches all values.
  | mode | Join type- see apreq_join().
Returns: the joined string or NULL on error Remarks: Also parses the request if necessary.

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. Parameters:
  | pool | pool used to allocate the param data.
  | t | table to which the params are added.
  | qs | Query string to url-decode.
Returns: APR_SUCCESS if successful, error otherwise. Remarks: 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.

const apreq_param_t* 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. Parameters:
  | body | parameter table returned by apreq_body() or apreq_params()
  | name | Parameter name. key == NULL returns first upload.
Returns: Corresponding upload, NULL if none found. Remarks: Will parse the request as necessary.

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. Parameters:
  | body | parameter table returned by apreq_body() or apreq_params()
  | pool | Pool which allocates the table struct.
Returns: Upload table. Remarks: Will parse the request if necessary.

static APR_INLINE apreq_param_t* apreq_value_to_param | ( | const char * | val | ) | `[static]`

| Upgrades args and body table values to apreq_param_t structs.