config.c revision 9c3b514ddfd39586266275b2b532dc2167e05cd2
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive/* Licensed to the Apache Software Foundation (ASF) under one or more
d24d4c5159bcb11c25bb294926cfe7105c789ea9slive * contributor license agreements. See the NOTICE file distributed with
e942c741056732f50da2074b36fe59805d370650slive * this work for additional information regarding copyright ownership.
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd * The ASF licenses this file to You under the Apache License, Version 2.0
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * (the "License"); you may not use this file except in compliance with
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * the License. You may obtain a copy of the License at
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding * Unless required by applicable law or agreed to in writing, software
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding * distributed under the License is distributed on an "AS IS" BASIS,
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * See the License for the specific language governing permissions and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * limitations under the License.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * http_config.c: once was auxillary functions for reading httpd's config
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * file and converting filenames into a namespace
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd * Rob McCool
7db9f691a00ead175b03335457ca296a33ddf31bnd * Wall-to-wall rewrite for Apache... commands which are part of the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * server core can now be found next door in "http_core.c". Now contains
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * general command loop, and functions which do bookkeeping for the new
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * Apache config stuff (modules and configuration vectors).
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive#include "http_log.h" /* for errors in parse_htaccess */
67a715b4352c3e25bff32fccad48350180393f5end#include "http_request.h" /* for default_handler (see invoke_handler) */
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive/* we know core's module_index is 0 */
4a70643d125a450bb3f611c1265e44607b140040gregamesAP_DECLARE_DATA apr_array_header_t *ap_server_pre_read_config = NULL;
217246fb83555fa4dfc1d791758a93ec4230f5bfsliveAP_DECLARE_DATA apr_array_header_t *ap_server_post_read_config = NULL;
67a715b4352c3e25bff32fccad48350180393f5endAP_DECLARE_DATA apr_array_header_t *ap_server_config_defines = NULL;
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive/* During the course of debugging I expanded this macro out, so
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * rather than remove all the useful information there is in the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * following lines, I'm going to leave it here in case anyone
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * else finds it useful.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive * Ben has looked at it and thinks it correct :)
f80e267f416eda70d74550e77b11bdc42ecd104dndAP_DECLARE(int) ap_hook_post_config(ap_HOOK_post_config_t *pf,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive const char * const *aszPre,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive const char * const *aszSucc,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive int nOrder)
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive ap_LINK_post_config_t *pHook;
67a715b4352c3e25bff32fccad48350180393f5end if (!_hooks.link_post_config) {
217246fb83555fa4dfc1d791758a93ec4230f5bfslive _hooks.link_post_config = apr_array_make(apr_hook_global_pool, 1,
529258d4aa14c83ac8ef5392731cb58ac0068495nd sizeof(ap_LINK_post_config_t));
217246fb83555fa4dfc1d791758a93ec4230f5bfslive apr_hook_sort_register("post_config", &_hooks.link_post_config);
725ecc2b5c7499ee392e85a151778718a8e33dcckess pHook = apr_array_push(_hooks.link_post_config);
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive pHook->pFunc = pf;
67a715b4352c3e25bff32fccad48350180393f5end pHook->aszPredecessors = aszPre;
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive pHook->aszSuccessors = aszSucc;
67a715b4352c3e25bff32fccad48350180393f5end pHook->nOrder = nOrder;
67a715b4352c3e25bff32fccad48350180393f5end pHook->szName = apr_hook_debug_current;
67a715b4352c3e25bff32fccad48350180393f5end if (apr_hook_debug_enabled)
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive apr_hook_debug_show("post_config", aszPre, aszSucc);
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveAP_DECLARE(apr_array_header_t *) ap_hook_get_post_config(void) {
725ecc2b5c7499ee392e85a151778718a8e33dcckess return _hooks.link_post_config;
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveAP_DECLARE(int) ap_run_post_config(apr_pool_t *pconf,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive apr_pool_t *plog,
67a715b4352c3e25bff32fccad48350180393f5end apr_pool_t *ptemp,
67a715b4352c3e25bff32fccad48350180393f5end server_rec *s)
67a715b4352c3e25bff32fccad48350180393f5end ap_LINK_post_config_t *pHook;
67a715b4352c3e25bff32fccad48350180393f5end if(!_hooks.link_post_config)
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive pHook = (ap_LINK_post_config_t *)_hooks.link_post_config->elts;
4a70643d125a450bb3f611c1265e44607b140040gregames for (n = 0; n < _hooks.link_post_config->nelts; ++n)
(pchild, s))
(r), DECLINED)
#if defined(APR_HOOK_PROBES_ENABLED)
#define APR_HOOK_INT_DCL_UD
static int total_modules = 0;
static int dynamic_modules = 0;
static int max_modules = 0;
static int conf_vector_length = 0;
static int reserved_module_slots = 0;
#ifndef AP_MAX_INCLUDE_DIR_DEPTH
return conf_vector;
if (df)
for (i = 0; i < total_modules; i++) {
if (!new_vector[i]) {
if (!virt_vector[i])
else if (df)
return create_empty_config(p);
return create_empty_config(p);
return create_empty_config(p);
while (filters) {
return result;
return OK;
const char *handler;
int result;
const char *ignore;
return result;
return result;
if (!r->handler) {
if (r->content_type) {
if (!ignore) {
int methnum;
if (m->register_hooks) {
m->register_hooks(p);
struct ap_mod_list_struct {
module *m;
module **m;
if (add_prelinked) {
ap_add_module_commands(*m, p);
char *dir;
rebuild_conf_hash(p, 0);
mln->m = m;
++cmd;
const char *sym_name)
/* This could be called from a LoadModule httpd.conf command,
else if (!sym_name) {
sym++;
ap_top_module = m;
if (sym_name) {
* only the filename (e.g. mod_includes.c). So check for path
#ifdef _OSD_POSIX
ap_add_module_commands(m, p);
ap_register_hooks(m, p);
return NULL;
if (modp == m) {
if (!modp) {
m->name);
const char *short_name)
module **m;
const char *error;
if (error) {
return error;
*m++ = mod;
*m = NULL;
return NULL;
module **m;
int done;
*m++ = *m2;
*m = NULL;
module **m;
const char *error;
total_modules = 0;
if (!ap_module_short_names)
if (!merger_func_cache)
*m2++ = *m++;
if (error) {
return error;
return NULL;
return m->name;
return NULL;
return modp;
return NULL;
int override_list_ok = 0;
return NULL;
case RAW_ARGS:
#ifdef RESOLVE_ENV_PER_TOKEN
case TAKE_ARGV:
int argc = 0;
argc++;
case NO_ARGS:
if (*args != 0)
NULL);
case TAKE1:
case TAKE2:
case TAKE12:
case TAKE3:
case TAKE23:
case TAKE123:
case TAKE13:
case ITERATE:
return errmsg;
return errmsg;
case ITERATE2:
return errmsg;
return errmsg;
case FLAG:
NULL);
NULL);
return cmds;
++cmds;
return NULL;
return cmdp;
return NULL;
const char *section,
return section_config;
const char *args;
char *cmd_name;
return NULL;
args = l;
return NULL;
if (*current) {
if (*curr_parent) {
if (*current) {
if (*current) {
if (!*conftree) {
return retval;
return retval;
char *orig_directive)
char *bracket;
const char *retval;
if (p == temp_pool)
== APR_SUCCESS) {
return retval;
return NULL;
return NULL;
NULL);
ml->m,
const char *retval;
return retval;
return NULL;
const char *errmsg;
return errmsg;
return NULL;
const char *errmsg;
if (p == temp_pool)
if(last_ptr) {
== APR_SUCCESS) {
return errmsg;
return errmsg;
return NULL;
void *struct_ptr,
const char *arg)
return NULL;
void *struct_ptr,
const char *arg)
char *endptr;
return error_str;
void *struct_ptr,
const char *arg_)
return NULL;
return NULL;
return NULL;
const char *arg)
const char *path;
if (!path) {
return NULL;
void *struct_ptr,
const char *arg)
if (l->module_levels)
if (!l->module_levels) {
return newpath;
return NULL;
const char *runtime_dir = ap_runtime_dir ? ap_runtime_dir : ap_server_root_relative(p, DEFAULT_REL_RUNTIMEDIR);
return newpath;
return NULL;
const char *args;
char *cmd_name;
== APR_SUCCESS) {
const char *msg;
return msg;
NULL);
NULL);
const char *retval;
return retval;
return NULL;
int curr_idx;
char *elt;
return APR_EOF;
return APR_ENOSPC;
return APR_SUCCESS;
return APR_SUCCESS;
apr_pool_t *p,
const char *errmsg;
if (errmsg) {
NULL);
return NULL;
const char *fname;
} fnames;
const char *fname,
apr_pool_t *p,
const char *error;
if (error) {
return error;
return NULL;
const char *fname,
apr_pool_t *p,
unsigned depth,
int optional)
const char *error;
int current;
if (error) {
return error;
return NULL;
const char *path,
const char *fname,
apr_pool_t *p,
unsigned depth,
int optional)
const char *rest;
int current;
if (rest) {
rest++;
if (!rest) {
conftree, p,
conftree, p,
const char *error;
if (!rest) {
conftree, p,
conftree, p,
if (error) {
return error;
if (!optional) {
return NULL;
const char *fname,
apr_pool_t *p,
int optional)
/* don't require conf/httpd.conf if we have a -C or -c switch */
return NULL;
0, optional);
apr_pool_t *p,
const char *errmsg;
if (errmsg) {
return HTTP_INTERNAL_SERVER_ERROR;
return OK;
const char *d, const char *access_name)
int rc;
return OK;
while (access_name[0]) {
return rc;
const char *errmsg;
ap_cfg_closefile(f);
if (errmsg) {
return HTTP_INTERNAL_SERVER_ERROR;
filename, d);
return HTTP_FORBIDDEN;
return OK;
const char *hostname,
s->timeout = 0;
s->keep_alive_timeout = 0;
*ps = s;
if (old) {
l->module_levels =
for (i = 0; i < conf_vector_length; i++) {
s->port = 0;
return NULL;
return APR_SUCCESS;
return OK;
const char *filename,
if (s == NULL) {
p, ptemp);
if (error) {
return NULL;
if (!confname) {
filename);
return NULL;
if (error) {
return NULL;
if (error) {
return NULL;
p, ptemp);
if (error) {
return NULL;
module *m)
if (m->create_server_config)
(*m->create_server_config)(p, s));
if (m->create_dir_config)
module *m;
if (m->rewrite_args) {
for (n = 0; ap_loaded_modules[n]; ++n) {
for (n = 0; ap_loaded_modules[n]; ++n)
void *retained;
return retained;
void *retained;
return retained;
int count = 0;
count++;
return count;