httpd.h revision 92d6e181c597b97647d750c43a7bc3626e056b59
af84459fbf938e508fd10b01cb8d699c79083813takashi/* ====================================================================
af84459fbf938e508fd10b01cb8d699c79083813takashi * The Apache Software License, Version 1.1
af84459fbf938e508fd10b01cb8d699c79083813takashi * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
af84459fbf938e508fd10b01cb8d699c79083813takashi * reserved.
af84459fbf938e508fd10b01cb8d699c79083813takashi * Redistribution and use in source and binary forms, with or without
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen * modification, are permitted provided that the following conditions
af84459fbf938e508fd10b01cb8d699c79083813takashi * 1. Redistributions of source code must retain the above copyright
af84459fbf938e508fd10b01cb8d699c79083813takashi * notice, this list of conditions and the following disclaimer.
af84459fbf938e508fd10b01cb8d699c79083813takashi * 2. Redistributions in binary form must reproduce the above copyright
af84459fbf938e508fd10b01cb8d699c79083813takashi * notice, this list of conditions and the following disclaimer in
af84459fbf938e508fd10b01cb8d699c79083813takashi * the documentation and/or other materials provided with the
af84459fbf938e508fd10b01cb8d699c79083813takashi * distribution.
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen * 3. The end-user documentation included with the redistribution,
af84459fbf938e508fd10b01cb8d699c79083813takashi * if any, must include the following acknowledgment:
af84459fbf938e508fd10b01cb8d699c79083813takashi * "This product includes software developed by the
af84459fbf938e508fd10b01cb8d699c79083813takashi * Apache Software Foundation (http://www.apache.org/)."
af84459fbf938e508fd10b01cb8d699c79083813takashi * Alternately, this acknowledgment may appear in the software itself,
af84459fbf938e508fd10b01cb8d699c79083813takashi * if and wherever such third-party acknowledgments normally appear.
af84459fbf938e508fd10b01cb8d699c79083813takashi * 4. The names "Apache" and "Apache Software Foundation" must
af84459fbf938e508fd10b01cb8d699c79083813takashi * not be used to endorse or promote products derived from this
3c13a815670b54d1c17bf02954f7d2b066cde95cnd * software without prior written permission. For written
3c13a815670b54d1c17bf02954f7d2b066cde95cnd * permission, please contact apache@apache.org.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * 5. Products derived from this software may not be called "Apache",
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * nor may "Apache" appear in their name, without prior written
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * permission of the Apache Software Foundation.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
af84459fbf938e508fd10b01cb8d699c79083813takashi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
af84459fbf938e508fd10b01cb8d699c79083813takashi * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
af84459fbf938e508fd10b01cb8d699c79083813takashi * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
af84459fbf938e508fd10b01cb8d699c79083813takashi * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
af84459fbf938e508fd10b01cb8d699c79083813takashi * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
af84459fbf938e508fd10b01cb8d699c79083813takashi * SUCH DAMAGE.
af84459fbf938e508fd10b01cb8d699c79083813takashi * ====================================================================
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen * This software consists of voluntary contributions made by many
af84459fbf938e508fd10b01cb8d699c79083813takashi * individuals on behalf of the Apache Software Foundation. For more
af84459fbf938e508fd10b01cb8d699c79083813takashi * information on the Apache Software Foundation, please see
af84459fbf938e508fd10b01cb8d699c79083813takashi * Portions of this software are based upon public domain software
3c13a815670b54d1c17bf02954f7d2b066cde95cnd * originally written at the National Center for Supercomputing Applications,
af84459fbf938e508fd10b01cb8d699c79083813takashi * University of Illinois, Urbana-Champaign.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @brief HTTP Daemon routines
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* XXX - We need to push more stuff to other .h files, or even .c files, to
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * make this file smaller
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin/* Headers in which EVERYONE has an interest... */
af84459fbf938e508fd10b01cb8d699c79083813takashi/* Note: util_uri.h is also included, see below */
af84459fbf938e508fd10b01cb8d699c79083813takashiextern "C" {
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* ----------------------------- config dir ------------------------------ */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* 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 BeOS */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Set the default for NetWare */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* HTTPD_ROOT */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * --------- You shouldn't have to edit anything below this line ----------
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Any modifications to any defaults not defined above should be done in the
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * respective configuration file.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Default location of documents. Can be overridden by the DocumentRoot
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * directive.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Set default for 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 */
af84459fbf938e508fd10b01cb8d699c79083813takashi#endif /* DEFAULT_ACCESS_FNAME */
2d39a41e98476f5235b7c37ce745a4aa0904b1cbrbowen/* The name of the server config file */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* 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"
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic/* The path to the suExec wrapper, can be overridden in Configuration */
b7f8d802ecaed65eada1fc31472d06d8460d5528igalic/* The timeout for waiting for messages */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* The timeout for waiting for keepalive timeout until next request */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* The number of requests to entertain per connection */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/* Limits on the size of various request items. These limits primarily
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * exist to prevent simple denial-of-service attacks on a server based
8559a67073808d84d85bb5dd552d4247caafe709sf * on misuse of the protocol. The recommended values will depend on the
8559a67073808d84d85bb5dd552d4247caafe709sf * nature of the server resources -- CGI scripts and database backends
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * 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 (but not raised) by the server config
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * directives LimitRequestLine and LimitRequestFieldsize, respectively.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * the server config directive LimitRequestFields.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
fed47023e9be04c612b5f6d4a5ee2b8e7c587181rbowen#endif /* default limit on bytes in any one header field */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* default limit on number of request header fields */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * The default default character set name to add if AddDefaultCharset is
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * enabled. Overridden with AddDefaultCharsetName.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#endif /* CORE_PRIVATE */
c8c717fafa0a09ed13469a603a178921b851dd22igalic/** default HTTP Server protocol */
c8c717fafa0a09ed13469a603a178921b851dd22igalic/* ------------------ stuff that modules are allowed to look at ----------- */
8559a67073808d84d85bb5dd552d4247caafe709sf/** Define this to be what your HTML directory content files are called */
8559a67073808d84d85bb5dd552d4247caafe709sf * Define this to be what type you'd like returned for files with unknown
8559a67073808d84d85bb5dd552d4247caafe709sf * suffixes.
8559a67073808d84d85bb5dd552d4247caafe709sf * @warning MUST be all lower case.
8559a67073808d84d85bb5dd552d4247caafe709sf/** The name of the MIME types file */
8559a67073808d84d85bb5dd552d4247caafe709sf * Define the HTML doctype strings centrally.
8559a67073808d84d85bb5dd552d4247caafe709sf/** HTML 2.0 Doctype */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe "DTD HTML 2.0//EN\">\n"
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 3.2 Doctype */
af84459fbf938e508fd10b01cb8d699c79083813takashi#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
af84459fbf938e508fd10b01cb8d699c79083813takashi "DTD HTML 3.2 Final//EN\">\n"
af84459fbf938e508fd10b01cb8d699c79083813takashi/** HTML 4.0 Strict Doctype */
af84459fbf938e508fd10b01cb8d699c79083813takashi#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
af84459fbf938e508fd10b01cb8d699c79083813takashi "DTD HTML 4.0//EN\"\n" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** HTML 4.0 Transitional Doctype */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe "DTD HTML 4.0 Transitional//EN\"\n" \
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic/** HTML 4.0 Frameset Doctype */
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic "DTD HTML 4.0 Frameset//EN\"\n" \
8e9c6d6438af1ccb46adaa60d34caa3ac98f3851igalic "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** Major part of HTTP protocol */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** Minor part of HTTP protocol */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/* -------------- Port number for server running standalone --------------- */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** default HTTP Port */
1d45c1463a8bc69bab1c07a4729269ec7333e713rbowen/** default HTTPS Port */
af84459fbf938e508fd10b01cb8d699c79083813takashi * Check whether @a port is the default port for the request @a r.
af84459fbf938e508fd10b01cb8d699c79083813takashi * @param port The port number
af84459fbf938e508fd10b01cb8d699c79083813takashi * @param r The request
af84459fbf938e508fd10b01cb8d699c79083813takashi * @see #ap_default_port
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe#define ap_is_default_port(port,r) ((port) == ap_default_port(r))
af84459fbf938e508fd10b01cb8d699c79083813takashi * Get the default port for a request (which depends on the scheme).
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @param r The request
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Get the scheme for a request.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @param r The request
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * @bug This should be called ap_http_scheme!
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The default string lengths */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe/** The size of the server's internal read-write buffers */
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * mutiple buckets, no greater than MAX(apr_size_t), and more granular
c8c717fafa0a09ed13469a603a178921b851dd22igalic * than that in case the brigade code/filters attempt to read it directly.
c8c717fafa0a09ed13469a603a178921b851dd22igalic * ### 16mb is an invention, no idea if it is reasonable.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * Special Apache error codes. These are basically used
7e9c796f2dc0dba993a817b3a58cfd56b4e511edwrowe * in http_main.c so we can keep track of various errors.
7e9c796f2dc0dba993a817b3a58cfd56b4e511edwrowe/** a normal exit */
c8c717fafa0a09ed13469a603a178921b851dd22igalic/** A fatal error arising during the server's init sequence */
7e9c796f2dc0dba993a817b3a58cfd56b4e511edwrowe/** The child died during its init sequence */
c8c717fafa0a09ed13469a603a178921b851dd22igalic * The child exited due to a resource shortage.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * The parent should limit the rate of forking until
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * the situation is resolved.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * A fatal error, resulting in the whole server aborting.
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * If a child exits with this error, the parent process
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe * considers this a server-wide fatal error and aborts.
af84459fbf938e508fd10b01cb8d699c79083813takashi * Stuff marked #AP_DECLARE is part of the API, and intended for use
9c1260efa52c82c2a58e5b5f20cd6902563d95f5rbowen * by modules. Its purpose is to allow us to add attributes that
af84459fbf938e508fd10b01cb8d699c79083813takashi * particular platforms or compilers require to every exported function.
#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
* 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;
/* ### 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 {
/** Pointer to the main request if this is a sub-request (see 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;
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