http_core.h revision 367d146f245f3b1c9f77c18e6ec591b52e0b344c
967e5f3c25249c779575864692935627004d3f9eChristian Maeder/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * applicable.
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
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * http://www.apache.org/licenses/LICENSE-2.0
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.
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * @brief CORE HTTP Daemon
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon
ac19f8695aa1b2d2d1cd1319da2530edd8f46a96Christian Maeder * @ingroup APACHE_CORE
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.
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 * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder * @brief File/Directory Accessor directives
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** No directives */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** Indexes directive */
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/** Includes directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** FollowSymLinks directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** ExecCGI directive */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** directive unset */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder/** IncludesNOEXEC directive */
7a879b08ae0ca30006f9be887a73212b07f10204Christian Maeder/** SymLinksIfOwnerMatch directive */
67d92da5e9610aabad39055a16031154b4dc3748Christian Maeder/** MultiViews directive */
a89389521ddf76109168a0b339031575aafbd512Christian Maeder/** All directives */
a89389521ddf76109168a0b339031575aafbd512Christian Maeder#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
a89389521ddf76109168a0b339031575aafbd512Christian Maeder * @defgroup get_remote_host Remote Host Resolution
a89389521ddf76109168a0b339031575aafbd512Christian Maeder * @ingroup APACHE_CORE_HTTPD
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.
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.
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder * never forced.
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.
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** @} // get_remote_host */
ee93fb771fcf3000d73c8e2f2000adb4b9a5158cChristian Maeder/** Make sure we don't write less than 8000 bytes at any one time.
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder/** default maximum of internal redirects */
717686b54b9650402e2ebfbaadf433eab8ba5171Christian Maeder# define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10
d48085f765fca838c1d972d2123601997174583dChristian Maeder/** default maximum subrequest nesting level */
d48085f765fca838c1d972d2123601997174583dChristian Maeder * Retrieve the value of Options for this request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @param r The current request
d48085f765fca838c1d972d2123601997174583dChristian Maeder * @return the Options bitmask
717686b54b9650402e2ebfbaadf433eab8ba5171Christian MaederAP_DECLARE(int) ap_allow_options(request_rec *r);
9b30898b139ee02f97ac933b6d935ef0a4206921Christian Maeder * Retrieve the value of the AllowOverride for this request
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * @param r The current request
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @return the overrides bitmask
1a75698c909ad515d59c76e65bd783f015c21c4dChristian MaederAP_DECLARE(int) ap_allow_overrides(request_rec *r);
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
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian MaederAP_DECLARE(const char *) ap_default_type(request_rec *r);
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
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian MaederAP_DECLARE(const char *) ap_document_root(request_rec *r);
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:
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.
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
3c8d067accf18572352351ec42ff905c7297a8a5Christian MaederAP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian Maeder * Retrieve the login name of the remote user. Undef if it could not be
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @param r The current request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @return The user logged in to the client machine
842eedc62639561781b6c33533d1949693ef6cc5Christian MaederAP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
967e5f3c25249c779575864692935627004d3f9eChristian Maeder/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
967e5f3c25249c779575864692935627004d3f9eChristian Maeder * and SERVER_NAME.
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 MaederAP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Get the current server name from the request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return the server name
967e5f3c25249c779575864692935627004d3f9eChristian MaederAP_DECLARE(const char *) ap_get_server_name(request_rec *r);
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * Get the current server port
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @param r The current request
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian Maeder * @return The server's port
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
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 MaederAP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
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 MaederAP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
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
a95f5379cabb30d3beb0545002cf50e9e4fc2c86Christian MaederAP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
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 MaederAP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
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
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);
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.
83814002b4922114cbe7e9ba728472a0bf44aac5Christian Maeder/** @see require_line */
97ee7048e63953c5617342ce38c30cbcb35cc0beChristian Maeder * @brief A structure to keep track of authorization requirements
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder /** Where the require line is in the config file. */
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder /** The complete string from the command line */
b66eb6038bfbcd2fe520d87c151bb4f1f510e985Christian Maeder * Return the type of authorization required for this request
2dfc7b04f2db681992ca04175f2beb0f127c9844Christian Maeder * @param r The current request
2dfc7b04f2db681992ca04175f2beb0f127c9844Christian Maeder * @return The authorization required
dedabc954aa15f6ad0764472a9434dc6dafe3db2Christian MaederAP_DECLARE(const char *) ap_auth_type(request_rec *r);
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * Return the current Authorization realm
1a75698c909ad515d59c76e65bd783f015c21c4dChristian Maeder * @param r The current request
588c0c022a0f4e129a89c3bc569daf6a835e182dChristian Maeder * @return The current authorization realm
07b72edb610ee53b4832d132e96b0a3d8423f8ebChristian MaederAP_DECLARE(const char *) ap_auth_name(request_rec *r);
#ifdef CORE_PRIVATE
* the code that cares really is in http_core.c. Also, another accessor.
void **notes;
int deliver_script;
int suppress_charset;
#define AP_NOTE_DIRECTORY_WALK 0
typedef unsigned char allow_options_t;
typedef unsigned char overrides_t;
typedef unsigned long etag_components_t;
#define ETAG_UNSET 0
/** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */
unsigned d_components;
char *ap_default_type;
#define HOSTNAME_LOOKUP_OFF 0
#define USE_CANONICAL_NAME_OFF (0)
#define ADD_DEFAULT_CHARSET_OFF (0)
const char *add_default_charset_name;
#ifdef RLIMIT_CPU
#ifdef RLIMIT_NPROC
int loglevel;
ap_regex_t *r;
* What attributes/data should be included in ETag generation?
#define ENABLE_MMAP_OFF (0)
#define ENABLE_SENDFILE_OFF (0)
#define USE_CANONICAL_PHYS_PORT_OFF (0)
#ifdef GPROF
char *gprof_dir;
const char *ap_document_root;
char *access_name;
const char *protocol;
#define AP_TRACE_DISABLE 0
int trace_enable;
/* for AddOutputFiltersByType in core.c */
/* for http_config.c */
AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
* Runtime status/management
const char *s_value;
long i_value;
const char *description;
const char *name;
* This hook provdes a way for modules to provide metrics/statistics about
(request_rec *r));
#ifdef __cplusplus