httpd.h revision 763f7b125b6d3dd1e4992a3822005efa2616f983
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* ====================================================================
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * The Apache Software License, Version 1.1
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Copyright (c) 2000 The Apache Software Foundation. All rights
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * reserved.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Redistribution and use in source and binary forms, with or without
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * modification, are permitted provided that the following conditions
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 1. Redistributions of source code must retain the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 2. Redistributions in binary form must reproduce the above copyright
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * notice, this list of conditions and the following disclaimer in
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * the documentation and/or other materials provided with the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * distribution.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * 3. The end-user documentation included with the redistribution,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * if any, must include the following acknowledgment:
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * "This product includes software developed by the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Apache Software Foundation (http://www.apache.org/)."
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * Alternately, this acknowledgment may appear in the software itself,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * if and wherever such third-party acknowledgments normally appear.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * 4. The names "Apache" and "Apache Software Foundation" must
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * not be used to endorse or promote products derived from this
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen * software without prior written permission. For written
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * permission, please contact apache@apache.org.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * 5. Products derived from this software may not be called "Apache",
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem * nor may "Apache" appear in their name, without prior written
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem * permission of the Apache Software Foundation.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * SUCH DAMAGE.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * ====================================================================
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * This software consists of voluntary contributions made by many
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * individuals on behalf of the Apache Software Foundation. For more
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * information on the Apache Software Foundation, please see
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Portions of this software are based upon public domain software
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * originally written at the National Center for Supercomputing Applications,
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * University of Illinois, Urbana-Champaign.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniakextern "C" {
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * httpd.h: header for simple (ha! not anymore) http daemon
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* XXX - We need to push more stuff to other .h files, or even .c files, to
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * make this file smaller
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * @package HTTP Daemon routines
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Headers in which EVERYONE has an interest... */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* ----------------------------- config dir ------------------------------ */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Define this to be the default server home dir. Most things later in this
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * file with a relative pathname will have this added.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Set default for OS/2 file system */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Set default for Windows file system */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Set the default for BeOS */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* HTTPD_ROOT */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * --------- You shouldn't have to edit anything below this line ----------
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Any modifications to any defaults not defined above should be done in the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * respective config. file.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Default location of documents. Can be overridden by the DocumentRoot
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * directive.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Set default for OS/2 file system */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* DOCUMENT_LOCATION */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Max. number of dynamically loaded modules */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Default administrator's address */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The target name of the installed Apache */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* --------- Default user name and group name ----------------------------- */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* --- These may be specified as numbers by placing a # before a number --- */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The name of the log files */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* DEFAULT_XFERLOG */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* DEFAULT_ERRORLOG */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Define this to be what your per-directory security files are called */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Set default for OS/2 file system */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* DEFAULT_ACCESS_FNAME */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The name of the server config file */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Whether we should enable rfc1413 identity checking */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The default path for CGI scripts if none is currently set */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The path to the suExec wrapper, can be overridden in Configuration */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The timeout for waiting for messages */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The timeout for waiting for keepalive timeout until next request */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The number of requests to entertain per connection */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The maximum length of the queue of pending connections, as defined
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * by listen(2). Under some systems, it should be increased if you
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * are experiencing a heavy TCP SYN flood attack.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * It defaults to 511 instead of 512 because some systems store it
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * 255 when truncated.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Limits on the size of various request items. These limits primarily
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * exist to prevent simple denial-of-service attacks on a server based
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * on misuse of the protocol. The recommended values will depend on the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * nature of the server resources -- CGI scripts and database backends
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * might require large values, but most servers could get by with much
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * smaller limits than we use below. The request message body size can
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * be limited by the per-dir config directive LimitRequestBody.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * These two limits can be lowered (but not raised) by the server config
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * directives LimitRequestLine and LimitRequestFieldsize, respectively.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * the server config directive LimitRequestFields.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* default limit on bytes in any one header field */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* default limit on number of request header fields */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * The default default character set name to add if AddDefaultCharset is
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * enabled. Overridden with AddDefaultCharsetName.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * The below defines the base string of the Server: header. Additional
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * tokens can be added via the ap_add_version_component() API call.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * The tokens are listed in order of their significance for identifying the
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * application.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * "Product tokens should be short and to the point -- use of them for
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * advertizing or other non-essential information is explicitly forbidden."
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Example: "Apache/1.1.0 MrWidget/0.1-alpha"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Define this to 1 if you want fancy indexing, 0 otherwise */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#endif /* CORE_PRIVATE */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define AP_SERVER_BASEVENDOR "Apache Software Foundation"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* ------------------ stuff that modules are allowed to look at ----------- */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Define this to be what your HTML directory content files are called */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* Define this to be what type you'd like returned for files with unknown */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* suffixes. MUST be all lower case. */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* The name of the MIME types file */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * Define the HTML doctype strings centrally.
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "DTD HTML 2.0//EN\">\n"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "DTD HTML 3.2 Final//EN\">\n"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "DTD HTML 4.0//EN\"\n" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "DTD HTML 4.0 Transitional//EN\"\n" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "DTD HTML 4.0 Frameset//EN\"\n" \
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* -- Internal representation for a HTTP protocol number, e.g., HTTP/1.1 -- */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak/* -------------- Port number for server running standalone --------------- */
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak#define ap_is_default_port(port,r) ((port) == ap_default_port(r))
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh/* The default string lengths */
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh/* The size of the server's internal read-write buffers */
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * Special Apache error codes. These are basically used
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * in http_main.c so we can keep track of various errors.
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * APEXIT_OK:
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * A normal exit
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh * APEXIT_INIT:
5effc8b39fae5cd169d17f342bfc265705840014rbowen * A fatal error arising during the server's init sequence
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen * APEXIT_CHILDINIT:
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd * The child died during it's init sequence
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd * APEXIT_CHILDFATAL:
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd * A fatal error, resulting in the whole server aborting.
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd * If a child exits with this error, the parent process
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak * considers this a server-wide fatal error and aborts.
/* 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
#define M_GET 0
#ifdef CHARSET_EBCDIC
#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
#ifndef CHARSET_EBCDIC
#define REQUEST_NO_BODY 0
struct htaccess_result {
const char *dir;
int override;
void *htaccess;
#include "util_uri.h"
#ifdef APACHE_XLATE
#include "apr_xlate.h"
struct ap_rr_xlate {
int to_net_sb;
struct process_rec {
int argc;
char *const *argv;
const char *short_name;
struct request_rec {
/** If this is a sub_request (see request.h) pointer back to the
* 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 sent_bodyct;
long bytes_sent;
int chunked;
int byterange;
/** multipart/byteranges boundary */
char *boundary;
const char *range;
long clength;
long remaining;
long read_length;
int read_body;
int read_chunked;
unsigned expecting_100;
const char *content_encoding;
const char *content_language;
char *vlist_validator;
char *user;
char *ap_auth_type;
int no_cache;
int no_local_copy;
char *unparsed_uri;
char *uri;
char *filename;
char *path_info;
char *args;
void *per_dir_config;
void *request_config;
#ifdef APACHE_XLATE
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 *conn_config;
struct server_addr_rec {
unsigned short host_port;
char *virthost;
struct server_rec {
const char *defn_name;
unsigned defn_line_number;
char *server_admin;
char *server_hostname;
unsigned short port;
char *error_fname;
int loglevel;
int is_virtual;
void *module_config;
void *lookup_defaults;
int timeout;
int keep_alive_timeout;
int keep_alive_max;
int keep_alive;
const char *path;
int pathlen;
int limit_req_line;
int limit_req_fieldsize;
int limit_req_fields;
#ifndef API_EXPORT
#ifndef API_EXPORT_NONSTD
#ifndef MODULE_VAR_EXPORT
#define MODULE_VAR_EXPORT
#ifndef API_VAR_EXPORT
#define API_VAR_EXPORT
#ifndef CORE_EXPORT
#ifndef CORE_EXPORT_NONSTD
#ifndef ap_private_extern
#define ap_private_extern
* Examine a field value (such as a media-/content-type) string and return
* @deffunc char *ap_construct_server(apr_pool_t *p, const char *hostname, unsiged port, const request_rec *r)
#include "pcreposix.h"
int cflags);
#ifdef _OSD_POSIX
#ifdef DEBUG_SIGSTOP
extern int raise_sigstop_flags;
#define RAISE_SIGSTOP(x) do { \
#define RAISE_SIGSTOP(x)
#ifdef strtoul
#ifdef AP_DEBUG
char *ap_strchr(char *s, int c);
const char *ap_strchr_c(const char *s, int c);
char *ap_strrchr(char *s, int c);
const char *ap_strrchr_c(const char *s, int c);
char *ap_strstr(char *s, char *c);
const char *ap_strstr_c(const char *s, const char *c);
#ifdef __cplusplus