httpd.h revision a0bd5cdd79004f4b7b1b441e38133519d3e20a1f
af84459fbf938e508fd10b01cb8d699c79083813takashi/* Licensed to the Apache Software Foundation (ASF) under one or more
af84459fbf938e508fd10b01cb8d699c79083813takashi * contributor license agreements. See the NOTICE file distributed with
af84459fbf938e508fd10b01cb8d699c79083813takashi * this work for additional information regarding copyright ownership.
af84459fbf938e508fd10b01cb8d699c79083813takashi * The ASF licenses this file to You under the Apache License, Version 2.0
af84459fbf938e508fd10b01cb8d699c79083813takashi * (the "License"); you may not use this file except in compliance with
af84459fbf938e508fd10b01cb8d699c79083813takashi * the License. You may obtain a copy of the License at
af84459fbf938e508fd10b01cb8d699c79083813takashi * Unless required by applicable law or agreed to in writing, software
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * distributed under the License is distributed on an "AS IS" BASIS,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * limitations under the License.
af84459fbf938e508fd10b01cb8d699c79083813takashi * @brief HTTP Daemon routines
af84459fbf938e508fd10b01cb8d699c79083813takashi * @defgroup APACHE Apache
af84459fbf938e508fd10b01cb8d699c79083813takashi * Top level group of which all other groups are a member
af84459fbf938e508fd10b01cb8d699c79083813takashi * @defgroup APACHE_MODS Apache Modules
af84459fbf938e508fd10b01cb8d699c79083813takashi * Top level group for Apache Modules
af84459fbf938e508fd10b01cb8d699c79083813takashi * @defgroup APACHE_OS Operating System Specific
af84459fbf938e508fd10b01cb8d699c79083813takashi * @defgroup APACHE_CORE Apache Core
3c13a815670b54d1c17bf02954f7d2b066cde95cnd * @defgroup APACHE_CORE_DAEMON HTTP Daemon Routine
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* XXX - We need to push more stuff to other .h files, or even .c files, to
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * make this file smaller
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Headers in which EVERYONE has an interest... */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Note: apr_uri.h is also included, see below */
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfextern "C" {
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* ----------------------------- config dir ------------------------------ */
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin/** Define this to be the default server home dir. Most things later in this
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * file with a relative pathname will have this added.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Set default for OS/2 file system */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Set default for Windows file system */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Set the default for NetWare */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Set for all other OSs */
4bebf996eb7002ebfe897d46a0e0572390604a77nd#endif /* HTTPD_ROOT */
4bebf996eb7002ebfe897d46a0e0572390604a77nd * --------- You shouldn't have to edit anything below this line ----------
4bebf996eb7002ebfe897d46a0e0572390604a77nd * Any modifications to any defaults not defined above should be done in the
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * respective configuration file.
af84459fbf938e508fd10b01cb8d699c79083813takashi * Default location of documents. Can be overridden by the DocumentRoot
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * directive.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Set default for OS/2 file system */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Set default for non OS/2 file system */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* DOCUMENT_LOCATION */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Maximum number of dynamically loaded modules */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Default administrator's address */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The name of the log files */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* DEFAULT_ERRORLOG */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Define this to be what your per-directory security files are called */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Set default for OS/2 file system */
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh#endif /* DEFAULT_ACCESS_FNAME */
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh/** The name of the server config file */
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh/** The default path for CGI scripts if none is currently set */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh/** The path to the suExec wrapper, can be overridden in Configuration */
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh/** The timeout for waiting for messages */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The timeout for waiting for keepalive timeout until next request */
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh/** The number of requests to entertain per connection */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Limits on the size of various request items. These limits primarily
af84459fbf938e508fd10b01cb8d699c79083813takashi * exist to prevent simple denial-of-service attacks on a server based
af84459fbf938e508fd10b01cb8d699c79083813takashi * on misuse of the protocol. The recommended values will depend on the
2d39a41e98476f5235b7c37ce745a4aa0904b1cbrbowen * nature of the server resources -- CGI scripts and database backends
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen * might require large values, but most servers could get by with much
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * smaller limits than we use below. The request message body size can
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * be limited by the per-dir config directive LimitRequestBody.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * These two limits can be lowered or raised by the server config
c8c717fafa0a09ed13469a603a178921b851dd22igalic * directives LimitRequestLine and LimitRequestFieldsize, respectively.
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic * the server config directive LimitRequestFields.
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic/** default limit on bytes in Request-Line (Method+URI+HTTP-version) */
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic/** default limit on bytes in any one header field */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** default limit on number of request header fields */
4bebf996eb7002ebfe897d46a0e0572390604a77nd * The default default character set name to add if AddDefaultCharset is
4bebf996eb7002ebfe897d46a0e0572390604a77nd * enabled. Overridden with AddDefaultCharsetName.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** default HTTP Server protocol */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* ------------------ stuff that modules are allowed to look at ----------- */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Define this to be what your HTML directory content files are called */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The name of the MIME types file */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Define the HTML doctype strings centrally.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 2.0 Doctype */
8559a67073808d84d85bb5dd552d4247caafe709sf#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen "DTD HTML 2.0//EN\">\n"
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 3.2 Doctype */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe "DTD HTML 3.2 Final//EN\">\n"
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 4.0 Strict Doctype */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe "DTD HTML 4.0//EN\"\n" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 4.0 Transitional Doctype */
8559a67073808d84d85bb5dd552d4247caafe709sf#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe "DTD HTML 4.0 Transitional//EN\"\n" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 4.0 Frameset Doctype */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
c8c717fafa0a09ed13469a603a178921b851dd22igalic "DTD HTML 4.0 Frameset//EN\"\n" \
c8c717fafa0a09ed13469a603a178921b851dd22igalic "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
8559a67073808d84d85bb5dd552d4247caafe709sf/** XHTML 1.0 Strict Doctype */
c8c717fafa0a09ed13469a603a178921b851dd22igalic#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
c8c717fafa0a09ed13469a603a178921b851dd22igalic "DTD XHTML 1.0 Strict//EN\"\n" \
8559a67073808d84d85bb5dd552d4247caafe709sf "xhtml1-strict.dtd\">\n"
8559a67073808d84d85bb5dd552d4247caafe709sf/** XHTML 1.0 Transitional Doctype */
8559a67073808d84d85bb5dd552d4247caafe709sf#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
8559a67073808d84d85bb5dd552d4247caafe709sf "DTD XHTML 1.0 Transitional//EN\"\n" \
8559a67073808d84d85bb5dd552d4247caafe709sf "xhtml1-transitional.dtd\">\n"
8559a67073808d84d85bb5dd552d4247caafe709sf/** XHTML 1.0 Frameset Doctype */
8559a67073808d84d85bb5dd552d4247caafe709sf#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
8559a67073808d84d85bb5dd552d4247caafe709sf "DTD XHTML 1.0 Frameset//EN\"\n" \
8559a67073808d84d85bb5dd552d4247caafe709sf "xhtml1-frameset.dtd\">"
8559a67073808d84d85bb5dd552d4247caafe709sf/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
8559a67073808d84d85bb5dd552d4247caafe709sf/** Major part of HTTP protocol */
8559a67073808d84d85bb5dd552d4247caafe709sf/** Minor part of HTTP protocol */
8559a67073808d84d85bb5dd552d4247caafe709sf/* -------------- Port number for server running standalone --------------- */
8559a67073808d84d85bb5dd552d4247caafe709sf/** default HTTP Port */
8559a67073808d84d85bb5dd552d4247caafe709sf/** default HTTPS Port */
4bebf996eb7002ebfe897d46a0e0572390604a77nd * Check whether @a port is the default port for the request @a r.
4bebf996eb7002ebfe897d46a0e0572390604a77nd * @param port The port number
4bebf996eb7002ebfe897d46a0e0572390604a77nd * @param r The request
4bebf996eb7002ebfe897d46a0e0572390604a77nd * @see #ap_default_port
4bebf996eb7002ebfe897d46a0e0572390604a77nd#define ap_is_default_port(port,r) ((port) == ap_default_port(r))
4bebf996eb7002ebfe897d46a0e0572390604a77nd * Get the default port for a request (which depends on the scheme).
4bebf996eb7002ebfe897d46a0e0572390604a77nd * @param r The request
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Get the scheme for a request.
af84459fbf938e508fd10b01cb8d699c79083813takashi * @param r The request
af84459fbf938e508fd10b01cb8d699c79083813takashi/** The default string length */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The length of a Huge string */
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic/** The size of the server's internal read-write buffers */
9534272616b71aaea50aeec4162e749a96aebd7fsf/** The max number of regex captures that can be expanded by ap_pregsub */
7159c12b7697fe9f5ab3a533cc6dfc3d57803053igalic * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into
7159c12b7697fe9f5ab3a533cc6dfc3d57803053igalic * mutiple buckets, no greater than MAX(apr_size_t), and more granular
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic * than that in case the brigade code/filters attempt to read it directly.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * ### 16mb is an invention, no idea if it is reasonable.
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen * Special Apache error codes. These are basically used
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen * in http_main.c so we can keep track of various errors.
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** a normal exit */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** A fatal error arising during the server's init sequence */
4126704c4950bfd46d32ad54e3b106ac6d868a73sf/** The child died during its init sequence */
4126704c4950bfd46d32ad54e3b106ac6d868a73sf * The child exited due to a resource shortage.
4126704c4950bfd46d32ad54e3b106ac6d868a73sf * The parent should limit the rate of forking until
4126704c4950bfd46d32ad54e3b106ac6d868a73sf * the situation is resolved.
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh * A fatal error, resulting in the whole server aborting.
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh * If a child exits with this error, the parent process
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedooh * considers this a server-wide fatal error and aborts.
af84459fbf938e508fd10b01cb8d699c79083813takashi * Stuff marked #AP_DECLARE is part of the API, and intended for use
af84459fbf938e508fd10b01cb8d699c79083813takashi * by modules. Its purpose is to allow us to add attributes that
af84459fbf938e508fd10b01cb8d699c79083813takashi * particular platforms or compilers require to every exported function.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * use by modules. The difference between #AP_DECLARE and
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * #AP_DECLARE_NONSTD is that the latter is required for any functions
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * which use varargs or are used via indirect function call. This
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * is to accomodate the two calling conventions in windows dlls.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @internal
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * modules should not use functions marked AP_CORE_DECLARE
c8c717fafa0a09ed13469a603a178921b851dd22igalic * @internal
7e9c796f2dc0dba993a817b3a58cfd56b4e511edwrowe * modules should not use functions marked AP_CORE_DECLARE_NONSTD
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @brief The numeric version information is broken out into fields within this
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * structure.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowetypedef struct {
af84459fbf938e508fd10b01cb8d699c79083813takashi const char *add_string; /**< additional string like "-dev" */
0d0ba3a410038e179b695446bb149cce6264e0abnd * Return httpd's version information in a numeric form.
0d0ba3a410038e179b695446bb149cce6264e0abnd * @param version Pointer to a version structure for returning the version
0d0ba3a410038e179b695446bb149cce6264e0abnd * information.
888cb40bdeec5abf452bd85d6bf63b26d5913d4chumbedoohAP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
0d0ba3a410038e179b695446bb149cce6264e0abnd * Get the server banner in a form suitable for sending over the
0d0ba3a410038e179b695446bb149cce6264e0abnd * network, with the level of information controlled by the
0d0ba3a410038e179b695446bb149cce6264e0abnd * ServerTokens directive.
0d0ba3a410038e179b695446bb149cce6264e0abnd * @return The server banner
0d0ba3a410038e179b695446bb149cce6264e0abnd * Get the server description in a form suitable for local displays,
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * status reports, or logging. This includes the detailed server
5effc8b39fae5cd169d17f342bfc265705840014rbowen * version and information about some modules. It is not affected
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen * by the ServerTokens directive.
0d0ba3a410038e179b695446bb149cce6264e0abnd * @return The server description
* The size of the static array in http_protocol.c for storing
#define ap_status_drops_connection(x) \
(((x) == HTTP_BAD_REQUEST) || \
((x) == HTTP_REQUEST_TIME_OUT) || \
((x) == HTTP_LENGTH_REQUIRED) || \
((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
((x) == HTTP_INTERNAL_SERVER_ERROR) || \
((x) == HTTP_SERVICE_UNAVAILABLE) || \
((x) == HTTP_NOT_IMPLEMENTED))
* This list must be tracked by the list in http_protocol.c in routine
struct ap_method_list_t {
#if !APR_CHARSET_EBCDIC
#define REQUEST_NO_BODY 0
#define AP_REQ_ACCEPT_PATH_INFO 0
struct htaccess_result {
const char *dir;
int override;
int override_opts;
/* ### would be nice to not include this from httpd.h ... */
#include "apr_uri.h"
struct process_rec {
const char *short_name;
const char * const *argv;
int argc;
struct request_rec {
* (see http_request.h) */
* protocol.c should ever touch...
char *the_request;
int assbackwards;
/** A proxy request (calculated during post_read_request/translate_name)
int proxyreq;
int header_only;
int proto_num;
char *protocol;
const char *hostname;
const char *status_line;
int status;
/* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
int method_number;
const char *method;
const char *range;
int chunked;
int read_body;
int read_chunked;
unsigned expecting_100;
const char *content_encoding;
char *vlist_validator;
char *user;
char *ap_auth_type;
char *unparsed_uri;
char *uri;
char *filename;
char *canonical_filename;
char *path_info;
char *args;
int used_path_info;
int eos_sent;
const char *log_id;
int no_cache;
int no_local_copy;
struct conn_rec {
/** used by http_vhost.c */
void *vhost_lookup_data;
char *remote_ip;
char *remote_host;
char *remote_logname;
char *local_ip;
char *local_host;
long id;
void *sbh;
unsigned aborted;
int keepalives;
const char *log_id;
#if APR_HAS_THREADS
} conn_state_e;
struct conn_state_t {
conn_rec *c;
apr_pool_t *p;
struct server_addr_rec {
char *virthost;
struct ap_logconf {
signed char *module_levels;
int level;
struct server_rec {
char *error_fname;
const char *defn_name;
unsigned defn_line_number;
char is_virtual;
const char *server_scheme;
char *server_admin;
char *server_hostname;
int keep_alive_max;
int keep_alive;
const char *path;
int pathlen;
int limit_req_line;
int limit_req_fieldsize;
int limit_req_fields;
void *context;
typedef struct core_output_filter_ctx {
typedef struct core_filter_ctx {
} core_ctx_t;
typedef struct core_net_rec {
conn_rec *c;
} core_net_rec;
* Examine a field value (such as a media-/content-type) string and return
char stop);
const char *prefix);
int cflags);
* a macro, to avoid unistd.h dependency
const char *delim);
const char *timeout_parameter,
const char *default_time_unit);
const char **dest);
* Given the name of an object in the file system determine if it is a directory - this version is symlink aware
#ifdef _OSD_POSIX
#ifdef AP_DEBUG
#ifdef DEBUG_SIGSTOP
extern int raise_sigstop_flags;
#define RAISE_SIGSTOP(x) do { \
#define RAISE_SIGSTOP(x)
#ifdef strtoul
Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs
#include <string.h>
#ifdef AP_DEBUG
#ifdef __cplusplus