httpd.h revision 7b6ba9c468f26bdb3492d5e8cb79628a3b04e8c8
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Copyright 1999-2004 The Apache Software Foundation
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * Licensed under the Apache License, Version 2.0 (the "License");
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * you may not use this file except in compliance with the License.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * You may obtain a copy of the License at
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * Unless required by applicable law or agreed to in writing, software
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * distributed under the License is distributed on an "AS IS" BASIS,
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * See the License for the specific language governing permissions and
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * limitations under the License.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * @brief HTTP Daemon routines
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* XXX - We need to push more stuff to other .h files, or even .c files, to
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek * make this file smaller
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Headers in which EVERYONE has an interest... */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Note: util_uri.h is also included, see below */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* ----------------------------- config dir ------------------------------ */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Define this to be the default server home dir. Most things later in this
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * file with a relative pathname will have this added.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set default for OS/2 file system */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set default for Windows file system */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set the default for BeOS */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set the default for NetWare */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* HTTPD_ROOT */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * --------- You shouldn't have to edit anything below this line ----------
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * Any modifications to any defaults not defined above should be done in the
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * respective configuration file.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Default location of documents. Can be overridden by the DocumentRoot
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set default for OS/2 file system */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* DOCUMENT_LOCATION */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Maximum number of dynamically loaded modules */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Default administrator's address */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The name of the log files */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* DEFAULT_ERRORLOG */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Define this to be what your per-directory security files are called */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Set default for OS/2 file system */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* DEFAULT_ACCESS_FNAME */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The name of the server config file */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The default path for CGI scripts if none is currently set */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The path to the suExec wrapper, can be overridden in Configuration */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The timeout for waiting for messages */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The timeout for waiting for keepalive timeout until next request */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* The number of requests to entertain per connection */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/* Limits on the size of various request items. These limits primarily
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * exist to prevent simple denial-of-service attacks on a server based
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina * on misuse of the protocol. The recommended values will depend on the
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * nature of the server resources -- CGI scripts and database backends
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * might require large values, but most servers could get by with much
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * smaller limits than we use below. The request message body size can
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * be limited by the per-dir config directive LimitRequestBody.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * These two limits can be lowered (but not raised) by the server config
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * directives LimitRequestLine and LimitRequestFieldsize, respectively.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * the server config directive LimitRequestFields.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#endif /* default limit on bytes in any one header field */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina#endif /* default limit on number of request header fields */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * The default default character set name to add if AddDefaultCharset is
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * enabled. Overridden with AddDefaultCharsetName.
488b455f6b7881ec108a127840b1c1f1523d937fMichal Židek#define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
488b455f6b7881ec108a127840b1c1f1523d937fMichal Židek#endif /* CORE_PRIVATE */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/** default HTTP Server protocol */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/* ------------------ stuff that modules are allowed to look at ----------- */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/** Define this to be what your HTML directory content files are called */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina * Define this to be what type you'd like returned for files with unknown
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina * @warning MUST be all lower case.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** The name of the MIME types file */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina * Define the HTML doctype strings centrally.
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/** HTML 2.0 Doctype */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina "DTD HTML 2.0//EN\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** HTML 3.2 Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD HTML 3.2 Final//EN\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** HTML 4.0 Strict Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD HTML 4.0//EN\"\n" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** HTML 4.0 Transitional Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD HTML 4.0 Transitional//EN\"\n" \
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** HTML 4.0 Frameset Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD HTML 4.0 Frameset//EN\"\n" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** XHTML 1.0 Strict Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD XHTML 1.0 Strict//EN\"\n" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "xhtml1-strict.dtd\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** XHTML 1.0 Transitional Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD XHTML 1.0 Transitional//EN\"\n" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "xhtml1-transitional.dtd\">\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** XHTML 1.0 Frameset Doctype */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "DTD XHTML 1.0 Frameset//EN\"\n" \
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina "xhtml1-frameset.dtd\">"
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina/** Major part of HTTP protocol */
b6cc93b259b96408a827a4349a98600c0b2f6660Pavel Březina#define HTTP_VERSION_MAJOR(number) ((number)/1000)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina/** Minor part of HTTP protocol */
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina#define HTTP_VERSION_MINOR(number) ((number)%1000)
488b455f6b7881ec108a127840b1c1f1523d937fMichal Židek/* -------------- Port number for server running standalone --------------- */
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek/** default HTTP Port */
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek/** default HTTPS Port */
55857e924977dbc66958f8033c6b38d6262ee631Michal Židek * Check whether @a port is the default port for the request @a r.
55857e924977dbc66958f8033c6b38d6262ee631Michal Židek * @param port The port number
55857e924977dbc66958f8033c6b38d6262ee631Michal Židek * @param r The request
55857e924977dbc66958f8033c6b38d6262ee631Michal Židek * @see #ap_default_port
55857e924977dbc66958f8033c6b38d6262ee631Michal Židek#define ap_is_default_port(port,r) ((port) == ap_default_port(r))
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek * Get the default port for a request (which depends on the scheme).
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek * @param r The request
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek#define ap_default_port(r) ap_run_default_port(r)
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek * Get the scheme for a request.
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek * @param r The request
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek/** The default string lengths */
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek/** The size of the server's internal read-write buffers */
552390afcc81af96ca201fa6c25ddefbbecbeb4eJakub Hrozek/** The max number of regex captures that can be expanded by ap_pregsub */
* in http_main.c so we can keep track of various errors.
#ifndef AP_DECLARE
#ifndef AP_DECLARE_NONSTD
#ifndef AP_DECLARE_DATA
# define AP_DECLARE_DATA
#ifndef AP_MODULE_DECLARE
#ifndef AP_MODULE_DECLARE_NONSTD
#ifndef AP_MODULE_DECLARE_DATA
# define AP_MODULE_DECLARE_DATA
#ifndef AP_CORE_DECLARE
#ifndef AP_CORE_DECLARE_NONSTD
} ap_version_t;
* 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 {
int argc;
const char * const *argv;
const char *short_name;
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;
char *protocol;
int proto_num;
const char *hostname;
const char *status_line;
int status;
/* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
const char *method;
int method_number;
int chunked;
const char *range;
int read_body;
int read_chunked;
unsigned expecting_100;
const char *content_encoding;
char *vlist_validator;
char *user;
char *ap_auth_type;
int no_cache;
int no_local_copy;
char *unparsed_uri;
char *uri;
char *filename;
char *canonical_filename;
char *path_info;
char *args;
int used_path_info;
int eos_sent;
struct conn_rec {
/** used by http_vhost.c */
void *vhost_lookup_data;
char *remote_ip;
char *remote_host;
char *remote_logname;
int keepalives;
char *local_ip;
char *local_host;
long id;
void *sbh;
} conn_state_e;
struct conn_state_t {
conn_rec *c;
apr_pool_t *p;
struct server_addr_rec {
char *virthost;
struct server_rec {
const char *defn_name;
unsigned defn_line_number;
char *server_admin;
char *server_hostname;
char *error_fname;
int loglevel;
int is_virtual;
int keep_alive_max;
int keep_alive;
const char *path;
int pathlen;
int limit_req_line;
int limit_req_fieldsize;
int limit_req_fields;
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);
* 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