http_core.h revision 367d146f245f3b1c9f77c18e6ec591b52e0b344c
967e5f3c25249c779575864692935627004d3f9eChristian Maeder/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * applicable.
81d182b21020b815887e9057959228546cf61b6bChristian Maeder *
f11f713bebd8e1e623a0a4361065df256033de47Christian Maeder * Licensed under the Apache License, Version 2.0 (the "License");
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian Maeder * you may not use this file except in compliance with the License.
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * You may obtain a copy of the License at
3f69b6948966979163bdfe8331c38833d5d90ecdChristian Maeder *
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * http://www.apache.org/licenses/LICENSE-2.0
89054b2b95a3f92e78324dc852f3d34704e2ca49Christian Maeder *
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder * Unless required by applicable law or agreed to in writing, software
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder * distributed under the License is distributed on an "AS IS" BASIS,
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * See the License for the specific language governing permissions and
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * limitations under the License.
967e5f3c25249c779575864692935627004d3f9eChristian Maeder */
967e5f3c25249c779575864692935627004d3f9eChristian Maeder
fd896e2068ad7e50aed66ac18c3720ea7ff2619fChristian Maeder/**
7221c71b38c871ce66eee4537cb681d468308dfbChristian Maeder * @file http_core.h
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * @brief CORE HTTP Daemon
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder *
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon
ac19f8695aa1b2d2d1cd1319da2530edd8f46a96Christian Maeder * @ingroup APACHE_CORE
8b9fda012e5ee53b7b2320c0638896a0ff6e99f3Christian Maeder * @{
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder */
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder
e1839fb37a3a2ccd457464cb0dcc5efd466dbe22Christian Maeder#ifndef APACHE_HTTP_CORE_H
4ef2a978e66e2246ff0b7f00c77deb7aabb28b8eChristian Maeder#define APACHE_HTTP_CORE_H
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder
fd896e2068ad7e50aed66ac18c3720ea7ff2619fChristian Maeder#include "apr.h"
967e5f3c25249c779575864692935627004d3f9eChristian Maeder#include "apr_hash.h"
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder#include "apr_optional.h"
78eeae099616e255ccf2e5f9122387bb10c68338Christian Maeder#include "util_filter.h"
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder
ad270004874ce1d0697fb30d7309f180553bb315Christian Maeder#if APR_HAVE_STRUCT_RLIMIT
fd896e2068ad7e50aed66ac18c3720ea7ff2619fChristian Maeder#include <sys/time.h>
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder#include <sys/resource.h>
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder#endif
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder#ifdef __cplusplus
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maederextern "C" {
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder#endif
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/* ****************************************************************
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder *
51fb5d7edd9369c367dda2f8b15ddd6f8a146606Christian Maeder * The most basic server code is encapsulated in a single module
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * known as the core, which is just *barely* functional enough to
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * serve documents, though not terribly well.
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder *
51fb5d7edd9369c367dda2f8b15ddd6f8a146606Christian Maeder * Largely for NCSA back-compatibility reasons, the core needs to
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * make pieces of its config structures available to other modules.
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * The accessors are declared here, along with the interpretation
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * of one of them (allow_options).
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder */
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/**
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder *
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * @brief File/Directory Accessor directives
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder *
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * @{
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder */
7a879b08ae0ca30006f9be887a73212b07f10204Christian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** No directives */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_NONE 0
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** Indexes directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_INDEXES 1
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/** Includes directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_INCLUDES 2
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** FollowSymLinks directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_SYM_LINKS 4
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** ExecCGI directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_EXECCGI 8
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** directive unset */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_UNSET 16
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** IncludesNOEXEC directive */
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder#define OPT_INCNOEXEC 32
7a879b08ae0ca30006f9be887a73212b07f10204Christian Maeder/** SymLinksIfOwnerMatch directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define OPT_SYM_OWNER 64
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/** MultiViews directive */
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder#define OPT_MULTI 128
a89389521ddf76109168a0b339031575aafbd512Christian Maeder/** All directives */
a89389521ddf76109168a0b339031575aafbd512Christian Maeder#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
a89389521ddf76109168a0b339031575aafbd512Christian Maeder/** @} */
a89389521ddf76109168a0b339031575aafbd512Christian Maeder
a89389521ddf76109168a0b339031575aafbd512Christian Maeder/**
a89389521ddf76109168a0b339031575aafbd512Christian Maeder * @defgroup get_remote_host Remote Host Resolution
a89389521ddf76109168a0b339031575aafbd512Christian Maeder * @ingroup APACHE_CORE_HTTPD
a89389521ddf76109168a0b339031575aafbd512Christian Maeder * @{
a89389521ddf76109168a0b339031575aafbd512Christian Maeder */
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder/** REMOTE_HOST returns the hostname, or NULL if the hostname
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder * lookup fails. It will force a DNS lookup according to the
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * HostnameLookups setting.
9b30898b139ee02f97ac933b6d935ef0a4206921Christian Maeder */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder#define REMOTE_HOST (0)
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/** REMOTE_NAME returns the hostname, or the dotted quad if the
51fb5d7edd9369c367dda2f8b15ddd6f8a146606Christian Maeder * hostname lookup fails. It will force a DNS lookup according
e1839fb37a3a2ccd457464cb0dcc5efd466dbe22Christian Maeder * to the HostnameLookups setting.
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder */
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder#define REMOTE_NAME (1)
51fb5d7edd9369c367dda2f8b15ddd6f8a146606Christian Maeder
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * never forced.
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder */
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder#define REMOTE_NOLOOKUP (2)
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
51fb5d7edd9369c367dda2f8b15ddd6f8a146606Christian Maeder * a double reverse lookup, regardless of the HostnameLookups
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian Maeder * setting. The result is the (double reverse checked) hostname,
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * or NULL if any of the lookups fail.
67086e0fe40a985c5e8a3cf50e611f43234580c2Christian Maeder */
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder#define REMOTE_DOUBLE_REV (3)
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** @} // get_remote_host */
67086e0fe40a985c5e8a3cf50e611f43234580c2Christian Maeder
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** Make sure we don't write less than 8000 bytes at any one time.
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder */
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder#define AP_MIN_BYTES_TO_WRITE 8000
67086e0fe40a985c5e8a3cf50e611f43234580c2Christian Maeder
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder/** default maximum of internal redirects */
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder# define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder
d48085f765fca838c1d972d2123601997174583dChristian Maeder/** default maximum subrequest nesting level */
d48085f765fca838c1d972d2123601997174583dChristian Maeder# define AP_DEFAULT_MAX_SUBREQ_DEPTH 10
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder
d48085f765fca838c1d972d2123601997174583dChristian Maeder/**
d48085f765fca838c1d972d2123601997174583dChristian Maeder * Retrieve the value of Options for this request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @param r The current request
d48085f765fca838c1d972d2123601997174583dChristian Maeder * @return the Options bitmask
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder */
717686b54b9650402e2ebfbaadf433eab8ba5171Christian MaederAP_DECLARE(int) ap_allow_options(request_rec *r);
e7ce154edb906685b3fa7f6c0a764e18a4658068Christian Maeder
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder/**
9b30898b139ee02f97ac933b6d935ef0a4206921Christian Maeder * Retrieve the value of the AllowOverride for this request
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * @param r The current request
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @return the overrides bitmask
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE(int) ap_allow_overrides(request_rec *r);
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/**
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * Retrieve the value of the DefaultType directive, or text/plain if not set
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * @param r The current request
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * @return The default type
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder */
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian MaederAP_DECLARE(const char *) ap_default_type(request_rec *r);
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/**
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * Retrieve the document root for this server
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @param r The current request
f11f713bebd8e1e623a0a4361065df256033de47Christian Maeder * @warning Don't use this! If your request went through a Userdir, or
0a8ea95bcf0e3f84fed0b725c049ec2a956a4a28Christian Maeder * something like that, it'll screw you. But it's back-compatible...
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * @return The document root
18b513ff41708f24e1a7407f36b719add813ffeaChristian Maeder */
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian MaederAP_DECLARE(const char *) ap_document_root(request_rec *r);
a89e661aad28f1b39f4fc9f9f9a4d46074234123Christian Maeder
a23e572c8f957cc051a1b0831abd6fe9380d45c7Christian Maeder/**
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * Lookup the remote client's DNS name or IP address
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * @ingroup get_remote_host
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder * @param conn The current connection
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * @param dir_config The directory config vector from the request
f2ee9fc53048ea92bad79e3f5d292d83efd7f8beMihai Codescu * @param type The type of lookup to perform. One of:
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder * <pre>
81d182b21020b815887e9057959228546cf61b6bChristian Maeder * REMOTE_HOST returns the hostname, or NULL if the hostname
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * lookup fails. It will force a DNS lookup according to the
242397ba0f1cc490e892130bf0df239deeecf5daChristian Maeder * HostnameLookups setting.
2e9985cd67e4f2414becb670ef33b8f16513e41dChristian Maeder * REMOTE_NAME returns the hostname, or the dotted quad if the
242397ba0f1cc490e892130bf0df239deeecf5daChristian Maeder * hostname lookup fails. It will force a DNS lookup according
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * to the HostnameLookups setting.
d769b9ca726a9b50d661847c0e58c41d6ef334b4Christian Maeder * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder * never forced.
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder * a double reverse lookup, regardless of the HostnameLookups
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder * setting. The result is the (double reverse checked)
d769b9ca726a9b50d661847c0e58c41d6ef334b4Christian Maeder * hostname, or NULL if any of the lookups fail.
d769b9ca726a9b50d661847c0e58c41d6ef334b4Christian Maeder * </pre>
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
d769b9ca726a9b50d661847c0e58c41d6ef334b4Christian Maeder * string is returned
58b5ac21d1c88344246aaedab0c0bdc7b759d7c6Christian Maeder * @return The remote hostname
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder */
3c8d067accf18572352351ec42ff905c7297a8a5Christian MaederAP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder/**
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian Maeder * Retrieve the login name of the remote user. Undef if it could not be
842eedc62639561781b6c33533d1949693ef6cc5Christian Maeder * determined
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @param r The current request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @return The user logged in to the client machine
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder */
842eedc62639561781b6c33533d1949693ef6cc5Christian MaederAP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
bfa9e03532243ceb487f0384d0f6a447f1ce7670Till Mossakowski
967e5f3c25249c779575864692935627004d3f9eChristian Maeder/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * and SERVER_NAME.
f2ee9fc53048ea92bad79e3f5d292d83efd7f8beMihai Codescu */
967e5f3c25249c779575864692935627004d3f9eChristian Maeder/**
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * build a fully qualified URL from the uri and information in the request rec
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param p The pool to allocate the URL from
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param uri The path to the requested file
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return A fully qualified URL
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder */
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder/**
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Get the current server name from the request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return the server name
967e5f3c25249c779575864692935627004d3f9eChristian Maeder */
967e5f3c25249c779575864692935627004d3f9eChristian MaederAP_DECLARE(const char *) ap_get_server_name(request_rec *r);
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder/**
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Get the current server port
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return The server's port
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder */
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder/**
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Return the limit on bytes in request msg body
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return the maximum number of bytes in the request msg body
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder */
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder/**
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * Return the limit on bytes in XML request msg body
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @param r The current request
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @return the maximum number of bytes in XML request msg body
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/**
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * Install a custom response handler for a given status
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param status The status for which the custom response should be used
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder * @param string The custom response. This can be a static string, a file
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder * or a URL
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder */
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/**
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder * Check if the current request is beyond the configured max. number of redirects or subrequests
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder * @param r The current request
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder * @return true (is exceeded) or false
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder/**
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Check for a definition from the server command line
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param name The define to check for
9659c509ce5e78adc51d7b02a76274eddcba9338Christian Maeder * @return 1 if defined, 0 otherwise
9659c509ce5e78adc51d7b02a76274eddcba9338Christian Maeder */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE(int) ap_exists_config_define(const char *name);
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/* FIXME! See STATUS about how */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
9659c509ce5e78adc51d7b02a76274eddcba9338Christian Maeder/* Authentication stuff. This is one of the places where compatibility
9659c509ce5e78adc51d7b02a76274eddcba9338Christian Maeder * with the old config files *really* hurts; they don't discriminate at
551af0e4ba6d96bb24f3555f3b30ed648e22e34aChristian Maeder * all between different authentication schemes, meaning that we need
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * to maintain common state for all of them in the core, and make it
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * available to the other modules through interfaces.
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder */
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
83814002b4922114cbe7e9ba728472a0bf44aac5Christian Maeder/** @see require_line */
83814002b4922114cbe7e9ba728472a0bf44aac5Christian Maedertypedef struct require_line require_line;
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder
97ee7048e63953c5617342ce38c30cbcb35cc0beChristian Maeder/**
97ee7048e63953c5617342ce38c30cbcb35cc0beChristian Maeder * @brief A structure to keep track of authorization requirements
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder*/
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maederstruct require_line {
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder /** Where the require line is in the config file. */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder apr_int64_t method_mask;
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder /** The complete string from the command line */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder char *requirement;
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder};
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder/**
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * Return the type of authorization required for this request
2dfc7b04f2db681992ca04175f2beb0f127c9844Christian Maeder * @param r The current request
2dfc7b04f2db681992ca04175f2beb0f127c9844Christian Maeder * @return The authorization required
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder */
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian MaederAP_DECLARE(const char *) ap_auth_type(request_rec *r);
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder/**
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * Return the current Authorization realm
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @param r The current request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @return The current authorization realm
ad187062b0009820118c1b773a232e29b879a2faChristian Maeder */
07b72edb610ee53b4832d132e96b0a3d8423f8ebChristian MaederAP_DECLARE(const char *) ap_auth_name(request_rec *r);
#ifdef CORE_PRIVATE
/**
* Core is also unlike other modules in being implemented in more than
* one file... so, data structures are declared here, even though most of
* the code that cares really is in http_core.c. Also, another accessor.
*/
AP_DECLARE_DATA extern module core_module;
/**
* @brief Per-request configuration
*/
typedef struct {
/** bucket brigade used by getline for look-ahead and
* ap_get_client_block for holding left-over request body */
struct apr_bucket_brigade *bb;
/** an array of per-request working data elements, accessed
* by ID using ap_get_request_note()
* (Use ap_register_request_note() during initialization
* to add elements)
*/
void **notes;
/** There is a script processor installed on the output filter chain,
* so it needs the default_handler to deliver a (script) file into
* the chain so it can process it. Normally, default_handler only
* serves files on a GET request (assuming the file is actual content),
* since other methods are not content-retrieval. This flag overrides
* that behavior, stating that the "content" is actually a script and
* won't actually be delivered as the response for the non-GET method.
*/
int deliver_script;
/** Custom response strings registered via ap_custom_response(),
* or NULL; check per-dir config if nothing found here
*/
char **response_code_strings; /* from ap_custom_response(), not from
* ErrorDocument
*/
/** Should addition of charset= be suppressed for this request?
*/
int suppress_charset;
} core_request_config;
/* Standard entries that are guaranteed to be accessible via
* ap_get_request_note() for each request (additional entries
* can be added with ap_register_request_note())
*/
#define AP_NOTE_DIRECTORY_WALK 0
#define AP_NOTE_LOCATION_WALK 1
#define AP_NOTE_FILE_WALK 2
#define AP_NUM_STD_NOTES 3
/**
* Reserve an element in the core_request_config->notes array
* for some application-specific data
* @return An integer key that can be passed to ap_get_request_note()
* during request processing to access this element for the
* current request.
*/
AP_DECLARE(apr_size_t) ap_register_request_note(void);
/**
* Retrieve a pointer to an element in the core_request_config->notes array
* @param r The request
* @param note_num A key for the element: either a value obtained from
* ap_register_request_note() or one of the predefined AP_NOTE_*
* values.
* @return NULL if the note_num is invalid, otherwise a pointer to the
* requested note element.
* @remark At the start of a request, each note element is NULL. The
* handle provided by ap_get_request_note() is a pointer-to-pointer
* so that the caller can point the element to some app-specific
* data structure. The caller should guarantee that any such
* structure will last as long as the request itself.
*/
AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
typedef unsigned char allow_options_t;
typedef unsigned char overrides_t;
/*
* Bits of info that go into making an ETag for a file
* document. Why a long? Because char historically
* proved too short for Options, and int can be different
* sizes on different platforms.
*/
typedef unsigned long etag_components_t;
#define ETAG_UNSET 0
#define ETAG_NONE (1 << 0)
#define ETAG_MTIME (1 << 1)
#define ETAG_INODE (1 << 2)
#define ETAG_SIZE (1 << 3)
#define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
#define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
/**
* @brief Server Signature Enumeration
*/
typedef enum {
srv_sig_unset,
srv_sig_off,
srv_sig_on,
srv_sig_withmail
} server_signature_e;
/**
* @brief Per-directory configuration
*/
typedef struct {
/** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */
char *d;
/** the number of slashes in d */
unsigned d_components;
/** If (opts & OPT_UNSET) then no absolute assignment to options has
* been made.
* invariant: (opts_add & opts_remove) == 0
* Which said another way means that the last relative (options + or -)
* assignment made to each bit is recorded in exactly one of opts_add
* or opts_remove.
*/
allow_options_t opts;
allow_options_t opts_add;
allow_options_t opts_remove;
overrides_t override;
allow_options_t override_opts;
/* MIME typing --- the core doesn't do anything at all with this,
* but it does know what to slap on a request for a document which
* goes untyped by other mechanisms before it slips out the door...
*/
char *ap_default_type;
/* Custom response config. These can contain text or a URL to redirect to.
* if response_code_strings is NULL then there are none in the config,
* if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
* This lets us do quick merges in merge_core_dir_configs().
*/
char **response_code_strings; /* from ErrorDocument, not from
* ap_custom_response() */
/* Hostname resolution etc */
#define HOSTNAME_LOOKUP_OFF 0
#define HOSTNAME_LOOKUP_ON 1
#define HOSTNAME_LOOKUP_DOUBLE 2
#define HOSTNAME_LOOKUP_UNSET 3
unsigned int hostname_lookups : 4;
signed int content_md5 : 2; /* calculate Content-MD5? */
#define USE_CANONICAL_NAME_OFF (0)
#define USE_CANONICAL_NAME_ON (1)
#define USE_CANONICAL_NAME_DNS (2)
#define USE_CANONICAL_NAME_UNSET (3)
unsigned use_canonical_name : 2;
/* since is_fnmatch(conf->d) was being called so frequently in
* directory_walk() and its relatives, this field was created and
* is set to the result of that call.
*/
unsigned d_is_fnmatch : 1;
/* should we force a charset on any outgoing parameterless content-type?
* if so, which charset?
*/
#define ADD_DEFAULT_CHARSET_OFF (0)
#define ADD_DEFAULT_CHARSET_ON (1)
#define ADD_DEFAULT_CHARSET_UNSET (2)
unsigned add_default_charset : 2;
const char *add_default_charset_name;
/* System Resource Control */
#ifdef RLIMIT_CPU
struct rlimit *limit_cpu;
#endif
#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
struct rlimit *limit_mem;
#endif
#ifdef RLIMIT_NPROC
struct rlimit *limit_nproc;
#endif
apr_off_t limit_req_body; /* limit on bytes in request msg body */
long limit_xml_body; /* limit on bytes in XML request msg body */
/* logging options */
server_signature_e server_signature;
int loglevel;
/* Access control */
apr_array_header_t *sec_file;
ap_regex_t *r;
const char *mime_type; /* forced with ForceType */
const char *handler; /* forced with SetHandler */
const char *output_filters; /* forced with SetOutputFilters */
const char *input_filters; /* forced with SetInputFilters */
int accept_path_info; /* forced with AcceptPathInfo */
apr_hash_t *ct_output_filters; /* added with AddOutputFilterByType */
/*
* What attributes/data should be included in ETag generation?
*/
etag_components_t etag_bits;
etag_components_t etag_add;
etag_components_t etag_remove;
/*
* Run-time performance tuning
*/
#define ENABLE_MMAP_OFF (0)
#define ENABLE_MMAP_ON (1)
#define ENABLE_MMAP_UNSET (2)
unsigned int enable_mmap : 2; /* whether files in this dir can be mmap'ed */
#define ENABLE_SENDFILE_OFF (0)
#define ENABLE_SENDFILE_ON (1)
#define ENABLE_SENDFILE_UNSET (2)
unsigned int enable_sendfile : 2; /* files in this dir can be mmap'ed */
unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being
* pitched indiscriminately */
#define USE_CANONICAL_PHYS_PORT_OFF (0)
#define USE_CANONICAL_PHYS_PORT_ON (1)
#define USE_CANONICAL_PHYS_PORT_UNSET (2)
unsigned use_canonical_phys_port : 2;
} core_dir_config;
/* Per-server core configuration */
typedef struct {
#ifdef GPROF
char *gprof_dir;
#endif
/* Name translations --- we want the core to be able to do *something*
* so it's at least a minimally functional web server on its own (and
* can be tested that way). But let's keep it to the bare minimum:
*/
const char *ap_document_root;
/* Access control */
char *access_name;
apr_array_header_t *sec_dir;
apr_array_header_t *sec_url;
/* recursion backstopper */
int redirect_limit; /* maximum number of internal redirects */
int subreq_limit; /* maximum nesting level of subrequests */
const char *protocol;
apr_table_t *accf_map;
/* TRACE control */
#define AP_TRACE_UNSET -1
#define AP_TRACE_DISABLE 0
#define AP_TRACE_ENABLE 1
#define AP_TRACE_EXTENDED 2
int trace_enable;
} core_server_config;
/* for AddOutputFiltersByType in core.c */
void ap_add_output_filters_by_type(request_rec *r);
/* for http_config.c */
void ap_core_reorder_directories(apr_pool_t *, server_rec *);
/* for mod_perl */
AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
/* Core filters; not exported. */
int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes);
apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
#endif /* CORE_PRIVATE */
AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
/* ----------------------------------------------------------------------
*
* Runtime status/management
*/
typedef enum {
ap_mgmt_type_string,
ap_mgmt_type_long,
ap_mgmt_type_hash
} ap_mgmt_type_e;
typedef union {
const char *s_value;
long i_value;
apr_hash_t *h_value;
} ap_mgmt_value;
typedef struct {
const char *description;
const char *name;
ap_mgmt_type_e vtype;
ap_mgmt_value v;
} ap_mgmt_item_t;
/* Handles for core filters */
extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
/**
* This hook provdes a way for modules to provide metrics/statistics about
* their operational status.
*
* @param p A pool to use to create entries in the hash table
* @param val The name of the parameter(s) that is wanted. This is
* tree-structured would be in the form ('*' is all the tree,
* 'module.*' all of the module , 'module.foo.*', or
* 'module.foo.bar' )
* @param ht The hash table to store the results. Keys are item names, and
* the values point to ap_mgmt_item_t structures.
* @ingroup hooks
*/
AP_DECLARE_HOOK(int, get_mgmt_items,
(apr_pool_t *p, const char * val, apr_hash_t *ht))
/* ---------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
*
* I/O logging with mod_logio
*/
APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
(conn_rec *c, apr_off_t bytes));
/* ----------------------------------------------------------------------
*
* ident lookups with mod_ident
*/
APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
(request_rec *r));
/* ----------------------------------------------------------------------
*
* authorization values with mod_authz_host
*/
APR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r));
APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_type, (request_rec *r));
APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_name, (request_rec *r));
/* ---------------------------------------------------------------------- */
#ifdef __cplusplus
}
#endif
#endif /* !APACHE_HTTP_CORE_H */
/** @} */