Apache HTTPD
Modules | Classes | Macros | Typedefs | Enumerations | Functions
Proxy request types

Modules

 Flags which indicate places where the server should stop for debugging.
 

Classes

struct  conn_rec
 Structure to store things which are per connection. More...
 
struct  conn_state_t
 A structure to contain connection state information. More...
 
struct  server_addr_rec
 A structure to be used for Per-vhost config. More...
 
struct  ap_logconf
 
struct  server_rec
 A structure to store information for each virtual server. More...
 
struct  ap_sload_t
 A structure to hold server load params. More...
 
struct  ap_loadavg_t
 A structure to hold various server loadavg. More...
 
struct  ap_form_pair_t
 
struct  ap_dir_match_t
 

Macros

#define PROXYREQ_NONE   0
 
#define PROXYREQ_PROXY   1
 
#define PROXYREQ_REVERSE   2
 
#define PROXYREQ_RESPONSE   3
 
#define DEFAULT_VHOST_ADDR   0xfffffffful
 
#define AP_UNESCAPE_URL_KEEP_UNRESERVED   (1u << 0)
 
#define AP_UNESCAPE_URL_FORBID_SLASHES   (1u << 1)
 
#define AP_UNESCAPE_URL_KEEP_SLASHES   (1u << 2)
 
#define AP_NORMALIZE_ALLOW_RELATIVE   (1u << 0)
 
#define AP_NORMALIZE_NOT_ABOVE_ROOT   (1u << 1)
 
#define AP_NORMALIZE_DECODE_UNRESERVED   (1u << 2)
 
#define AP_NORMALIZE_MERGE_SLASHES   (1u << 3)
 
#define AP_NORMALIZE_DROP_PARAMETERS   (0) /* deprecated */
 
#define ap_escape_uri(ppool, path)   ap_os_escape_path(ppool,path,1)
 
#define ap_escape_html(p, s)   ap_escape_html2(p,s,0)
 
#define ap_assert(exp)   ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
 
#define AP_DEBUG_ASSERT(exp)   ((void)0)
 
#define ap_strchr(s, c)   strchr(s, c)
 
#define ap_strchr_c(s, c)   strchr(s, c)
 
#define ap_strrchr(s, c)   strrchr(s, c)
 
#define ap_strrchr_c(s, c)   strrchr(s, c)
 
#define ap_strstr(s, c)   strstr(s, c)
 
#define ap_strstr_c(s, c)   strstr(s, c)
 
#define AP_HAS_THREAD_LOCAL   0
 
#define AP_NORESTART   APR_OS_START_USEERR + 1
 
#define AP_DIR_FLAG_NONE   0
 
#define AP_DIR_FLAG_OPTIONAL   1
 
#define AP_DIR_FLAG_RECURSIVE   2
 
#define AP_IS_SLASH(s)   (s == '/')
 
#define AP_SLASHES   "/"
 

Typedefs

typedef struct server_addr_rec server_addr_rec
 
typedef struct ap_sload_t ap_sload_t
 
typedef struct ap_loadavg_t ap_loadavg_t
 
typedef struct ap_dir_match_t ap_dir_match_t
 

Enumerations

enum  ap_conn_keepalive_e { AP_CONN_UNKNOWN , AP_CONN_CLOSE , AP_CONN_KEEPALIVE }
 Enumeration of connection keepalive options. More...
 
enum  conn_state_e {
  CONN_STATE_CHECK_REQUEST_LINE_READABLE , CONN_STATE_READ_REQUEST_LINE , CONN_STATE_HANDLER , CONN_STATE_WRITE_COMPLETION ,
  CONN_STATE_SUSPENDED , CONN_STATE_LINGER , CONN_STATE_LINGER_NORMAL , CONN_STATE_LINGER_SHORT ,
  CONN_STATE_NUM
}
 
enum  conn_sense_e { CONN_SENSE_DEFAULT , CONN_SENSE_WANT_READ , CONN_SENSE_WANT_WRITE }
 

Functions

const charap_context_document_root (request_rec *r)
 
const charap_context_prefix (request_rec *r)
 
void ap_set_context_info (request_rec *r, const char *prefix, const char *document_root)
 
void ap_set_document_root (request_rec *r, const char *document_root)
 
charap_field_noparam (apr_pool_t *p, const char *intype)
 
charap_ht_time (apr_pool_t *p, apr_time_t t, const char *fmt, int gmt)
 
charap_getword (apr_pool_t *p, const char **line, char stop)
 
charap_getword_nc (apr_pool_t *p, char **line, char stop)
 
charap_getword_white (apr_pool_t *p, const char **line)
 
charap_getword_white_nc (apr_pool_t *p, char **line)
 
charap_getword_nulls (apr_pool_t *p, const char **line, char stop)
 
charap_getword_nulls_nc (apr_pool_t *p, char **line, char stop)
 
charap_getword_conf (apr_pool_t *p, const char **line)
 
charap_getword_conf_nc (apr_pool_t *p, char **line)
 
charap_getword_conf2 (apr_pool_t *p, const char **line)
 
charap_getword_conf2_nc (apr_pool_t *p, char **line)
 
const charap_resolve_env (apr_pool_t *p, const char *word)
 
const charap_size_list_item (const char **field, int *len)
 
charap_get_list_item (apr_pool_t *p, const char **field)
 
int ap_find_list_item (apr_pool_t *p, const char *line, const char *tok)
 
int ap_find_etag_weak (apr_pool_t *p, const char *line, const char *tok)
 
int ap_find_etag_strong (apr_pool_t *p, const char *line, const char *tok)
 
const charap_scan_http_field_content (const char *ptr)
 
const charap_scan_http_token (const char *ptr)
 
const charap_scan_vchar_obstext (const char *ptr)
 
const charap_parse_token_list_strict (apr_pool_t *p, const char *tok, apr_array_header_t **tokens, int skip_invalid)
 
charap_get_token (apr_pool_t *p, const char **accept_line, int accept_white)
 
int ap_find_token (apr_pool_t *p, const char *line, const char *tok)
 
int ap_find_last_token (apr_pool_t *p, const char *line, const char *tok)
 
int ap_is_url (const char *u)
 
int ap_unescape_all (char *url)
 
int ap_unescape_url (char *url)
 
int ap_unescape_url_keep2f (char *url, int decode_slashes)
 
int ap_unescape_url_ex (char *url, unsigned int flags)
 
int ap_unescape_urlencoded (char *query)
 
void ap_no2slash (char *name)
 
void ap_no2slash_ex (char *name, int is_fs_path)
 
int ap_normalize_path (char *path, unsigned int flags)
 
void ap_getparents (char *name)
 
charap_escape_path_segment (apr_pool_t *p, const char *s)
 
charap_escape_path_segment_buffer (char *c, const char *s)
 
charap_os_escape_path (apr_pool_t *p, const char *path, int partial)
 
charap_escape_urlencoded (apr_pool_t *p, const char *s)
 
charap_escape_urlencoded_buffer (char *c, const char *s)
 
charap_escape_html2 (apr_pool_t *p, const char *s, int toasc)
 
charap_escape_logitem (apr_pool_t *p, const char *str)
 
apr_size_t ap_escape_errorlog_item (char *dest, const char *source, apr_size_t buflen)
 
charap_construct_server (apr_pool_t *p, const char *hostname, apr_port_t port, const request_rec *r)
 
charap_escape_shell_cmd (apr_pool_t *p, const char *s)
 
int ap_count_dirs (const char *path)
 
charap_make_dirstr_prefix (char *d, const char *s, int n)
 
charap_make_dirstr_parent (apr_pool_t *p, const char *s)
 
charap_make_full_path (apr_pool_t *a, const char *dir, const char *f)
 
int ap_os_is_path_absolute (apr_pool_t *p, const char *dir)
 
int ap_is_matchexp (const char *str)
 
int ap_strcmp_match (const char *str, const char *expected)
 
int ap_strcasecmp_match (const char *str, const char *expected)
 
charap_strcasestr (const char *s1, const char *s2)
 
const charap_stripprefix (const char *bigstring, const char *prefix)
 
charap_pbase64decode (apr_pool_t *p, const char *bufcoded)
 
charap_pbase64encode (apr_pool_t *p, char *string)
 
ap_regex_tap_pregcomp (apr_pool_t *p, const char *pattern, int cflags)
 
void ap_pregfree (apr_pool_t *p, ap_regex_t *reg)
 
charap_pregsub (apr_pool_t *p, const char *input, const char *source, apr_size_t nmatch, ap_regmatch_t pmatch[])
 
apr_status_t ap_pregsub_ex (apr_pool_t *p, char **result, const char *input, const char *source, apr_size_t nmatch, ap_regmatch_t pmatch[], apr_size_t maxlen)
 
void ap_content_type_tolower (char *s)
 
void ap_str_tolower (char *s)
 
void ap_str_toupper (char *s)
 
int ap_ind (const char *str, char c)
 
int ap_rind (const char *str, char c)
 
charap_escape_quotes (apr_pool_t *p, const char *instring)
 
charap_append_pid (apr_pool_t *p, const char *string, const char *delim)
 
int ap_parse_strict_length (apr_off_t *len, const char *str)
 
apr_status_t ap_timeout_parameter_parse (const char *timeout_parameter, apr_interval_time_t *timeout, const char *default_time_unit)
 
int ap_request_has_body (request_rec *r)
 
apr_status_t ap_pstr2_alnum (apr_pool_t *p, const char *src, const char **dest)
 
apr_status_t ap_str2_alnum (const char *src, char *dest)
 
int ap_parse_form_data (request_rec *r, struct ap_filter_t *f, apr_array_header_t **ptr, apr_size_t num, apr_size_t size)
 
int ap_is_rdirectory (apr_pool_t *p, const char *name)
 
int ap_is_directory (apr_pool_t *p, const char *name)
 
charap_get_local_host (apr_pool_t *p)
 
void ap_log_assert (const char *szExp, const char *szFile, int nLine) __attribute__((noreturn))
 
const charap_psignature (const char *prefix, request_rec *r)
 
charap_strchr (char *s, int c)
 
const charap_strchr_c (const char *s, int c)
 
charap_strrchr (char *s, int c)
 
const charap_strrchr_c (const char *s, int c)
 
charap_strstr (char *s, const char *c)
 
const charap_strstr_c (const char *s, const char *c)
 
void ap_random_insecure_bytes (void *buf, apr_size_t size)
 
apr_uint32_t ap_random_pick (apr_uint32_t min, apr_uint32_t max)
 
void ap_abort_on_oom (void) __attribute__((noreturn))
 
void * ap_malloc (size_t size) __attribute__((malloc))
 
void * ap_calloc (size_t nelem, size_t size) __attribute__((malloc))
 
void * ap_realloc (void *ptr, size_t size)
 
void ap_get_sload (ap_sload_t *ld)
 
void ap_get_loadavg (ap_loadavg_t *ld)
 
void ap_bin2hex (const void *src, apr_size_t srclen, char *dest)
 
charap_get_exec_line (apr_pool_t *p, const char *cmd, const char *const *argv)
 
int ap_array_str_index (const apr_array_header_t *array, const char *s, int start)
 
int ap_array_str_contains (const apr_array_header_t *array, const char *s)
 
int ap_cstr_casecmp (const char *s1, const char *s2)
 
int ap_cstr_casecmpn (const char *s1, const char *s2, apr_size_t n)
 
const charap_dir_nofnmatch (ap_dir_match_t *w, const char *fname) __attribute__((nonnull(1
 
const char const charap_dir_fnmatch (ap_dir_match_t *w, const char *path, const char *fname) __attribute__((nonnull(1
 
const char const char int ap_is_chunked (apr_pool_t *p, const char *line)
 
apr_status_t ap_filepath_merge (char **newpath, const char *rootpath, const char *addpath, apr_int32_t flags, apr_pool_t *p)
 

Detailed Description

Possible values of request_rec->proxyreq. A request could be normal, proxied or reverse proxied. Normally proxied and reverse proxied are grouped together as just "proxied", but sometimes it's necessary to tell the difference between the two, such as for authentication.

Macro Definition Documentation

◆ ap_assert

#define ap_assert (   exp)    ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))

Definition at line 2271 of file httpd.h.

◆ AP_DEBUG_ASSERT

#define AP_DEBUG_ASSERT (   exp)    ((void)0)

Redefine assert() to something more useful for an Apache...

Use ap_assert() if the condition should always be checked. Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG is defined.

Definition at line 2283 of file httpd.h.

◆ AP_DIR_FLAG_NONE

#define AP_DIR_FLAG_NONE   0

Default flags for ap_dir_*fnmatch().

Definition at line 2574 of file httpd.h.

◆ AP_DIR_FLAG_OPTIONAL

#define AP_DIR_FLAG_OPTIONAL   1

If set, wildcards that match no files or directories will be ignored, otherwise an error is triggered.

Definition at line 2580 of file httpd.h.

◆ AP_DIR_FLAG_RECURSIVE

#define AP_DIR_FLAG_RECURSIVE   2

If set, and the wildcard resolves to a directory, recursively find all files below that directory, otherwise return the directory.

Definition at line 2586 of file httpd.h.

◆ ap_escape_html

#define ap_escape_html (   p,
  s 
)    ap_escape_html2(p,s,0)

Escape an html string

Parameters
pThe pool to allocate from
sThe html to escape
Returns
The escaped string

Definition at line 1860 of file httpd.h.

◆ ap_escape_uri

#define ap_escape_uri (   ppool,
  path 
)    ap_os_escape_path(ppool,path,1)
See also
ap_os_escape_path

Definition at line 1836 of file httpd.h.

◆ AP_HAS_THREAD_LOCAL

#define AP_HAS_THREAD_LOCAL   0

Definition at line 2482 of file httpd.h.

◆ AP_IS_SLASH

#define AP_IS_SLASH (   s)    (s == '/')

Definition at line 2698 of file httpd.h.

◆ AP_NORESTART

#define AP_NORESTART   APR_OS_START_USEERR + 1

Definition at line 2519 of file httpd.h.

◆ AP_NORMALIZE_ALLOW_RELATIVE

#define AP_NORMALIZE_ALLOW_RELATIVE   (1u << 0)

Definition at line 1787 of file httpd.h.

◆ AP_NORMALIZE_DECODE_UNRESERVED

#define AP_NORMALIZE_DECODE_UNRESERVED   (1u << 2)

Definition at line 1789 of file httpd.h.

◆ AP_NORMALIZE_DROP_PARAMETERS

#define AP_NORMALIZE_DROP_PARAMETERS   (0) /* deprecated */

Definition at line 1791 of file httpd.h.

◆ AP_NORMALIZE_MERGE_SLASHES

#define AP_NORMALIZE_MERGE_SLASHES   (1u << 3)

Definition at line 1790 of file httpd.h.

◆ AP_NORMALIZE_NOT_ABOVE_ROOT

#define AP_NORMALIZE_NOT_ABOVE_ROOT   (1u << 1)

Definition at line 1788 of file httpd.h.

◆ AP_SLASHES

#define AP_SLASHES   "/"

Definition at line 2699 of file httpd.h.

◆ ap_strchr

#define ap_strchr (   s,
  c 
)    strchr(s, c)

use this instead of strchr

Definition at line 2351 of file httpd.h.

◆ ap_strchr_c

#define ap_strchr_c (   s,
  c 
)    strchr(s, c)

use this instead of strchr

Definition at line 2353 of file httpd.h.

◆ ap_strrchr

#define ap_strrchr (   s,
  c 
)    strrchr(s, c)

use this instead of strrchr

Definition at line 2355 of file httpd.h.

◆ ap_strrchr_c

#define ap_strrchr_c (   s,
  c 
)    strrchr(s, c)

use this instead of strrchr

Definition at line 2357 of file httpd.h.

◆ ap_strstr

#define ap_strstr (   s,
  c 
)    strstr(s, c)

use this instead of strrstr

Definition at line 2359 of file httpd.h.

◆ ap_strstr_c

#define ap_strstr_c (   s,
  c 
)    strstr(s, c)

use this instead of strrstr

Definition at line 2361 of file httpd.h.

◆ AP_UNESCAPE_URL_FORBID_SLASHES

#define AP_UNESCAPE_URL_FORBID_SLASHES   (1u << 1)

Definition at line 1753 of file httpd.h.

◆ AP_UNESCAPE_URL_KEEP_SLASHES

#define AP_UNESCAPE_URL_KEEP_SLASHES   (1u << 2)

Definition at line 1754 of file httpd.h.

◆ AP_UNESCAPE_URL_KEEP_UNRESERVED

#define AP_UNESCAPE_URL_KEEP_UNRESERVED   (1u << 0)

Definition at line 1752 of file httpd.h.

◆ DEFAULT_VHOST_ADDR

#define DEFAULT_VHOST_ADDR   0xfffffffful

The address 255.255.255.255, when used as a virtualhost address, will become the "default" server when the ip doesn't match other vhosts.

Definition at line 1293 of file httpd.h.

◆ PROXYREQ_NONE

#define PROXYREQ_NONE   0

No proxy

Definition at line 1133 of file httpd.h.

◆ PROXYREQ_PROXY

#define PROXYREQ_PROXY   1

Standard proxy

Definition at line 1134 of file httpd.h.

◆ PROXYREQ_RESPONSE

#define PROXYREQ_RESPONSE   3

Origin response

Definition at line 1136 of file httpd.h.

◆ PROXYREQ_REVERSE

#define PROXYREQ_REVERSE   2

Reverse proxy

Definition at line 1135 of file httpd.h.

Typedef Documentation

◆ ap_dir_match_t

Structure to provide the state of a directory match.

Definition at line 2591 of file httpd.h.

◆ ap_loadavg_t

Definition at line 1426 of file httpd.h.

◆ ap_sload_t

Definition at line 1410 of file httpd.h.

◆ server_addr_rec

Definition at line 1300 of file httpd.h.

Enumeration Type Documentation

◆ ap_conn_keepalive_e

Enumeration of connection keepalive options.

Enumerator
AP_CONN_UNKNOWN 
AP_CONN_CLOSE 
AP_CONN_KEEPALIVE 

Definition at line 1143 of file httpd.h.

◆ conn_sense_e

Enumerator
CONN_SENSE_DEFAULT 
CONN_SENSE_WANT_READ 
CONN_SENSE_WANT_WRITE 

Definition at line 1271 of file httpd.h.

◆ conn_state_e

Enumeration of connection states The two states CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT may only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM.

Enumerator
CONN_STATE_CHECK_REQUEST_LINE_READABLE 
CONN_STATE_READ_REQUEST_LINE 
CONN_STATE_HANDLER 
CONN_STATE_WRITE_COMPLETION 
CONN_STATE_SUSPENDED 
CONN_STATE_LINGER 
CONN_STATE_LINGER_NORMAL 
CONN_STATE_LINGER_SHORT 
CONN_STATE_NUM 

Definition at line 1258 of file httpd.h.

Function Documentation

◆ ap_abort_on_oom()

void ap_abort_on_oom ( void  )

Abort with a error message signifying out of memory

Definition at line 3136 of file util.c.

◆ ap_append_pid()

char * ap_append_pid ( apr_pool_t p,
const char string,
const char delim 
)

Given a string, append the PID deliminated by delim. Usually used to create a pid-appended filepath name (eg: /a/b/foo -> /a/b/foo.6726). A function, and not a macro, to avoid unistd.h dependency

Parameters
pThe pool to allocate memory from
stringThe string to append the PID to
delimThe string to use to deliminate the string from the PID
Returns
A copy of the string with the PID appended

Definition at line 2595 of file util.c.

◆ ap_array_str_contains()

int ap_array_str_contains ( const apr_array_header_t array,
const char s 
)

Check if the string is member of the given array by strcmp.

Parameters
arrayThe array the check
sThe string to find
Returns
!=0 iff string is member of array (via strcmp)

Definition at line 3446 of file util.c.

◆ ap_array_str_index()

int ap_array_str_index ( const apr_array_header_t array,
const char s,
int  start 
)

Get the first index of the string in the array or -1 if not found. Start searching a start.

Parameters
arrayThe array the check
sThe string to find
startStart index for search. If start is out of bounds (negative or
equal to array length or greater), -1 will be returned.
Returns
index of string in array or -1

Definition at line 3428 of file util.c.

◆ ap_bin2hex()

void ap_bin2hex ( const void *  src,
apr_size_t  srclen,
char dest 
)

Convert binary data into a hex string

Parameters
srcpointer to the data
srclenlength of the data
destpointer to buffer of length (2 * srclen + 1). The resulting string will be NUL-terminated.

Definition at line 2314 of file util.c.

◆ ap_calloc()

void * ap_calloc ( size_t  nelem,
size_t  size 
)

Wrapper for calloc() that calls ap_abort_on_oom() if out of memory

Parameters
nelemnumber of elements to allocate memory for
sizesize of a single element
Returns
pointer to the allocated memory
Note
ap_calloc may be implemented as a macro

Definition at line 3160 of file util.c.

◆ ap_construct_server()

char * ap_construct_server ( apr_pool_t p,
const char hostname,
apr_port_t  port,
const request_rec r 
)

Construct a full hostname

Parameters
pThe pool to allocate from
hostnameThe hostname of the server
portThe port the server is running on
rThe current request
Returns
The server's hostname

Definition at line 1994 of file util.c.

◆ ap_content_type_tolower()

void ap_content_type_tolower ( char s)

We want to downcase the type/subtype for comparison purposes but nothing else because ;parameter=foo values are case sensitive.

Parameters
sThe content-type to convert to lowercase

Definition at line 2505 of file util.c.

◆ ap_context_document_root()

const char * ap_context_document_root ( request_rec r)

Get the context_document_root for a request. This is a generalization of the document root, which is too limited in the presence of mappers like mod_userdir and mod_alias. The context_document_root is the directory on disk that maps to the context_prefix URI prefix.

Parameters
rThe request
Note
For resources that do not map to the file system or for very complex mappings, this information may still be wrong.

Definition at line 848 of file core.c.

◆ ap_context_prefix()

const char * ap_context_prefix ( request_rec r)

Get the context_prefix for a request. The context_prefix URI prefix maps to the context_document_root on disk.

Parameters
rThe request

Definition at line 839 of file core.c.

◆ ap_count_dirs()

int ap_count_dirs ( const char path)

Count the number of directories in a path

Parameters
pathThe path to count
Returns
The number of directories

Definition at line 708 of file util.c.

◆ ap_cstr_casecmp()

int ap_cstr_casecmp ( const char s1,
const char s2 
)

Perform a case-insensitive comparison of two strings str1 and str2, treating upper and lower case values of the 26 standard C/POSIX alphabetic characters as equivalent. Extended latin characters outside of this set are treated as unique octets, irrespective of the current locale.

Returns in integer greater than, equal to, or less than 0, according to whether str1 is considered greater than, equal to, or less than str2.

Note
Same code as apr_cstr_casecmp, which arrives in APR 1.6

Definition at line 3542 of file util.c.

◆ ap_cstr_casecmpn()

int ap_cstr_casecmpn ( const char s1,
const char s2,
apr_size_t  n 
)

Perform a case-insensitive comparison of two strings str1 and str2, treating upper and lower case values of the 26 standard C/POSIX alphabetic characters as equivalent. Extended latin characters outside of this set are treated as unique octets, irrespective of the current locale.

Returns in integer greater than, equal to, or less than 0, according to whether str1 is considered greater than, equal to, or less than str2.

Note
Same code as apr_cstr_casecmpn, which arrives in APR 1.6

Definition at line 3559 of file util.c.

◆ ap_dir_fnmatch()

const char const char * ap_dir_fnmatch ( ap_dir_match_t w,
const char path,
const char fname 
)

Search for files given a wildcard filename with non native separators.

If the filename contains a wildcard, all files and directories that match the wildcard will be returned.

ap_dir_nofnmatch() is called for each directory and file found, and the callback within ap_dir_match_t triggered as described above.

Wildcards may appear in both directory and file components in the path, and wildcards may appear more than once.

Parameters
wDirectory match structure containing callback and context.
pathPath prefix for search, with non native separators and no wildcards.
fnameThe name of the file or directory, with non native separators and optional wildcards.
Returns
NULL on success, or a string describing the error.

◆ ap_dir_nofnmatch()

const char * ap_dir_nofnmatch ( ap_dir_match_t w,
const char fname 
)

Search for files given a non wildcard filename with non native separators.

If the provided filename points at a file, the callback within ap_dir_match_t is triggered for that file, and this function returns the result of the callback.

If the provided filename points at a directory, and recursive within ap_dir_match_t is true, the callback will be triggered for every file found recursively beneath that directory, otherwise the callback is triggered once for the directory itself. This function returns the result of the callback.

If the provided path points to neither a file nor a directory, and optional within ap_dir_match_t is true, this function returns NULL. If optional within ap_dir_match_t is false, this function will return an error string indicating that the path does not exist.

Parameters
wDirectory match structure containing callback and context.
fnameThe name of the file or directory, with non native separators.
Returns
NULL on success, or a string describing the error.

◆ ap_escape_errorlog_item()

apr_size_t ap_escape_errorlog_item ( char dest,
const char source,
apr_size_t  buflen 
)

Escape a string for logging into the error log (without a pool)

Parameters
destThe buffer to write to
sourceThe string to escape
buflenThe buffer size for the escaped string (including "\0")
Returns
The len of the escaped string (always < maxlen)

Definition at line 2251 of file util.c.

◆ ap_escape_html2()

char * ap_escape_html2 ( apr_pool_t p,
const char s,
int  toasc 
)

Escape an html string

Parameters
pThe pool to allocate from
sThe html to escape
toascWhether to escape all non-ASCII chars to &#nnn;
Returns
The escaped string

Definition at line 2131 of file util.c.

◆ ap_escape_logitem()

char * ap_escape_logitem ( apr_pool_t p,
const char str 
)

Escape a string for logging

Parameters
pThe pool to allocate from
strThe string to escape
Returns
The escaped string

Definition at line 2183 of file util.c.

◆ ap_escape_path_segment()

char * ap_escape_path_segment ( apr_pool_t p,
const char s 
)

Escape a path segment, as defined in RFC 1808

Parameters
pThe pool to allocate from
sThe path to convert
Returns
The converted URL

Definition at line 2068 of file util.c.

◆ ap_escape_path_segment_buffer()

char * ap_escape_path_segment_buffer ( char c,
const char s 
)

Escape a path segment, as defined in RFC 1808, to a preallocated buffer.

Parameters
cThe preallocated buffer to write to
sThe path to convert
Returns
The converted URL (c)

Definition at line 2049 of file util.c.

◆ ap_escape_quotes()

char * ap_escape_quotes ( apr_pool_t p,
const char instring 
)

Given a string, replace any bare " with \" .

Parameters
pThe pool to allocate memory from
instringThe string to search for "
Returns
A copy of the string with escaped quotes

Definition at line 2524 of file util.c.

◆ ap_escape_shell_cmd()

char * ap_escape_shell_cmd ( apr_pool_t p,
const char s 
)

Escape a shell command

Parameters
pThe pool to allocate from
sThe command to escape
Returns
The escaped shell command

Definition at line 1812 of file util.c.

◆ ap_escape_urlencoded()

char * ap_escape_urlencoded ( apr_pool_t p,
const char s 
)

Escape a string as application/x-www-form-urlencoded

Parameters
pThe pool to allocate from
sThe path to convert
Returns
The converted URL

Definition at line 2124 of file util.c.

◆ ap_escape_urlencoded_buffer()

char * ap_escape_urlencoded_buffer ( char c,
const char s 
)

Escape a string as application/x-www-form-urlencoded, to a preallocated buffer

Parameters
cThe preallocated buffer to write to
sThe path to convert
Returns
The converted URL (c)

Definition at line 2102 of file util.c.

◆ ap_field_noparam()

char * ap_field_noparam ( apr_pool_t p,
const char intype 
)

Examine a field value (such as a media-/content-type) string and return it sans any parameters; e.g., strip off any ';charset=foo' and the like.

Parameters
pPool to allocate memory from
intypeThe field to examine
Returns
A copy of the field minus any parameters

Definition at line 91 of file util.c.

◆ ap_filepath_merge()

apr_status_t ap_filepath_merge ( char **  newpath,
const char rootpath,
const char addpath,
apr_int32_t  flags,
apr_pool_t p 
)

apr_filepath_merge with an allow-list Merge additional file path onto the previously processed rootpath

Parameters
newpaththe merged paths returned
rootpaththe root file path (NULL uses the current working path)
addpaththe path to add to the root path
flagsthe desired APR_FILEPATH_ rules to apply when merging
pthe pool to allocate the new path string from
Remarks
if the flag APR_FILEPATH_TRUENAME is given, and the addpath contains wildcard characters ('*', '?') on platforms that don't support such characters within filenames, the paths will be merged, but the result code will be APR_EPATHWILD, and all further segments will not reflect the true filenames including the wildcard and following segments.

Definition at line 5712 of file core.c.

◆ ap_find_etag_strong()

int ap_find_etag_strong ( apr_pool_t p,
const char line,
const char tok 
)

Do a strong ETag comparison within an HTTP field value list.

Parameters
pThe pool to allocate from
lineThe field value list to search
tokThe token to search for
Returns
1 if found, 0 if not found.

Definition at line 1546 of file util.c.

◆ ap_find_etag_weak()

int ap_find_etag_weak ( apr_pool_t p,
const char line,
const char tok 
)

Do a weak ETag comparison within an HTTP field value list.

Parameters
pThe pool to allocate from
lineThe field value list to search
tokThe token to search for
Returns
1 if found, 0 if not found.

Definition at line 1555 of file util.c.

◆ ap_find_last_token()

int ap_find_last_token ( apr_pool_t p,
const char line,
const char tok 
)

find http tokens from the end of the line

Parameters
pThe pool to allocate from
lineThe line to find the token
tokThe token to find
Returns
1 if the token is found, 0 otherwise

Definition at line 1780 of file util.c.

◆ ap_find_list_item()

int ap_find_list_item ( apr_pool_t p,
const char line,
const char tok 
)

Find an item in canonical form (lowercase, no extra spaces) within an HTTP field value list.

Parameters
pThe pool to allocate from
lineThe field value list to search
tokThe token to search for
Returns
1 if found, 0 if not found.

Definition at line 1537 of file util.c.

◆ ap_find_token()

int ap_find_token ( apr_pool_t p,
const char line,
const char tok 
)

Find http tokens, see the definition of token from RFC2068

Parameters
pThe pool to allocate from
lineThe line to find the token
tokThe token to find
Returns
1 if the token is found, 0 otherwise

Definition at line 1726 of file util.c.

◆ ap_get_exec_line()

char * ap_get_exec_line ( apr_pool_t p,
const char cmd,
const char *const argv 
)

Short function to execute a command and return the first line of output minus \r \n. Useful for "obscuring" passwords via exec calls

Parameters
pthe pool to allocate from
cmdthe command to execute
argvthe arguments to pass to the cmd
Returns
ptr to characters or NULL on any error

Definition at line 3386 of file util.c.

◆ ap_get_list_item()

char * ap_get_list_item ( apr_pool_t p,
const char **  field 
)

Retrieve an HTTP header field list item, as separated by a comma, while stripping insignificant whitespace and lowercasing anything not in a quoted string or comment.

Parameters
pThe pool to allocate from
fieldThe field to retrieve
Returns
The return value is a new string containing the converted list item (or NULL if none) and the address pointed to by field is shifted to the next non-comma, non-whitespace.

Definition at line 1314 of file util.c.

◆ ap_get_loadavg()

void ap_get_loadavg ( ap_loadavg_t ld)

Get server load averages (ala getloadavg)

Parameters
ldstruct to populate: -1 in fields means error

Definition at line 3360 of file util.c.

◆ ap_get_local_host()

char * ap_get_local_host ( apr_pool_t p)

Determine the local host name for the current machine

Parameters
pThe pool to allocate from
Returns
A copy of the local host name

Definition at line 2429 of file util.c.

◆ ap_get_sload()

void ap_get_sload ( ap_sload_t ld)

Get server load params

Parameters
ldstruct to populate: -1 in fields means error

Definition at line 3305 of file util.c.

◆ ap_get_token()

char * ap_get_token ( apr_pool_t p,
const char **  accept_line,
int  accept_white 
)

Retrieve a token, spacing over it and adjusting the pointer to the first non-white byte afterwards. Note that these tokens are delimited by semis and commas and can also be delimited by whitespace at the caller's option.

Parameters
pThe pool to allocate from
accept_lineThe line to retrieve the token from (adjusted afterwards)
accept_whiteIs it delimited by whitespace
Returns
the token

Definition at line 1687 of file util.c.

◆ ap_getparents()

void ap_getparents ( char name)

Remove all ./ and xx/../ substrings from a file name. Also remove any leading ../ or /../ substrings.

Parameters
namethe file name to parse

Definition at line 602 of file util.c.

◆ ap_getword()

char * ap_getword ( apr_pool_t p,
const char **  line,
char  stop 
)

Get the characters until the first occurrence of a specified character

Parameters
pThe pool to allocate memory from
lineThe string to get the characters from
stopThe character to stop at
Returns
A copy of the characters up to the first stop character

Definition at line 723 of file util.c.

◆ ap_getword_conf()

char * ap_getword_conf ( apr_pool_t p,
const char **  line 
)

Get the second word in the string paying attention to quoting

Parameters
pThe pool to allocate from
lineThe line to traverse
Returns
A copy of the string

Definition at line 833 of file util.c.

◆ ap_getword_conf2()

char * ap_getword_conf2 ( apr_pool_t p,
const char **  line 
)

Get the second word in the string paying attention to quoting, with {...} supported as well as "..." and '...'

Parameters
pThe pool to allocate from
lineThe line to traverse
Returns
A copy of the string

Definition at line 882 of file util.c.

◆ ap_getword_conf2_nc()

char * ap_getword_conf2_nc ( apr_pool_t p,
char **  line 
)

Get the second word in the string paying attention to quoting, with {...} supported as well as "..." and '...'

Parameters
pThe pool to allocate from
lineThe line to traverse
Returns
A copy of the string
Note
The same as ap_getword_conf2(), except it doesn't use const char **.

Definition at line 877 of file util.c.

◆ ap_getword_conf_nc()

char * ap_getword_conf_nc ( apr_pool_t p,
char **  line 
)

Get the second word in the string paying attention to quoting

Parameters
pThe pool to allocate from
lineThe line to traverse
Returns
A copy of the string
Note
The same as ap_getword_conf(), except it doesn't use const char **.

Definition at line 828 of file util.c.

◆ ap_getword_nc()

char * ap_getword_nc ( apr_pool_t p,
char **  line,
char  stop 
)

Get the characters until the first occurrence of a specified character

Parameters
pThe pool to allocate memory from
lineThe string to get the characters from
stopThe character to stop at
Returns
A copy of the characters up to the first stop character
Note
This is the same as ap_getword(), except it doesn't use const char **.

Definition at line 718 of file util.c.

◆ ap_getword_nulls()

char * ap_getword_nulls ( apr_pool_t p,
const char **  line,
char  stop 
)

Get all characters from the first occurrence of stop to the first "\0"

Parameters
pThe pool to allocate memory from
lineThe line to traverse
stopThe character to start at
Returns
A copy of all characters after the first occurrence of the specified character

Definition at line 779 of file util.c.

◆ ap_getword_nulls_nc()

char * ap_getword_nulls_nc ( apr_pool_t p,
char **  line,
char  stop 
)

Get all characters from the first occurrence of stop to the first "\0"

Parameters
pThe pool to allocate memory from
lineThe line to traverse
stopThe character to start at
Returns
A copy of all characters after the first occurrence of the specified character
Note
The same as ap_getword_nulls(), except it doesn't use const char **.

Definition at line 773 of file util.c.

◆ ap_getword_white()

char * ap_getword_white ( apr_pool_t p,
const char **  line 
)

Get the first word from a given string. A word is defined as all characters up to the first whitespace.

Parameters
pThe pool to allocate memory from
lineThe string to traverse
Returns
The first word in the line

Definition at line 751 of file util.c.

◆ ap_getword_white_nc()

char * ap_getword_white_nc ( apr_pool_t p,
char **  line 
)

Get the first word from a given string. A word is defined as all characters up to the first whitespace.

Parameters
pThe pool to allocate memory from
lineThe string to traverse
Returns
The first word in the line
Note
The same as ap_getword_white(), except it doesn't use const char**

Definition at line 746 of file util.c.

◆ ap_ht_time()

char * ap_ht_time ( apr_pool_t p,
apr_time_t  t,
const char fmt,
int  gmt 
)

Convert a time from an integer into a string in a specified format

Parameters
pThe pool to allocate memory from
tThe time to convert
fmtThe format to use for the conversion
gmtConvert the time for GMT?
Returns
The string that represents the specified time

Definition at line 109 of file util.c.

◆ ap_ind()

int ap_ind ( const char str,
char  c 
)

Search a string from left to right for the first occurrence of a specific character

Parameters
strThe string to search
cThe character to search for
Returns
The index of the first occurrence of c in str

Definition at line 2392 of file util.c.

◆ ap_is_chunked()

const char const char int ap_is_chunked ( apr_pool_t p,
const char line 
)

Determine if the final Transfer-Encoding is "chunked".

Parameters
pThe pool to allocate from
linethe header field-value to scan
Returns
1 if the last Transfer-Encoding is "chunked", else 0

Definition at line 1786 of file util.c.

◆ ap_is_directory()

int ap_is_directory ( apr_pool_t p,
const char name 
)

Given the name of an object in the file system determine if it is a directory - this version is symlink aware

Parameters
pThe pool to allocate from
nameThe name of the object to check
Returns
1 if it is a directory, 0 otherwise

< Type

Definition at line 2326 of file util.c.

◆ ap_is_matchexp()

int ap_is_matchexp ( const char str)

Does the provided string contain wildcard characters? This is useful for determining if the string should be passed to strcmp_match or to strcmp. The only wildcard characters recognized are '?' and '*'

Parameters
strThe string to check
Returns
1 if the string has wildcards, 0 otherwise

Definition at line 240 of file util.c.

◆ ap_is_rdirectory()

int ap_is_rdirectory ( apr_pool_t p,
const char name 
)

Given the name of an object in the file system determine if it is a directory

Parameters
pThe pool to allocate from
nameThe name of the object to check
Returns
1 if it is a directory, 0 otherwise

< Stat the link not the file itself if it is a link

< Type

Definition at line 2336 of file util.c.

◆ ap_is_url()

int ap_is_url ( const char u)

Check for an Absolute URI syntax

Parameters
uThe string to check
Returns
1 if URI, 0 otherwise

Definition at line 2377 of file util.c.

◆ ap_log_assert()

void ap_log_assert ( const char szExp,
const char szFile,
int  nLine 
)

Log an assertion to the error log

Parameters
szExpThe assertion that failed
szFileThe file the assertion is in
nLineThe line the assertion is defined on

Definition at line 1743 of file log.c.

◆ ap_make_dirstr_parent()

char * ap_make_dirstr_parent ( apr_pool_t p,
const char s 
)

Return the parent directory name (including trailing /) of the file s

Parameters
pThe pool to allocate from
sThe file to get the parent of
Returns
A copy of the file's parent directory

Definition at line 692 of file util.c.

◆ ap_make_dirstr_prefix()

char * ap_make_dirstr_prefix ( char d,
const char s,
int  n 
)

Copy at most n leading directories of s into d. d should be at least as large as s plus 1 extra byte

Parameters
dThe location to copy to
sThe location to copy from
nThe number of directories to copy
Returns
value is the ever useful pointer to the trailing "\0" of d
Note
on platforms with drive letters, n = 0 returns the "/" root, whereas n = 1 returns the "d:/" root. On all other platforms, n = 0 returns the empty string.

Definition at line 669 of file util.c.

◆ ap_make_full_path()

char * ap_make_full_path ( apr_pool_t a,
const char dir,
const char f 
)

Given a directory and filename, create a single path from them. This function is smart enough to ensure that there is a single '/' between the directory and file names

Parameters
aThe pool to allocate from
dirThe directory name
fThe filename
Returns
A copy of the full path
Note
Never consider using this function if you are dealing with filesystem names that need to remain canonical, unless you are merging an apr_dir_read path and returned filename. Otherwise, the result is not canonical.

Definition at line 2346 of file util.c.

◆ ap_malloc()

void * ap_malloc ( size_t  size)

Wrapper for malloc() that calls ap_abort_on_oom() if out of memory

Parameters
sizesize of the memory block
Returns
pointer to the allocated memory
Note
ap_malloc may be implemented as a macro

Definition at line 3152 of file util.c.

◆ ap_no2slash()

void ap_no2slash ( char name)

Convert all double slashes to single slashes, except where significant to the filesystem on the current platform.

Parameters
nameThe string to convert, assumed to be a filesystem path

Definition at line 640 of file util.c.

◆ ap_no2slash_ex()

void ap_no2slash_ex ( char name,
int  is_fs_path 
)

Convert all double slashes to single slashes, except where significant to the filesystem on the current platform.

Parameters
nameThe string to convert
is_fs_pathif set to 0, the significance of any double-slashes is ignored.

Definition at line 610 of file util.c.

◆ ap_normalize_path()

int ap_normalize_path ( char path,
unsigned int  flags 
)

Remove all ////, /./ and /xx/../ substrings from a path, and more depending on passed in flags.

Parameters
pathThe path to normalize
flagsbitmask of AP_NORMALIZE_* flags
Returns
non-zero on success

Definition at line 489 of file util.c.

◆ ap_os_escape_path()

char * ap_os_escape_path ( apr_pool_t p,
const char path,
int  partial 
)

convert an OS path to a URL in an OS dependent way.

Parameters
pThe pool to allocate from
pathThe path to convert
partialif set, assume that the path will be appended to something with a '/' in it (and thus does not prefix "./")
Returns
The converted URL

Definition at line 2073 of file util.c.

◆ ap_os_is_path_absolute()

int ap_os_is_path_absolute ( apr_pool_t p,
const char dir 
)

Test if the given path has an absolute path.

Parameters
pThe pool to allocate from
dirThe directory name
Note
The converse is not necessarily true, some OS's (Win32/OS2/Netware) have multiple forms of absolute paths. This only reports if the path is absolute in a canonical sense.

Definition at line 229 of file util.c.

◆ ap_parse_form_data()

int ap_parse_form_data ( request_rec r,
struct ap_filter_t f,
apr_array_header_t **  ptr,
apr_size_t  num,
apr_size_t  size 
)

Read the body and parse any form found, which must be of the type application/x-www-form-urlencoded.

Parameters
rrequest containing POSTed form data
ffilter
ptrreturned array of ap_form_pair_t
nummax num of params or -1 for unlimited
sizemax size allowed for parsed data
Returns
OK or HTTP error

< Module has handled this stage.

Definition at line 2787 of file util.c.

◆ ap_parse_strict_length()

int ap_parse_strict_length ( apr_off_t len,
const char str 
)

Parse a length string with decimal characters only, no leading sign nor trailing character, like Content-Length or (Content-)Range headers.

Parameters
lenThe parsed length (apr_off_t)
strThe string to parse
Returns
1 (success), 0 (failure)

Definition at line 2683 of file util.c.

◆ ap_parse_token_list_strict()

const char * ap_parse_token_list_strict ( apr_pool_t p,
const char tok,
apr_array_header_t **  tokens,
int  skip_invalid 
)

Retrieve an array of tokens in the format "1#token" defined in RFC2616. Only accepts ',' as a delimiter, does not accept quoted strings, and errors on any separator.

Parameters
pThe pool to allocate from
tokThe line to read tokens from
tokensPointer to an array of tokens. If not NULL, must be an array of char*, otherwise it will be allocated on p when a token is found
skip_invalidIf true, when an invalid separator is encountered, it will be ignored.
Returns
NULL on success, an error string otherwise.
Remarks
*tokens may be NULL on output if NULL in input and no token is found

Definition at line 1562 of file util.c.

◆ ap_pbase64decode()

char * ap_pbase64decode ( apr_pool_t p,
const char bufcoded 
)

Decode a base64 encoded string into memory allocated from a pool

Parameters
pThe pool to allocate from
bufcodedThe encoded string
Returns
The decoded string

Definition at line 2477 of file util.c.

◆ ap_pbase64encode()

char * ap_pbase64encode ( apr_pool_t p,
char string 
)

Encode a string into memory allocated from a pool in base 64 format

Parameters
pThe pool to allocate from
stringThe plaintext string
Returns
The encoded string

Definition at line 2487 of file util.c.

◆ ap_pregcomp()

ap_regex_t * ap_pregcomp ( apr_pool_t p,
const char pattern,
int  cflags 
)

Compile a regular expression to be used later. The regex is freed when the pool is destroyed.

Parameters
pThe pool to allocate from
patternthe regular expression to compile
cflagsThe bitwise or of one or more of the following:
  • REG_EXTENDED - Use POSIX extended Regular Expressions
  • REG_ICASE - Ignore case
  • REG_NOSUB - Support for substring addressing of matches not required
  • REG_NEWLINE - Match-any-character operators don't match new-line
Returns
The compiled regular expression

Definition at line 262 of file util.c.

◆ ap_pregfree()

void ap_pregfree ( apr_pool_t p,
ap_regex_t reg 
)

Free the memory associated with a compiled regular expression

Parameters
pThe pool the regex was allocated from
regThe regular expression to free
Note
This function is only necessary if the regex should be cleaned up before the pool

Definition at line 279 of file util.c.

◆ ap_pregsub()

char * ap_pregsub ( apr_pool_t p,
const char input,
const char source,
apr_size_t  nmatch,
ap_regmatch_t  pmatch[] 
)

After performing a successful regex match, you may use this function to perform a series of string substitutions based on subexpressions that were matched during the call to ap_regexec. This function is limited to result strings of 64K. Consider using ap_pregsub_ex() instead.

Parameters
pThe pool to allocate from
inputAn arbitrary string containing $1 through $9. These are replaced with the corresponding matched sub-expressions
sourceThe string that was originally matched to the regex
nmatchthe nmatch returned from ap_pregex
pmatchthe pmatch array returned from ap_pregex
Returns
The substituted string, or NULL on error

Definition at line 457 of file util.c.

◆ ap_pregsub_ex()

apr_status_t ap_pregsub_ex ( apr_pool_t p,
char **  result,
const char input,
const char source,
apr_size_t  nmatch,
ap_regmatch_t  pmatch[],
apr_size_t  maxlen 
)

After performing a successful regex match, you may use this function to perform a series of string substitutions based on subexpressions that were matched during the call to ap_regexec

Parameters
pThe pool to allocate from
resultwhere to store the result, will be set to NULL on error
inputAn arbitrary string containing $1 through $9. These are replaced with the corresponding matched sub-expressions
sourceThe string that was originally matched to the regex
nmatchthe nmatch returned from ap_pregex
pmatchthe pmatch array returned from ap_pregex
maxlenthe maximum string length to return, 0 for unlimited
Returns
APR_SUCCESS if successful, APR_ENOMEM or other error code otherwise.

Definition at line 469 of file util.c.

◆ ap_psignature()

const char * ap_psignature ( const char prefix,
request_rec r 
)

Get HTML describing the address and (optionally) admin of the server.

Parameters
prefixText which is prepended to the return value
rThe request_rec
Returns
HTML describing the server, allocated in r's pool.

Definition at line 3516 of file core.c.

◆ ap_pstr2_alnum()

apr_status_t ap_pstr2_alnum ( apr_pool_t p,
const char src,
const char **  dest 
)

Cleanup a string (mainly to be filesystem safe) We only allow '_' and alphanumeric chars. Non-printable map to 'x' and all others map to '_'

Parameters
ppool to use to allocate dest
srcstring to clean up
destcleaned up, allocated string
Returns
Status value indicating whether the cleaning was successful or not.

Definition at line 2733 of file util.c.

◆ ap_random_insecure_bytes()

void ap_random_insecure_bytes ( void *  buf,
apr_size_t  size 
)

Generate pseudo random bytes. This is a convenience interface to apr_random. It is cheaper but less secure than apr_generate_random_bytes().

Parameters
bufwhere to store the bytes
sizenumber of bytes to generate
Note
ap_random_insecure_bytes() is thread-safe, it uses a mutex on threaded MPMs.

Definition at line 5455 of file core.c.

◆ ap_random_pick()

apr_uint32_t ap_random_pick ( apr_uint32_t  min,
apr_uint32_t  max 
)

Get a pseudo random number in a range.

Parameters
minlow end of range
maxhigh end of range
Returns
a number in the range

Definition at line 5485 of file core.c.

◆ ap_realloc()

void * ap_realloc ( void *  ptr,
size_t  size 
)

Wrapper for realloc() that calls ap_abort_on_oom() if out of memory

Parameters
ptrpointer to the old memory block (or NULL)
sizenew size of the memory block
Returns
pointer to the reallocated memory
Note
ap_realloc may be implemented as a macro

Definition at line 3168 of file util.c.

◆ ap_request_has_body()

int ap_request_has_body ( request_rec r)

Determine if a request has a request body or not.

Parameters
rthe request_rec of the request
Returns
truth value

Definition at line 2698 of file util.c.

◆ ap_resolve_env()

const char * ap_resolve_env ( apr_pool_t p,
const char word 
)

Check a string for any config define or environment variable construct and replace each of them by the value of that variable, if it exists. The default syntax of the constructs is ${ENV} but can be changed by setting the define::* config defines. If the variable does not exist, leave the ${ENV} construct alone but print a warning.

Parameters
pThe pool to allocate from
wordThe string to check
Returns
The string with the replaced environment variables

Definition at line 1376 of file core.c.

◆ ap_rind()

int ap_rind ( const char str,
char  c 
)

Search a string from right to left for the first occurrence of a specific character

Parameters
strThe string to search
cThe character to search for
Returns
The index of the first occurrence of c in str

Definition at line 2401 of file util.c.

◆ ap_scan_http_field_content()

const char * ap_scan_http_field_content ( const char ptr)

Definition at line 1654 of file util.c.

◆ ap_scan_http_token()

const char * ap_scan_http_token ( const char ptr)

Definition at line 1664 of file util.c.

◆ ap_scan_vchar_obstext()

const char * ap_scan_vchar_obstext ( const char ptr)

Definition at line 1674 of file util.c.

◆ ap_set_context_info()

void ap_set_context_info ( request_rec r,
const char prefix,
const char document_root 
)

Set context_prefix and context_document_root for a request.

Parameters
rThe request
prefixthe URI prefix, without trailing slash
document_rootthe corresponding directory on disk, without trailing slash
Note
If one of prefix of document_root is NULL, the corrsponding property will not be changed.

Definition at line 863 of file core.c.

◆ ap_set_document_root()

void ap_set_document_root ( request_rec r,
const char document_root 
)

Set per-request document root. This is for mass virtual hosting modules that want to provide the correct DOCUMENT_ROOT value to scripts.

Parameters
rThe request
document_rootthe document root for the request.

Definition at line 857 of file core.c.

◆ ap_size_list_item()

const char * ap_size_list_item ( const char **  field,
int len 
)

Size an HTTP header field list item, as separated by a comma.

Parameters
fieldThe field to size
lenThe length of the field
Returns
The return value is a pointer to the beginning of the non-empty list item within the original string (or NULL if there is none) and the address of field is shifted to the next non-comma, non-whitespace character. len is the length of the item excluding any beginning whitespace.

Definition at line 1254 of file util.c.

◆ ap_str2_alnum()

apr_status_t ap_str2_alnum ( const char src,
char dest 
)

Cleanup a string (mainly to be filesystem safe) We only allow '_' and alphanumeric chars. Non-printable map to 'x' and all others map to '_'

Parameters
srcstring to clean up
destcleaned up, pre-allocated string
Returns
Status value indicating whether the cleaning was successful or not.

Definition at line 2717 of file util.c.

◆ ap_str_tolower()

void ap_str_tolower ( char s)

convert a string to all lowercase

Parameters
sThe string to convert to lowercase

Definition at line 2410 of file util.c.

◆ ap_str_toupper()

void ap_str_toupper ( char s)

convert a string to all uppercase

Parameters
sThe string to convert to uppercase

Definition at line 2418 of file util.c.

◆ ap_strcasecmp_match()

int ap_strcasecmp_match ( const char str,
const char expected 
)

Determine if a string matches a pattern containing the wildcards '?' or '*', ignoring case

Parameters
strThe string to check
expectedThe pattern to match against
Returns
0 if the two strings match, 1 otherwise

Definition at line 199 of file util.c.

◆ ap_strcasestr()

char * ap_strcasestr ( const char s1,
const char s2 
)

Find the first occurrence of the substring s2 in s1, regardless of case

Parameters
s1The string to search
s2The substring to search for
Returns
A pointer to the beginning of the substring
Remarks
See apr_strmatch() for a faster alternative

Definition at line 289 of file util.c.

◆ ap_strchr()

char * ap_strchr ( char s,
int  c 
)

Definition at line 43 of file util_debug.c.

◆ ap_strchr_c()

const char * ap_strchr_c ( const char s,
int  c 
)

Definition at line 53 of file util_debug.c.

◆ ap_strcmp_match()

int ap_strcmp_match ( const char str,
const char expected 
)

Determine if a string matches a pattern containing the wildcards '?' or '*'

Parameters
strThe string to check
expectedThe pattern to match against
Returns
0 if the two strings match, 1 otherwise

Definition at line 175 of file util.c.

◆ ap_stripprefix()

const char * ap_stripprefix ( const char bigstring,
const char prefix 
)

Return a pointer to the location inside of bigstring immediately after prefix

Parameters
bigstringThe input string
prefixThe prefix to strip away
Returns
A pointer relative to bigstring after prefix

Definition at line 328 of file util.c.

◆ ap_strrchr()

char * ap_strrchr ( char s,
int  c 
)

Definition at line 63 of file util_debug.c.

◆ ap_strrchr_c()

const char * ap_strrchr_c ( const char s,
int  c 
)

Definition at line 73 of file util_debug.c.

◆ ap_strstr()

char * ap_strstr ( char s,
const char c 
)

Definition at line 83 of file util_debug.c.

◆ ap_strstr_c()

const char * ap_strstr_c ( const char s,
const char c 
)

Definition at line 93 of file util_debug.c.

◆ ap_timeout_parameter_parse()

apr_status_t ap_timeout_parameter_parse ( const char timeout_parameter,
apr_interval_time_t timeout,
const char default_time_unit 
)

Parse a given timeout parameter string into an apr_interval_time_t value. The unit of the time interval is given as postfix string to the numeric string. Currently the following units are understood:

ms : milliseconds s : seconds mi[n] : minutes h : hours

If no unit is contained in the given timeout parameter the default_time_unit will be used instead.

Parameters
timeout_parameterThe string containing the timeout parameter.
timeoutThe timeout value to be returned.
default_time_unitThe default time unit to use if none is specified in timeout_parameter.
Returns
Status value indicating whether the parsing was successful or not.

Definition at line 2622 of file util.c.

◆ ap_unescape_all()

int ap_unescape_all ( char url)

Unescape a string

Parameters
urlThe string to unescape
Returns
0 on success, non-zero otherwise

Definition at line 2005 of file util.c.

◆ ap_unescape_url()

int ap_unescape_url ( char url)

Unescape a URL

Parameters
urlThe url to unescape
Returns
0 on success, non-zero otherwise

Definition at line 1939 of file util.c.

◆ ap_unescape_url_ex()

int ap_unescape_url_ex ( char url,
unsigned int  flags 
)

Unescape a URL, with options

Parameters
urlThe url to unescape
flagsBitmask of AP_UNESCAPE_URL_* flags
Returns
0 on success, non-zero otherwise

Definition at line 1955 of file util.c.

◆ ap_unescape_url_keep2f()

int ap_unescape_url_keep2f ( char url,
int  decode_slashes 
)

Unescape a URL, but leaving %2f (slashes) escaped

Parameters
urlThe url to unescape
decode_slashesWhether or not slashes should be decoded
Returns
0 on success, non-zero otherwise

Definition at line 1944 of file util.c.

◆ ap_unescape_urlencoded()

int ap_unescape_urlencoded ( char query)

Unescape an application/x-www-form-urlencoded string

Parameters
queryThe query to unescape
Returns
0 on success, non-zero otherwise

Definition at line 1977 of file util.c.