http_core.h revision 01d315c948a50cb511dbaee108b9571ee9a4d287
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl/* Licensed to the Apache Software Foundation (ASF) under one or more
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * contributor license agreements. See the NOTICE file distributed with
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * this work for additional information regarding copyright ownership.
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * The ASF licenses this file to You under the Apache License, Version 2.0
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * (the "License"); you may not use this file except in compliance with
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * the License. You may obtain a copy of the License at
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl *
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * http://www.apache.org/licenses/LICENSE-2.0
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl *
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * Unless required by applicable law or agreed to in writing, software
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * distributed under the License is distributed on an "AS IS" BASIS,
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * See the License for the specific language governing permissions and
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * limitations under the License.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @file http_core.h
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @brief CORE HTTP Daemon
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco *
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @ingroup APACHE_CORE
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @{
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#ifndef APACHE_HTTP_CORE_H
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define APACHE_HTTP_CORE_H
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#include "apr.h"
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#include "apr_hash.h"
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#include "apr_optional.h"
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#include "util_filter.h"
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#include "ap_expr.h"
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#include "http_config.h"
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riesco#if APR_HAVE_STRUCT_RLIMIT
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#include <sys/time.h>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#include <sys/resource.h>
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#endif
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#ifdef __cplusplus
223be434693e8c97e2522ac19155a284b3536035Adrián Riescoextern "C" {
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#endif
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco/* ****************************************************************
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * The most basic server code is encapsulated in a single module
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * known as the core, which is just *barely* functional enough to
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * serve documents, though not terribly well.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Largely for NCSA back-compatibility reasons, the core needs to
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco * make pieces of its config structures available to other modules.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * The accessors are declared here, along with the interpretation
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * of one of them (allow_options).
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
6e121321775373fe11161d23c541437456df19b4Adrián Riesco * @brief File/Directory Accessor directives
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @{
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/** No directives */
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define OPT_NONE 0
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** Indexes directive */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_INDEXES 1
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** SSI is enabled without exec= permission */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_INCLUDES 2
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** FollowSymLinks directive */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_SYM_LINKS 4
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** ExecCGI directive */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_EXECCGI 8
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** directive unset */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_UNSET 16
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** SSI exec= permission is permitted, iff OPT_INCLUDES is also set */
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco#define OPT_INC_WITH_EXEC 32
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** SymLinksIfOwnerMatch directive */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_SYM_OWNER 64
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** MultiViews directive */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_MULTI 128
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** All directives */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_INC_WITH_EXEC|OPT_SYM_LINKS|OPT_EXECCGI)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** @} */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * @defgroup get_remote_host Remote Host Resolution
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @ingroup APACHE_CORE_HTTPD
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco * @{
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** REMOTE_HOST returns the hostname, or NULL if the hostname
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * lookup fails. It will force a DNS lookup according to the
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * HostnameLookups setting.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define REMOTE_HOST (0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** REMOTE_NAME returns the hostname, or the dotted quad if the
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * hostname lookup fails. It will force a DNS lookup according
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * to the HostnameLookups setting.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define REMOTE_NAME (1)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco/** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * never forced.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define REMOTE_NOLOOKUP (2)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * a double reverse lookup, regardless of the HostnameLookups
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * setting. The result is the (double reverse checked) hostname,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * or NULL if any of the lookups fail.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define REMOTE_DOUBLE_REV (3)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** @} // get_remote_host */
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** all of the requirements must be met */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define SATISFY_ALL 0
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** any of the requirements must be met */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define SATISFY_ANY 1
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/** There are no applicable satisfy lines */
6e121321775373fe11161d23c541437456df19b4Adrián Riesco#define SATISFY_NOSPEC 2
6e121321775373fe11161d23c541437456df19b4Adrián Riesco
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/** Make sure we don't write less than 8000 bytes at any one time.
6e121321775373fe11161d23c541437456df19b4Adrián Riesco */
6e121321775373fe11161d23c541437456df19b4Adrián Riesco#define AP_MIN_BYTES_TO_WRITE 8000
6e121321775373fe11161d23c541437456df19b4Adrián Riesco
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/** default maximum of internal redirects */
6e121321775373fe11161d23c541437456df19b4Adrián Riesco# define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10
6e121321775373fe11161d23c541437456df19b4Adrián Riesco
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/** default maximum subrequest nesting level */
6e121321775373fe11161d23c541437456df19b4Adrián Riesco# define AP_DEFAULT_MAX_SUBREQ_DEPTH 10
6e121321775373fe11161d23c541437456df19b4Adrián Riesco
6e121321775373fe11161d23c541437456df19b4Adrián Riesco/**
6e121321775373fe11161d23c541437456df19b4Adrián Riesco * Retrieve the value of Options for this request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param r The current request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @return the Options bitmask
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(int) ap_allow_options(request_rec *r);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Retrieve the value of the AllowOverride for this request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param r The current request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @return the overrides bitmask
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(int) ap_allow_overrides(request_rec *r);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco/**
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * Retrieve the document root for this server
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param r The current request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @warning Don't use this! If your request went through a Userdir, or
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * something like that, it'll screw you. But it's back-compatible...
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @return The document root
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián RiescoAP_DECLARE(const char *) ap_document_root(request_rec *r);
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Lookup the remote client's DNS name or IP address
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * @ingroup get_remote_host
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * @param conn The current connection
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param dir_config The directory config vector from the request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param type The type of lookup to perform. One of:
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * <pre>
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * REMOTE_HOST returns the hostname, or NULL if the hostname
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * lookup fails. It will force a DNS lookup according to the
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * HostnameLookups setting.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * REMOTE_NAME returns the hostname, or the dotted quad if the
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * hostname lookup fails. It will force a DNS lookup according
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * to the HostnameLookups setting.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * never forced.
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * a double reverse lookup, regardless of the HostnameLookups
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * setting. The result is the (double reverse checked)
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * hostname, or NULL if any of the lookups fail.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * </pre>
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * string is returned
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @return The remote hostname
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián RiescoAP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Retrieve the login name of the remote user. Undef if it could not be
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * determined
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * @param r The current request
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @return The user logged in to the client machine
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián RiescoAP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * and SERVER_NAME.
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/**
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * build a fully qualified URL from the uri and information in the request rec
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param p The pool to allocate the URL from
ab9c6be005cb2af851307b7968c2baa16a76d6b1Adrián Riesco * @param uri The path to the requested file
5eb747ed1f9cb3d902d4277badfc2a42f9f98b0cAdrián Riesco * @param r The current request
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * @return A fully qualified URL
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco */
223be434693e8c97e2522ac19155a284b3536035Adrián RiescoAP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
3f8cdebaede9921402318d525b57a9af8f9279d3Adrián Riesco/**
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * Get the current server name from the request
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * @param r The current request
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * @return the server name
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(const char *) ap_get_server_name(request_rec *r);
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco/**
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * Get the current server name from the request for the purposes
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * of using in a URL. If the server name is an IPv6 literal
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * address, it will be returned in URL format (e.g., "[fe80::1]").
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @param r The current request
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco * @return the server name
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián RiescoAP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r);
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco/**
0f593bb6e3f0bc82abf3d6d3c76ef222a43d0476Adrián Riesco * Get the current server port
0f593bb6e3f0bc82abf3d6d3c76ef222a43d0476Adrián Riesco * @param r The current request
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco * @return The server's port
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián RiescoAP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco/**
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco * Return the limit on bytes in request msg body
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco * @param r The current request
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @return the maximum number of bytes in the request msg body
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián RiescoAP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
8b389272b3312c6d3e3c0aee2e94bca6dbdade50Adrián Riesco
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco/**
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco * Return the limit on bytes in XML request msg body
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @param r The current request
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @return the maximum number of bytes in XML request msg body
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián RiescoAP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/**
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * Install a custom response handler for a given status
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @param r The current request
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @param status The status for which the custom response should be used
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @param string The custom response. This can be a static string, a file
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * or a URL
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián RiescoAP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/**
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * Check if the current request is beyond the configured max. number of redirects or subrequests
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @param r The current request
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @return true (is exceeded) or false
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián RiescoAP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/**
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * Check for a definition from the server command line
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @param name The define to check for
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @return 1 if defined, 0 otherwise
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián RiescoAP_DECLARE(int) ap_exists_config_define(const char *name);
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/* FIXME! See STATUS about how */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián RiescoAP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/* Authentication stuff. This is one of the places where compatibility
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * with the old config files *really* hurts; they don't discriminate at
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * all between different authentication schemes, meaning that we need
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * to maintain common state for all of them in the core, and make it
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * available to the other modules through interfaces.
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/** @see require_line */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riescotypedef struct require_line require_line;
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco/**
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco * @brief A structure to keep track of authorization requirements
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco*/
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riescostruct require_line {
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco /** Where the require line is in the config file. */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco apr_int64_t method_mask;
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco /** The complete string from the command line */
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco char *requirement;
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco};
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco/**
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * Return the type of authorization required for this request
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * @param r The current request
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * @return The authorization required
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián RiescoAP_DECLARE(const char *) ap_auth_type(request_rec *r);
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco/**
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * Return the current Authorization realm
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco * @param r The current request
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * @return The current authorization realm
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián RiescoAP_DECLARE(const char *) ap_auth_name(request_rec *r);
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco/**
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * How the requires lines must be met.
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * @param r The current request
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * @return How the requirements must be met. One of:
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * <pre>
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * SATISFY_ANY -- any of the requirements must be met.
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * SATISFY_ALL -- all of the requirements must be met.
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * SATISFY_NOSPEC -- There are no applicable satisfy lines
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * </pre>
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco */
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián RiescoAP_DECLARE(int) ap_satisfies(request_rec *r);
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riesco
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riesco/**
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * Core is also unlike other modules in being implemented in more than
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * one file... so, data structures are declared here, even though most of
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco * the code that cares really is in http_core.c. Also, another accessor.
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco */
0be63c5d4b5e66cc600a0003081ae2bf85be9615Adrián RiescoAP_DECLARE_DATA extern module core_module;
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco/**
0be63c5d4b5e66cc600a0003081ae2bf85be9615Adrián Riesco * @brief Per-request configuration
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco*/
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riescotypedef struct {
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco /** bucket brigade used by getline for look-ahead and
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco * ap_get_client_block for holding left-over request body */
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco struct apr_bucket_brigade *bb;
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco /** an array of per-request working data elements, accessed
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco * by ID using ap_get_request_note()
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco * (Use ap_register_request_note() during initialization
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco * to add elements)
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco */
fe5611d78ea0648e8719cb004a6a26e9a033429aAdrián Riesco void **notes;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco /** Custom response strings registered via ap_custom_response(),
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * or NULL; check per-dir config if nothing found here
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco */
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco char **response_code_strings; /* from ap_custom_response(), not from
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco * ErrorDocument
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco */
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riesco /** There is a script processor installed on the output filter chain,
b9840e4ee6fda6e42fa4ee9f337482ccc4839a39Adrián Riesco * so it needs the default_handler to deliver a (script) file into
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco * the chain so it can process it. Normally, default_handler only
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * serves files on a GET request (assuming the file is actual content),
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * since other methods are not content-retrieval. This flag overrides
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * that behavior, stating that the "content" is actually a script and
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * won't actually be delivered as the response for the non-GET method.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco int deliver_script;
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco /** Should addition of charset= be suppressed for this request?
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco int suppress_charset;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco} core_request_config;
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/* Standard entries that are guaranteed to be accessible via
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * ap_get_request_note() for each request (additional entries
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * can be added with ap_register_request_note())
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_NOTE_DIRECTORY_WALK 0
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_NOTE_LOCATION_WALK 1
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco#define AP_NOTE_FILE_WALK 2
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#define AP_NOTE_IF_WALK 3
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco#define AP_NUM_STD_NOTES 4
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco/**
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * Reserve an element in the core_request_config->notes array
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco * for some application-specific data
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * @return An integer key that can be passed to ap_get_request_note()
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * during request processing to access this element for the
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * current request.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián RiescoAP_DECLARE(apr_size_t) ap_register_request_note(void);
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/**
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * Retrieve a pointer to an element in the core_request_config->notes array
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * @param r The request
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco * @param note_num A key for the element: either a value obtained from
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * ap_register_request_note() or one of the predefined AP_NOTE_*
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * values.
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * @return NULL if the note_num is invalid, otherwise a pointer to the
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * requested note element.
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * @remark At the start of a request, each note element is NULL. The
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * handle provided by ap_get_request_note() is a pointer-to-pointer
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * so that the caller can point the element to some app-specific
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * data structure. The caller should guarantee that any such
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * structure will last as long as the request itself.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián RiescoAP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riescotypedef unsigned char allow_options_t;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riescotypedef unsigned char overrides_t;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/*
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * Bits of info that go into making an ETag for a file
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * document. Why a long? Because char historically
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * proved too short for Options, and int can be different
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * sizes on different platforms.
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riescotypedef unsigned long etag_components_t;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define ETAG_UNSET 0
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define ETAG_NONE (1 << 0)
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco#define ETAG_MTIME (1 << 1)
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define ETAG_INODE (1 << 2)
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define ETAG_SIZE (1 << 3)
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/**
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * @brief Server Signature Enumeration
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riescotypedef enum {
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco srv_sig_unset,
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco srv_sig_off,
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco srv_sig_on,
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco srv_sig_withmail
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco} server_signature_e;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/**
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * @brief Per-directory configuration
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riescotypedef struct {
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco char *d;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /** the number of slashes in d */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco unsigned d_components;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /** If (opts & OPT_UNSET) then no absolute assignment to options has
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * been made.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * invariant: (opts_add & opts_remove) == 0
7fc57d0f02d0fec1192376ccebe2be0224cb9a55Adrián Riesco * Which said another way means that the last relative (options + or -)
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * assignment made to each bit is recorded in exactly one of opts_add
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * or opts_remove.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco allow_options_t opts;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco allow_options_t opts_add;
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco allow_options_t opts_remove;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco overrides_t override;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco allow_options_t override_opts;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /* Custom response config. These can contain text or a URL to redirect to.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * if response_code_strings is NULL then there are none in the config,
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * This lets us do quick merges in merge_core_dir_configs().
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco char **response_code_strings; /* from ErrorDocument, not from
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco * ap_custom_response() */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /* Hostname resolution etc */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define HOSTNAME_LOOKUP_OFF 0
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define HOSTNAME_LOOKUP_ON 1
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define HOSTNAME_LOOKUP_DOUBLE 2
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define HOSTNAME_LOOKUP_UNSET 3
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco unsigned int hostname_lookups : 4;
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco unsigned int content_md5 : 2; /* calculate Content-MD5? */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_NAME_OFF (0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_NAME_ON (1)
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco#define USE_CANONICAL_NAME_DNS (2)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_NAME_UNSET (3)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned use_canonical_name : 2;
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco /* since is_fnmatch(conf->d) was being called so frequently in
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * directory_walk() and its relatives, this field was created and
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco * is set to the result of that call.
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco unsigned d_is_fnmatch : 1;
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco /* should we force a charset on any outgoing parameterless content-type?
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco * if so, which charset?
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco#define ADD_DEFAULT_CHARSET_OFF (0)
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco#define ADD_DEFAULT_CHARSET_ON (1)
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco#define ADD_DEFAULT_CHARSET_UNSET (2)
71410be62420b321abb02ef1ac2b7f2141b3bc7fAdrián Riesco unsigned add_default_charset : 2;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *add_default_charset_name;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* System Resource Control */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#ifdef RLIMIT_CPU
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco struct rlimit *limit_cpu;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco#endif
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct rlimit *limit_mem;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#endif
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#ifdef RLIMIT_NPROC
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco struct rlimit *limit_nproc;
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco#endif
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco apr_off_t limit_req_body; /* limit on bytes in request msg body */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco long limit_xml_body; /* limit on bytes in XML request msg body */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco /* logging options */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco server_signature_e server_signature;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* Access control */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *sec_file;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *sec_if;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_regex_t *r;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
6b2e3d60f2e2c230c9637bf0701d7024d289764dAdrián Riesco const char *mime_type; /* forced with ForceType */
172f4dfb4b858440fab545bac00d3ec4abd0cbe4Adrián Riesco const char *handler; /* forced with SetHandler */
172f4dfb4b858440fab545bac00d3ec4abd0cbe4Adrián Riesco const char *output_filters; /* forced with SetOutputFilters */
172f4dfb4b858440fab545bac00d3ec4abd0cbe4Adrián Riesco const char *input_filters; /* forced with SetInputFilters */
172f4dfb4b858440fab545bac00d3ec4abd0cbe4Adrián Riesco int accept_path_info; /* forced with AcceptPathInfo */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco /*
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * What attributes/data should be included in ETag generation?
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco etag_components_t etag_bits;
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco etag_components_t etag_add;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco etag_components_t etag_remove;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /*
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Run-time performance tuning
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define ENABLE_MMAP_OFF (0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define ENABLE_MMAP_ON (1)
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco#define ENABLE_MMAP_UNSET (2)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int enable_mmap : 2; /* whether files in this dir can be mmap'ed */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define ENABLE_SENDFILE_OFF (0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define ENABLE_SENDFILE_ON (1)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define ENABLE_SENDFILE_UNSET (2)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int enable_sendfile : 2; /* files in this dir can be sendfile'ed */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * pitched indiscriminately */
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_PHYS_PORT_OFF (0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_PHYS_PORT_ON (1)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define USE_CANONICAL_PHYS_PORT_UNSET (2)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned use_canonical_phys_port : 2;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_expr_info_t *condition; /* Conditionally merge <If> sections */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** per-dir log config */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco struct ap_logconf *log;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int decode_encoded_slashes : 1; /* whether to decode encoded slashes in URLs */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} core_dir_config;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* macro to implement off by default behaviour */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define AP_SENDFILE_ENABLED(x) \
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* Per-server core configuration */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescotypedef struct {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco char *gprof_dir;
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* Name translations --- we want the core to be able to do *something*
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * so it's at least a minimally functional web server on its own (and
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * can be tested that way). But let's keep it to the bare minimum:
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *ap_document_root;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* Access control */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco char *access_name;
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco apr_array_header_t *sec_dir;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *sec_url;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* recursion backstopper */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int redirect_limit; /* maximum number of internal redirects */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int subreq_limit; /* maximum nesting level of subrequests */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *protocol;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_table_t *accf_map;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* array of ap_errorlog_format_item for error log format string */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *error_log_format;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /*
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * two arrays of arrays of ap_errorlog_format_item for additional information
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * logged to the error log once per connection/request
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *error_log_conn;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco apr_array_header_t *error_log_req;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /* TRACE control */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define AP_TRACE_UNSET -1
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define AP_TRACE_DISABLE 0
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define AP_TRACE_ENABLE 1
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco#define AP_TRACE_EXTENDED 2
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int trace_enable;
6f6549c13f912de12345850e4eb248ec358c1b43Adrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} core_server_config;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* for AddOutputFiltersByType in core.c */
6f6549c13f912de12345850e4eb248ec358c1b43Adrián Riescovoid ap_add_output_filters_by_type(request_rec *r);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* for http_config.c */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescovoid ap_core_reorder_directories(apr_pool_t *, server_rec *);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
172f4dfb4b858440fab545bac00d3ec4abd0cbe4Adrián Riesco/* for mod_perl */
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián RiescoAP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_CORE_DECLARE(void) ap_add_file_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_CORE_DECLARE(void) ap_add_if_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* Core filters; not exported. */
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riescoint ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_input_mode_t mode, apr_read_type_e block,
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco apr_off_t readbytes);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescoapr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ----------------------------------------------------------------------
3b1e33dd8d2de8301d7a31860dd1819bd3752718Adrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Runtime status/management
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescotypedef enum {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_mgmt_type_string,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_mgmt_type_long,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_mgmt_type_hash
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} ap_mgmt_type_e;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescotypedef union {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *s_value;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco long i_value;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco apr_hash_t *h_value;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco} ap_mgmt_value;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riescotypedef struct {
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco const char *description;
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco const char *name;
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco ap_mgmt_type_e vtype;
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco ap_mgmt_value v;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} ap_mgmt_item_t;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* Handles for core filters */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riescoextern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riescoextern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riescoextern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riescoextern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco/**
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * This hook provdes a way for modules to provide metrics/statistics about
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * their operational status.
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco *
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * @param p A pool to use to create entries in the hash table
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * @param val The name of the parameter(s) that is wanted. This is
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * tree-structured would be in the form ('*' is all the tree,
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * 'module.*' all of the module , 'module.foo.*', or
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * 'module.foo.bar' )
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * @param ht The hash table to store the results. Keys are item names, and
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * the values point to ap_mgmt_item_t structures.
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * @ingroup hooks
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco */
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián RiescoAP_DECLARE_HOOK(int, get_mgmt_items,
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco (apr_pool_t *p, const char * val, apr_hash_t *ht))
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ---------------------------------------------------------------------- */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ----------------------------------------------------------------------
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * I/O logging with mod_logio
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco (conn_rec *c, apr_off_t bytes));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_in,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco (conn_rec *c, apr_off_t bytes));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(apr_off_t, ap_logio_get_last_bytes, (conn_rec *c));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ----------------------------------------------------------------------
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Error log formats
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * The info structure passed to callback functions of errorlog handlers.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Not all information is available in all contexts. In particular, all
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * pointers may be NULL.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescotypedef struct ap_errorlog_info {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** current server_rec.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Should be preferred over c->base_server and r->server
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const server_rec *s;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** current conn_rec.
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Should be preferred over r->connecction
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const conn_rec *c;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** current request_rec. */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const request_rec *r;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** r->main if r is a subrequest, otherwise equal to r */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const request_rec *rmain;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** name of source file where the log message was produced. */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco const char *file;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** line number in the source file, 0 if N/A */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int line;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** module index of module that produced the log message, APLOG_NO_MODULE if N/A. */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int module_index;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** log level of error message, -1 if N/A */
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco int level;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco /** apr error status related to the log message, 0 if no error */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco apr_status_t status;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco /** 1 if logging to syslog, 0 otherwise */
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco int using_syslog;
fecce42517d20490f893c4a9dee29b000e1653eaAdrián Riesco /** 1 if APLOG_STARTUP was set for the log message, 0 otherwise */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int startup;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} ap_errorlog_info;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * callback function prototype for a external errorlog handler
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @note To avoid unbounded memory usage, these functions must not allocate
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * memory from the server, connection, or request pools. If an errorlog
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * handler absolutely needs a pool to pass to other functions, it must create
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco * and destroy a sub-pool.
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco */
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riescotypedef int ap_errorlog_handler_fn_t(const ap_errorlog_info *info,
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco const char *arg, char *buf, int buflen);
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco
0f77efdcc159eee5682aabf2b9a3c178c467b466Adrián Riesco/**
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * Register external errorlog handler
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param p config pool to use
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @param tag the new format specifier (i.e. the letter after the %)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * @param handler the handler function
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * @param flags flags (reserved, set to 0)
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián RiescoAP_DECLARE(void) ap_register_errorlog_handler(apr_pool_t *p, char *tag,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_errorlog_handler_fn_t *handler,
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco int flags);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riescotypedef struct ap_errorlog_handler {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_errorlog_handler_fn_t *func;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco int flags; /* for future extensions */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} ap_errorlog_handler;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco /** item starts a new field */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_ERRORLOG_FLAG_FIELD_SEP 1
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco /** item is the actual error message */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_ERRORLOG_FLAG_MESSAGE 2
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** skip whole line if item is zero-length */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_ERRORLOG_FLAG_REQUIRED 4
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** log zero-length item as '-' */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco#define AP_ERRORLOG_FLAG_NULL_AS_HYPHEN 8
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riescotypedef struct {
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco /** ap_errorlog_handler function */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco ap_errorlog_handler_fn_t *func;
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** argument passed to item in {} */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco const char *arg;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** a combination of the AP_ERRORLOG_* flags */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int flags;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco /** only log item if the message's log level is higher than this */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco unsigned int min_loglevel;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco} ap_errorlog_format_item;
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAP_DECLARE(void) ap_register_log_hooks(apr_pool_t *p);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ----------------------------------------------------------------------
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco * ident lookups with mod_ident
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco (request_rec *r));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/* ----------------------------------------------------------------------
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco *
6f6549c13f912de12345850e4eb248ec358c1b43Adrián Riesco * authorization values with mod_authz_core
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_type, (request_rec *r));
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_name, (request_rec *r));
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
7474965b2e6323002c96c0b39a59843cde201870Adrián Riesco/* ----------------------------------------------------------------------
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco *
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco * authorization values with mod_access_compat
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco */
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián RiescoAPR_DECLARE_OPTIONAL_FN(int, access_compat_ap_satisfies, (request_rec *r));
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco/* ---------------------------------------------------------------------- */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/** Query the server for some state information
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @param query_code Which information is requested
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * @return the requested state information
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián RiescoAP_DECLARE(int) ap_state_query(int query_code);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco/*
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * possible values for query_code in ap_state_query()
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** current status of the server */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MAIN_STATE 0
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco /** are we going to serve requests or are we just testing/dumping config */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco#define AP_SQ_RUN_MODE 1
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco /** generation of the top-level apache parent */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco#define AP_SQ_CONFIG_GEN 2
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco/*
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco * return values for ap_state_query()
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco */
6d498b6f56ed9f71cced898b6c42fb48f6e60583Adrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco /** return value for unknown query_code */
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco#define AP_SQ_NOT_SUPPORTED -1
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco/* values returned for AP_SQ_MAIN_STATE */
6e121321775373fe11161d23c541437456df19b4Adrián Riesco /** before the config preflight */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MS_INITIAL_STARTUP 1
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** initial configuration run for setting up log config, etc. */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MS_CREATE_PRE_CONFIG 2
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco /** tearing down configuration */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MS_DESTROY_CONFIG 3
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** normal configuration run */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MS_CREATE_CONFIG 4
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** running the MPM */
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#define AP_SQ_MS_RUN_MPM 5
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco /** cleaning up for exit */
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco#define AP_SQ_MS_EXITING 6
0f35e410ce3d3202f6769e9d139ad26d1de69b8eAdrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/* values returned for AP_SQ_RUN_MODE */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /** command line not yet parsed */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_SQ_RM_UNKNOWN 1
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco /** normal operation (server requests or signal server) */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_SQ_RM_NORMAL 2
c1cf2f634a37116ff90e99ca710179a23115cbfbAdrián Riesco /** config test only */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_SQ_RM_CONFIG_TEST 3
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco /** only dump some parts of the config */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#define AP_SQ_RM_CONFIG_DUMP 4
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#ifdef __cplusplus
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco}
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco#endif
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco
27aad79faa0eec8d0e7dda32bca710db95bd2d0aAdrián Riesco#endif /* !APACHE_HTTP_CORE_H */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco/** @} */
aea9000fc94442cbfc92596f4264473c0fce51e4Adrián Riesco