Apache HTTP Server Request Library

Utility functions for apreq. More...
Go to the source code of this file.
| Functions | |
| char * | apreq_join (apr_pool_t *p, const char *sep, const apr_array_header_t *arr, apreq_join_t mode) | 
| apr_ssize_t | apreq_index (const char *hay, apr_size_t hlen, const char *ndl, apr_size_t nlen, const apreq_match_t type) | 
| apr_size_t | apreq_quote (char *dest, const char *src, const apr_size_t slen) | 
| apr_size_t | apreq_quote_once (char *dest, const char *src, const apr_size_t slen) | 
| apr_size_t | apreq_encode (char *dest, const char *src, const apr_size_t slen) | 
| apr_size_t | apreq_cp1252_to_utf8 (char *dest, const char *src, apr_size_t slen) | 
| apreq_charset_t | apreq_charset_divine (const char *src, apr_size_t slen) | 
| apr_status_t | apreq_decode (char *dest, apr_size_t *dlen, const char *src, apr_size_t slen) | 
| apr_status_t | apreq_decodev (char *dest, apr_size_t *dlen, struct iovec *v, int nelts) | 
| static APR_INLINE char * | apreq_escape (apr_pool_t *p, const char *src, const apr_size_t slen) | 
| static APR_INLINE apr_ssize_t | apreq_unescape (char *str) | 
| apr_int64_t | apreq_atoi64f (const char *s) | 
| apr_int64_t | apreq_atoi64t (const char *s) | 
| apr_status_t | apreq_brigade_fwrite (apr_file_t *f, apr_off_t *wlen, apr_bucket_brigade *bb) | 
| apr_status_t | apreq_file_mktemp (apr_file_t **fp, apr_pool_t *pool, const char *path) | 
| static APR_INLINE apr_status_t | apreq_brigade_setaside (apr_bucket_brigade *bb, apr_pool_t *p) | 
| static APR_INLINE apr_status_t | apreq_brigade_copy (apr_bucket_brigade *d, apr_bucket_brigade *s) | 
| static APR_INLINE void | apreq_brigade_move (apr_bucket_brigade *d, apr_bucket_brigade *s, apr_bucket *e) | 
| apr_status_t | apreq_header_attribute (const char *hdr, const char *name, const apr_size_t nlen, const char **val, apr_size_t *vlen) | 
| apr_status_t | apreq_brigade_concat (apr_pool_t *pool, const char *temp_dir, apr_size_t brigade_limit, apr_bucket_brigade *out, apr_bucket_brigade *in) | 
| apr_file_t * | apreq_brigade_spoolfile (apr_bucket_brigade *bb) | 
Utility functions for apreq.
This header contains useful functions for creating new parsers, hooks or modules. It includes
| apr_int64_t apreq_atoi64f | ( | const char * | s | ) | 
Converts file sizes (KMG) to bytes
| s | file size matching m/^\d+[KMG]b?$/i | 
| apr_int64_t apreq_atoi64t | ( | const char * | s | ) | 
Converts time strings (YMDhms) to seconds
| s | time string matching m/^\+?\d+[YMDhms]$/ | 
| apr_status_t apreq_brigade_concat | ( | apr_pool_t * | pool, | 
| const char * | temp_dir, | ||
| apr_size_t | brigade_limit, | ||
| apr_bucket_brigade * | out, | ||
| apr_bucket_brigade * | in | ||
| ) | 
Concatenates the brigades, spooling large brigades into a tempfile (APREQ_SPOOL) bucket.
| pool | Pool for creating a tempfile bucket. | 
| temp_dir | Directory for tempfile creation. | 
| brigade_limit | If out's length would exceed this value, the appended buckets get written to a tempfile. | 
| out | Resulting brigade. | 
| in | Brigade to append. | 
| 
 | static | 
Copy a brigade.
| d | (destination) Copied buckets are appended to this brigade. | 
| s | (source) Brigade to copy from. | 
| apr_status_t apreq_brigade_fwrite | ( | apr_file_t * | f, | 
| apr_off_t * | wlen, | ||
| apr_bucket_brigade * | bb | ||
| ) | 
Writes brigade to a file.
| f | File that gets the brigade. | 
| wlen | On a successful return, wlen holds the length of the brigade, which is the amount of data written to the file. | 
| bb | Bucket brigade. | 
| 
 | static | 
Move the front of a brigade.
| d | (destination) Append buckets to this brigade. | 
| s | (source) Brigade to take buckets from. | 
| e | First bucket of s after the move. All buckets before e are appended to d. | 
| 
 | static | 
Set aside all buckets in the brigade.
| bb | Brigade. | 
| p | Setaside buckets into this pool. | 
| apr_file_t* apreq_brigade_spoolfile | ( | apr_bucket_brigade * | bb | ) | 
Determines the spool file used by the brigade. Returns NULL if the brigade is not spooled in a file (does not use an APREQ_SPOOL bucket).
| bb | the bucket brigade | 
| apreq_charset_t apreq_charset_divine | ( | const char * | src, | 
| apr_size_t | slen | ||
| ) | 
Heuristically determine the charset of a string.
| src | String to scan. | 
| slen | Length of string. | 
| apr_size_t apreq_cp1252_to_utf8 | ( | char * | dest, | 
| const char * | src, | ||
| apr_size_t | slen | ||
| ) | 
Convert a string from cp1252 to utf8. Caller must ensure it is large enough to hold the encoded string and trailing '\0'.
| dest | Location of utf8-encoded result string. Caller must ensure it is large enough to hold the encoded string and trailing '\0'. | 
| src | Original string. | 
| slen | Length of original string. | 
| apr_status_t apreq_decode | ( | char * | dest, | 
| apr_size_t * | dlen, | ||
| const char * | src, | ||
| apr_size_t | slen | ||
| ) | 
Url-decodes a string.
| dest | Location of url-encoded result string. Caller must ensure dest is large enough to hold the encoded string and trailing null character. | 
| dlen | points to resultant length of url-decoded string in dest | 
| src | Original string. | 
| slen | Length of original string. | 
| apr_status_t apreq_decodev | ( | char * | dest, | 
| apr_size_t * | dlen, | ||
| struct iovec * | v, | ||
| int | nelts | ||
| ) | 
Url-decodes an iovec array.
| dest | Location of url-encoded result string. Caller must ensure dest is large enough to hold the encoded string and trailing null character. | 
| dlen | Resultant length of dest. | 
| v | Array of iovecs that represent the source string | 
| nelts | Number of iovecs in the array. | 
| apr_size_t apreq_encode | ( | char * | dest, | 
| const char * | src, | ||
| const apr_size_t | slen | ||
| ) | 
Url-encodes a string.
| dest | Location of url-encoded result string. Caller must ensure it is large enough to hold the encoded string and trailing '\0'. | 
| src | Original string. | 
| slen | Length of original string. | 
| 
 | static | 
Returns an url-encoded copy of a string.
| p | Pool used to allocate the return value. | 
| src | Original string. | 
| slen | Length of original string. | 
| apr_status_t apreq_file_mktemp | ( | apr_file_t ** | fp, | 
| apr_pool_t * | pool, | ||
| const char * | path | ||
| ) | 
Makes a temporary file.
| fp | Points to the temporary apr_file_t on success. | 
| pool | Pool to associate with the temp file. When the pool is destroyed, the temp file will be closed and deleted. | 
| path | The base directory which will contain the temp file. If param == NULL, the directory will be selected via tempnam(). See the tempnam manpage for details. | 
| apr_status_t apreq_header_attribute | ( | const char * | hdr, | 
| const char * | name, | ||
| const apr_size_t | nlen, | ||
| const char ** | val, | ||
| apr_size_t * | vlen | ||
| ) | 
Search a header string for the value of a particular named attribute.
| hdr | Header string to scan. | 
| name | Name of attribute to search for. | 
| nlen | Length of name. | 
| val | Location of (first) matching value. | 
| vlen | Length of matching value. | 
| apr_ssize_t apreq_index | ( | const char * | hay, | 
| apr_size_t | hlen, | ||
| const char * | ndl, | ||
| apr_size_t | nlen, | ||
| const apreq_match_t | type | ||
| ) | 
Returns offset of match string's location, or -1 if no match is found.
| hay | Location of bytes to scan. | 
| hlen | Number of bytes available for scanning. | 
| ndl | Search string | 
| nlen | Length of search string. | 
| type | Match type. | 
| char* apreq_join | ( | apr_pool_t * | p, | 
| const char * | sep, | ||
| const apr_array_header_t * | arr, | ||
| apreq_join_t | mode | ||
| ) | 
Join an array of values. The result is an empty string if there are no values.
| p | Pool to allocate return value. | 
| sep | String that is inserted between the joined values. | 
| arr | Array of apreq_value_t entries. | 
| mode | Join type- see apreq_join_t. | 
| apr_size_t apreq_quote | ( | char * | dest, | 
| const char * | src, | ||
| const apr_size_t | slen | ||
| ) | 
Places a quoted copy of src into dest. Embedded quotes are escaped with a backslash ('\').
| dest | Location of quoted copy. Must be large enough to hold the copy and trailing null byte. | 
| src | Original string. | 
| slen | Length of original string. | 
| dest | Destination string. | 
| apr_size_t apreq_quote_once | ( | char * | dest, | 
| const char * | src, | ||
| const apr_size_t | slen | ||
| ) | 
Same as apreq_quote() except when src begins and ends in quote marks. In that case it assumes src is quoted correctly, and just copies src to dest.
| dest | Location of quoted copy. Must be large enough to hold the copy and trailing null byte. | 
| src | Original string. | 
| slen | Length of original string. | 
| dest | Destination string. | 
| 
 | static | 
An in-situ url-decoder.
| str | The string to decode |