config.c revision 03aa31ad82759363ba1a55589e517b16308ef635
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak/* Licensed to the Apache Software Foundation (ASF) under one or more
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * contributor license agreements. See the NOTICE file distributed with
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * this work for additional information regarding copyright ownership.
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * The ASF licenses this file to You under the Apache License, Version 2.0
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * (the "License"); you may not use this file except in compliance with
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * the License. You may obtain a copy of the License at
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * Unless required by applicable law or agreed to in writing, software
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * distributed under the License is distributed on an "AS IS" BASIS,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * See the License for the specific language governing permissions and
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * limitations under the License.
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * http_config.c: once was auxillary functions for reading httpd's config
4b5981e276e93df97c34e4da05ca5cf8bbd937dand * file and converting filenames into a namespace
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * Rob McCool
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * Wall-to-wall rewrite for Apache... commands which are part of the
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * server core can now be found next door in "http_core.c". Now contains
b03f9485e6dfcf9326e6122f91eaa1ced8939818jim * general command loop, and functions which do bookkeeping for the new
b03f9485e6dfcf9326e6122f91eaa1ced8939818jim * Apache config stuff (modules and configuration vectors).
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak#include "http_log.h" /* for errors in parse_htaccess */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak#include "http_request.h" /* for default_handler (see invoke_handler) */
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakAP_DECLARE_DATA apr_array_header_t *ap_server_pre_read_config = NULL;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakAP_DECLARE_DATA apr_array_header_t *ap_server_post_read_config = NULL;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakAP_DECLARE_DATA apr_array_header_t *ap_server_config_defines = NULL;
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak/* During the course of debugging I expanded this macro out, so
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * rather than remove all the useful information there is in the
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * following lines, I'm going to leave it here in case anyone
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * else finds it useful.
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak * Ben has looked at it and thinks it correct :)
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniakAP_DECLARE(int) ap_hook_post_config(ap_HOOK_post_config_t *pf,
9c1260efa52c82c2a58e5b5f20cd6902563d95f5rbowen const char * const *aszPre,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak const char * const *aszSucc,
5652dbe450e4fcfdf36d4cfb42d7f2345ded29a4maczniak int nOrder)
(pchild, s))
(r), DECLINED)
static int total_modules = 0;
static int dynamic_modules = 0;
#ifndef AP_MAX_INCLUDE_DIR_DEPTH
return conf_vector;
if (df)
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;
return APR_SUCCESS;
module **m;
if (add_prelinked) {
ap_add_module_commands(*m, p);
char *dir;
rebuild_conf_hash(p, 0);
mln->m = m;
++cmd;
/* This could be called from a LoadModule httpd.conf command,
ap_top_module = m;
* 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);
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;
*m2++ = *m++;
if (error) {
return error;
return NULL;
return m->name;
return modp;
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;
return retval;
return NULL;
NULL);
ml->m,
const char *retval;
return retval;
return NULL;
const char *errmsg;
return errmsg;
return NULL;
const char *errmsg;
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;
const char *arg)
const char *path;
if (!path) {
return NULL;
void *struct_ptr,
const char *arg)
return newpath;
return NULL;
char l[MAX_STRING_LEN];
const char *args;
char *cmd_name;
args = l;
const char *msg;
return msg;
NULL);
NULL);
const char *retval;
return retval;
return NULL;
int curr_idx;
return NULL;
bufsiz);
return buf;
apr_pool_t *p,
const char *errmsg;
if (errmsg) {
NULL);
return NULL;
const char *fname;
} fnames;
const char *fname,
apr_pool_t *p,
unsigned depth,
int strict)
const char *error;
int current;
if (error) {
return error;
return NULL;
if (error) {
return NULL;
const char *path,
const char *fname,
apr_pool_t *p,
unsigned depth,
int strict)
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;
else if (strict) {
return NULL;
const char *fname,
apr_pool_t *p,
int strict)
/* don't require conf/httpd.conf if we have a -C or -c switch */
return NULL;
0, strict);
0, strict);
return NULL;
const char *fname,
apr_pool_t *p,
apr_pool_t *p,
const char *errmsg;
if (errmsg) {
return HTTP_INTERNAL_SERVER_ERROR;
return OK;
int override_opts,
const char *d, const char *access_name)
return OK;
while (access_name[0]) {
const char *errmsg;
ap_cfg_closefile(f);
if (errmsg) {
return HTTP_INTERNAL_SERVER_ERROR;
filename);
return HTTP_FORBIDDEN;
return OK;
const char *hostname,
s->timeout = 0;
s->keep_alive_timeout = 0;
*ps = s;
s->port = 0;
const char *filename,
p, ptemp);
if (error) {
return NULL;
if (!confname) {
filename);
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;