http_config.h revision 0e6e93183d91142d7cf9ffbf502114ff77bd9e19
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* ====================================================================
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * The Apache Software License, Version 1.1
4a56677aad9b66a36f3dc9fddbca8dc1230ad471rbowen * Copyright (c) 2000 The Apache Software Foundation. All rights
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * reserved.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * Redistribution and use in source and binary forms, with or without
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * modification, are permitted provided that the following conditions
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * 1. Redistributions of source code must retain the above copyright
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * notice, this list of conditions and the following disclaimer.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * 2. Redistributions in binary form must reproduce the above copyright
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * notice, this list of conditions and the following disclaimer in
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * the documentation and/or other materials provided with the
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * distribution.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * 3. The end-user documentation included with the redistribution,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * if any, must include the following acknowledgment:
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * "This product includes software developed by the
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * Apache Software Foundation (http://www.apache.org/)."
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * Alternately, this acknowledgment may appear in the software itself,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * if and wherever such third-party acknowledgments normally appear.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * 4. The names "Apache" and "Apache Software Foundation" must
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * not be used to endorse or promote products derived from this
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * software without prior written permission. For written
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * permission, please contact apache@apache.org.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * 5. Products derived from this software may not be called "Apache",
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * nor may "Apache" appear in their name, without prior written
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * permission of the Apache Software Foundation.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * SUCH DAMAGE.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * ====================================================================
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * This software consists of voluntary contributions made by many
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * individuals on behalf of the Apache Software Foundation. For more
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * information on the Apache Software Foundation, please see
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * Portions of this software are based upon public domain software
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * originally written at the National Center for Supercomputing Applications,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * University of Illinois, Urbana-Champaign.
456de5f26ad346749963525a4f91883e6a51c5f3gryzorextern "C" {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * The central data structures around here...
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* Command dispatch structures... */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* Note that for all of these except RAW_ARGS, the config routine is
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * passed a freshly allocated string which can be modified or stored
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * or whatever... it's only necessary to do pstrdup() stuff with
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * RAW_ARGS.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (e.g., IndexIgnore)
456de5f26ad346749963525a4f91883e6a51c5f3gryzor ITERATE2, /* two arguments, 2nd occurs multiple times
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (e.g., AddIcon)
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef union {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*no_args) (cmd_parms *parms, void *mconfig);
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*raw_args) (cmd_parms *parms, void *mconfig,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *args);
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *w2);
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .take1=func }, mconfig, where, TAKE1, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .take1=func }, mconfig, where, ITERATE, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .take2=func }, mconfig, where, TAKE2, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .take2=func }, mconfig, where, TAKE12, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzor# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
456de5f26ad346749963525a4f91883e6a51c5f3gryzor { directive, { .flag=func }, mconfig, where, FLAG, help }
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef const char *(*cmd_func) ();
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef struct command_struct {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * implement multiple commands...
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int req_override; /* What overrides need to be allowed to
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * enable this command.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor enum cmd_how args_how; /* What the command expects as arguments */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *errmsg; /* 'usage' message, in case of syntax errors */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* The allowed locations for a configuration directive are the union of
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * those indicated by each set bit in the req_override mask.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & RSRC_CONF) => *.conf outside <Directory> or <Location>
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & OR_AUTHCFG) => *.conf inside <Directory> or <Location>
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * and .htaccess when AllowOverride AuthConfig
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & OR_LIMIT) => *.conf inside <Directory> or <Location>
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * and .htaccess when AllowOverride Limit
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & OR_OPTIONS) => *.conf anywhere
be988ce6ee818c37b7019b278957ef5382dbd312lgentis * and .htaccess when AllowOverride Options
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & OR_FILEINFO) => *.conf anywhere
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * and .htaccess when AllowOverride FileInfo
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * (req_override & OR_INDEXES) => *.conf anywhere
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * and .htaccess when AllowOverride Indexes
456de5f26ad346749963525a4f91883e6a51c5f3gryzor#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* This can be returned by a function if they don't wish to handle
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * a command. Make it something not likely someone will actually use
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * as an error code.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* Common structure for reading of config files / passwd files etc. */
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef struct {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int (*getch) (void *param); /* a getc()-like function */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int (*close) (void *param); /* a close hander function */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor void *param; /* the argument passed to getch/getstr/close */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor unsigned line_number; /* current line number, starting at 1 */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * This structure is passed to a command which is being invoked,
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * to carry a large variety of miscellaneous data which is all of
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * use to *somebody*...
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int override; /* Which allow-override bits are set */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor configfile_t *config_file; /* Config file structure. */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor ap_directive_t *directive; /* the directive specifying this command */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor ap_pool_t *pool; /* Pool to allocate new storage in */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor ap_pool_t *temp_pool; /* Pool for scratch memory; persists during
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * configuration, but wiped before the first
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * request is served...
456de5f26ad346749963525a4f91883e6a51c5f3gryzor server_rec *server; /* Server_rec being configured for */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * pathname of that directory.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * NOPE! That's what it meant previous to the
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * existance of <Files>, <Location> and regex
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * matching. Now the only usefulness that can
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * be derived from this field is whether a command
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * is being called in a server context (path == NULL)
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * or being called in a dir context (path != NULL).
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * to handle_command */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const ap_directive_t *err_directive; /* directive with syntax error */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor/* This structure records the existence of handlers in a module... */
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef struct {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *content_type; /* MUST be all lower case */
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * Module structures. Just about everything is dispatched through
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * these, directly or indirectly (through the command and handler
456de5f26ad346749963525a4f91883e6a51c5f3gryzortypedef struct module_struct {
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * check that module is compatible with this
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * version of the server.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int minor_version; /* API minor version. Provides API feature
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * milestones. Not checked during module init
456de5f26ad346749963525a4f91883e6a51c5f3gryzor int module_index; /* Index to this modules structures in
456de5f26ad346749963525a4f91883e6a51c5f3gryzor * config vectors.
456de5f26ad346749963525a4f91883e6a51c5f3gryzor const char *name;
void (*register_hooks) (void);
} module;
__FILE__, \
NULL, \
NULL, \
__FILE__, \
NULL, \
NULL, \
#define ap_get_module_config(v,m) \
(((void **)(v))[(m)->module_index])
void *param,
int(*getc_func)(void*),
char *orig_directive);
#define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
#ifdef CORE_PRIVATE
/* For mod_so.c... */
/* For http_main.c... */
API_EXPORT(server_rec*) ap_read_config(process_rec *process, ap_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree);
API_EXPORT(void) ap_pre_config_hook(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s);
API_EXPORT(void) ap_post_config_hook(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s);
/* For http_request.c... */
/* For http_connection.c... */
/* For http_core.c... (<Directory> command and virtual hosts) */
/* Module-method dispatchers, also for http_request.c */
#ifdef __cplusplus