]> granicus.if.org Git - apache/blobdiff - include/httpd.h
Create wrapper API for apr_random;
[apache] / include / httpd.h
index e66961c747beaf797b64d8e04beeb486575092cc..d009e68d31b7e27f3910ab5fd72b65ad841b4424 100644 (file)
@@ -1,9 +1,9 @@
-/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * limitations under the License.
  */
 
-#ifndef APACHE_HTTPD_H
-#define APACHE_HTTPD_H
-
 /**
  * @file httpd.h
  * @brief HTTP Daemon routines
+ *
+ * @defgroup APACHE Apache
+ *
+ * Top level group of which all other groups are a member
+ * @{
+ *
+ * @defgroup APACHE_MODS Apache Modules
+ *           Top level group for Apache Modules
+ * @defgroup APACHE_OS Operating System Specific
+ * @defgroup APACHE_CORE Apache Core
+ * @{
+ * @defgroup APACHE_CORE_DAEMON HTTP Daemon Routine
+ * @{
  */
 
+#ifndef APACHE_HTTPD_H
+#define APACHE_HTTPD_H
+
 /* XXX - We need to push more stuff to other .h files, or even .c files, to
  * make this file smaller
  */
@@ -40,6 +53,7 @@
 #include "apr_network_io.h"
 #include "apr_buckets.h"
 #include "apr_poll.h"
+#include "apr_thread_proc.h"
 
 #include "os.h"
 
 extern "C" {
 #endif
 
-#ifdef CORE_PRIVATE
-
 /* ----------------------------- config dir ------------------------------ */
 
-/* Define this to be the default server home dir. Most things later in this
+/** Define this to be the default server home dir. Most things later in this
  * file with a relative pathname will have this added.
  */
 #ifndef HTTPD_ROOT
 #ifdef OS2
-/* Set default for OS/2 file system */
+/** Set default for OS/2 file system */
 #define HTTPD_ROOT "/os2httpd"
 #elif defined(WIN32)
-/* Set default for Windows file system */
+/** Set default for Windows file system */
 #define HTTPD_ROOT "/apache"
-#elif defined (BEOS)
-/* Set the default for BeOS */
-#define HTTPD_ROOT "/boot/home/apache"
 #elif defined (NETWARE)
-/* Set the default for NetWare */
+/** Set the default for NetWare */
 #define HTTPD_ROOT "/apache"
 #else
+/** Set for all other OSs */
 #define HTTPD_ROOT "/usr/local/apache"
 #endif
 #endif /* HTTPD_ROOT */
@@ -88,7 +98,8 @@ extern "C" {
  *
  */
 
-/* Default location of documents.  Can be overridden by the DocumentRoot
+/** 
+ * Default location of documents.  Can be overridden by the DocumentRoot
  * directive.
  */
 #ifndef DOCUMENT_LOCATION
@@ -96,19 +107,20 @@ extern "C" {
 /* Set default for OS/2 file system */
 #define DOCUMENT_LOCATION  HTTPD_ROOT "/docs"
 #else
+/* Set default for non OS/2 file system */
 #define DOCUMENT_LOCATION  HTTPD_ROOT "/htdocs"
 #endif
 #endif /* DOCUMENT_LOCATION */
 
-/* Maximum number of dynamically loaded modules */
+/** Maximum number of dynamically loaded modules */
 #ifndef DYNAMIC_MODULE_LIMIT
-#define DYNAMIC_MODULE_LIMIT 128
+#define DYNAMIC_MODULE_LIMIT 256
 #endif
 
-/* Default administrator's address */
+/** Default administrator's address */
 #define DEFAULT_ADMIN "[no address given]"
 
-/* The name of the log files */
+/** The name of the log files */
 #ifndef DEFAULT_ERRORLOG
 #if defined(OS2) || defined(WIN32)
 #define DEFAULT_ERRORLOG "logs/error.log"
@@ -117,7 +129,7 @@ extern "C" {
 #endif
 #endif /* DEFAULT_ERRORLOG */
 
-/* Define this to be what your per-directory security files are called */
+/** Define this to be what your per-directory security files are called */
 #ifndef DEFAULT_ACCESS_FNAME
 #ifdef OS2
 /* Set default for OS/2 file system */
@@ -127,37 +139,38 @@ extern "C" {
 #endif
 #endif /* DEFAULT_ACCESS_FNAME */
 
-/* The name of the server config file */
+/** The name of the server config file */
 #ifndef SERVER_CONFIG_FILE
 #define SERVER_CONFIG_FILE "conf/httpd.conf"
 #endif
 
-/* The default path for CGI scripts if none is currently set */
+/** The default path for CGI scripts if none is currently set */
 #ifndef DEFAULT_PATH
 #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
 #endif
 
-/* The path to the suExec wrapper, can be overridden in Configuration */
+/** The path to the suExec wrapper, can be overridden in Configuration */
 #ifndef SUEXEC_BIN
 #define SUEXEC_BIN  HTTPD_ROOT "/bin/suexec"
 #endif
 
-/* The timeout for waiting for messages */
+/** The timeout for waiting for messages */
 #ifndef DEFAULT_TIMEOUT
 #define DEFAULT_TIMEOUT 300 
 #endif
 
-/* The timeout for waiting for keepalive timeout until next request */
+/** The timeout for waiting for keepalive timeout until next request */
 #ifndef DEFAULT_KEEPALIVE_TIMEOUT
-#define DEFAULT_KEEPALIVE_TIMEOUT 15
+#define DEFAULT_KEEPALIVE_TIMEOUT 5
 #endif
 
-/* The number of requests to entertain per connection */
+/** The number of requests to entertain per connection */
 #ifndef DEFAULT_KEEPALIVE
 #define DEFAULT_KEEPALIVE 100
 #endif
 
-/* Limits on the size of various request items.  These limits primarily
+/*
+ * Limits on the size of various request items.  These limits primarily
  * exist to prevent simple denial-of-service attacks on a server based
  * on misuse of the protocol.  The recommended values will depend on the
  * nature of the server resources -- CGI scripts and database backends
@@ -167,22 +180,25 @@ extern "C" {
  *
  * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
  * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
- * These two limits can be lowered (but not raised) by the server config
+ * These two limits can be lowered or raised by the server config
  * directives LimitRequestLine and LimitRequestFieldsize, respectively.
  *
  * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
  * the server config directive LimitRequestFields.
  */
+
+/** default limit on bytes in Request-Line (Method+URI+HTTP-version) */
 #ifndef DEFAULT_LIMIT_REQUEST_LINE
 #define DEFAULT_LIMIT_REQUEST_LINE 8190
-#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */
+#endif 
+/** default limit on bytes in any one header field  */
 #ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
 #define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
-#endif /* default limit on bytes in any one header field  */
+#endif 
+/** default limit on number of request header fields */
 #ifndef DEFAULT_LIMIT_REQUEST_FIELDS
 #define DEFAULT_LIMIT_REQUEST_FIELDS 100
-#endif /* default limit on number of request header fields */
-
+#endif 
 
 /**
  * The default default character set name to add if AddDefaultCharset is
@@ -190,8 +206,6 @@ extern "C" {
  */
 #define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
 
-#endif /* CORE_PRIVATE */
-
 /** default HTTP Server protocol */
 #define AP_SERVER_PROTOCOL "HTTP/1.1"
 
@@ -203,16 +217,6 @@ extern "C" {
 #define AP_DEFAULT_INDEX "index.html"
 #endif
 
-
-/** 
- * Define this to be what type you'd like returned for files with unknown 
- * suffixes.  
- * @warning MUST be all lower case. 
- */
-#ifndef DEFAULT_CONTENT_TYPE
-#define DEFAULT_CONTENT_TYPE "text/plain"
-#endif
-
 /** The name of the MIME types file */
 #ifndef AP_TYPES_CONFIG_FILE
 #define AP_TYPES_CONFIG_FILE "conf/mime.types"
@@ -256,7 +260,6 @@ extern "C" {
                            "xhtml1-frameset.dtd\">"
 
 /** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
-
 #define HTTP_VERSION(major,minor) (1000*(major)+(minor))
 /** Major part of HTTP protocol */
 #define HTTP_VERSION_MAJOR(number) ((number)/1000)
@@ -287,8 +290,10 @@ extern "C" {
  */
 #define ap_http_scheme(r)      ap_run_http_scheme(r)
 
-/** The default string lengths */
+/** The default string length */
 #define MAX_STRING_LEN HUGE_STRING_LEN
+
+/** The length of a Huge string */
 #define HUGE_STRING_LEN 8192
 
 /** The size of the server's internal read-write buffers */
@@ -364,14 +369,15 @@ extern "C" {
 
 /**
  * @internal
- * modules should not used functions marked AP_CORE_DECLARE
+ * modules should not use functions marked AP_CORE_DECLARE
  */
 #ifndef AP_CORE_DECLARE
 # define AP_CORE_DECLARE       AP_DECLARE
 #endif
+
 /**
  * @internal
- * modules should not used functions marked AP_CORE_DECLARE_NONSTD
+ * modules should not use functions marked AP_CORE_DECLARE_NONSTD
  */
 
 #ifndef AP_CORE_DECLARE_NONSTD
@@ -379,7 +385,7 @@ extern "C" {
 #endif
 
 /** 
- * The numeric version information is broken out into fields within this 
+ * @brief The numeric version information is broken out into fields within this 
  * structure. 
  */
 typedef struct {
@@ -398,13 +404,24 @@ typedef struct {
 AP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
 
 /**
- * Get the server version string
- * @return The server version string
+ * Get the server banner in a form suitable for sending over the
+ * network, with the level of information controlled by the
+ * ServerTokens directive.
+ * @return The server banner
  */
-AP_DECLARE(const char *) ap_get_server_version(void);
+AP_DECLARE(const char *) ap_get_server_banner(void);
 
 /**
- * Add a component to the version string
+ * Get the server description in a form suitable for local displays,
+ * status reports, or logging.  This includes the detailed server
+ * version and information about some modules.  It is not affected
+ * by the ServerTokens directive.
+ * @return The server description
+ */
+AP_DECLARE(const char *) ap_get_server_description(void);
+
+/**
+ * Add a component to the server description and banner strings
  * @param pconf The pool to allocate the component from
  * @param component The string to add
  */
@@ -416,12 +433,26 @@ AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *compone
  */
 AP_DECLARE(const char *) ap_get_server_built(void);
 
+/* non-HTTP status codes returned by hooks */
+
+#define OK 0                   /**< Module has handled this stage. */
 #define DECLINED -1            /**< Module declines to handle */
 #define DONE -2                        /**< Module has served the response completely 
                                 *  - it's safe to die() with no more output
                                 */
-#define OK 0                   /**< Module has handled this stage. */
+#define SUSPENDED -3 /**< Module will handle the remainder of the request. 
+                      * The core will never invoke the request again, */
 
+/** Returned by the bottom-most filter if no data was written.
+ *  @see ap_pass_brigade(). */
+#define AP_NOBODY_WROTE         -100
+/** Returned by the bottom-most filter if no data was read.
+ *  @see ap_get_brigade(). */
+#define AP_NOBODY_READ          -101
+/** Returned by any filter if the filter chain encounters an error
+ *  and has already dealt with the error response.
+ */
+#define AP_FILTER_ERROR         -102
 
 /**
  * @defgroup HTTP_Status HTTP Status Codes
@@ -496,6 +527,8 @@ AP_DECLARE(const char *) ap_get_server_built(void);
 #define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
 /** is the status code a server error  */
 #define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
+/** is the status code a (potentially) valid response code?  */
+#define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
 
 /** should the status code drop the connection */
 #define ap_status_drops_connection(x) \
@@ -508,33 +541,37 @@ AP_DECLARE(const char *) ap_get_server_built(void);
                                     ((x) == HTTP_SERVICE_UNAVAILABLE) || \
                                    ((x) == HTTP_NOT_IMPLEMENTED))
 /** @} */
+
 /**
  * @defgroup Methods List of Methods recognized by the server
+ * @ingroup APACHE_CORE_DAEMON
  * @{
- */
-/**
- * Methods recognized (but not necessarily handled) by the server.
+ *
+ * @brief Methods recognized (but not necessarily handled) by the server.
+ *
  * These constants are used in bit shifting masks of size int, so it is
  * unsafe to have more methods than bits in an int.  HEAD == M_GET.
  * This list must be tracked by the list in http_protocol.c in routine
  * ap_method_name_of().
+ *
  */
-#define M_GET                   0       /* RFC 2616: HTTP */
+
+#define M_GET                   0       /** RFC 2616: HTTP */
 #define M_PUT                   1       /*  :             */
 #define M_POST                  2
 #define M_DELETE                3
 #define M_CONNECT               4
 #define M_OPTIONS               5
-#define M_TRACE                 6       /* RFC 2616: HTTP */
-#define M_PATCH                 7       /* no rfc(!)  ### remove this one? */
-#define M_PROPFIND              8       /* RFC 2518: WebDAV */
+#define M_TRACE                 6       /** RFC 2616: HTTP */
+#define M_PATCH                 7       /** no rfc(!)  ### remove this one? */
+#define M_PROPFIND              8       /** RFC 2518: WebDAV */
 #define M_PROPPATCH             9       /*  :               */
 #define M_MKCOL                 10
 #define M_COPY                  11
 #define M_MOVE                  12
 #define M_LOCK                  13
-#define M_UNLOCK                14      /* RFC 2518: WebDAV */
-#define M_VERSION_CONTROL       15      /* RFC 3253: WebDAV Versioning */
+#define M_UNLOCK                14      /** RFC 2518: WebDAV */
+#define M_VERSION_CONTROL       15      /** RFC 3253: WebDAV Versioning */
 #define M_CHECKOUT              16      /*  :                          */
 #define M_UNCHECKOUT            17
 #define M_CHECKIN               18
@@ -545,7 +582,7 @@ AP_DECLARE(const char *) ap_get_server_built(void);
 #define M_MKACTIVITY            23
 #define M_BASELINE_CONTROL      24
 #define M_MERGE                 25
-#define M_INVALID               26      /* RFC 3253: WebDAV Versioning */
+#define M_INVALID               26      /** RFC 3253: WebDAV Versioning */
 
 /**
  * METHODS needs to be equal to the number of bits
@@ -560,18 +597,23 @@ AP_DECLARE(const char *) ap_get_server_built(void);
 /** @} */
 
 
+/** @see ap_method_list_t */
+typedef struct ap_method_list_t ap_method_list_t;
+
 /**
- * Structure for handling HTTP methods.  Methods known to the server are
- * accessed via a bitmask shortcut; extension methods are handled by
- * an array.
+ * @struct ap_method_list_t
+ * @brief  Structure for handling HTTP methods.  
+ *
+ * Methods known to the server are accessed via a bitmask shortcut; 
+ * extension methods are handled by an array.
  */
-typedef struct ap_method_list_t ap_method_list_t;
 struct ap_method_list_t {
-    /* The bitmask used for known methods */
+    /** The bitmask used for known methods */
     apr_int64_t method_mask;
-    /* the array used for extension methods */
+    /** the array used for extension methods */
     apr_array_header_t *method_list;
 };
+
 /**
  * @defgroup module_magic Module Magic mime types
  * @{
@@ -605,6 +647,8 @@ struct ap_method_list_t {
 #define LF '\n'
 #define CRLF "\r\n"
 #endif /* APR_CHARSET_EBCDIC */                                   
+/** Useful for common code with either platform charset. */
+#define CRLF_ASCII "\015\012"
 
 /**
  * @defgroup values_request_rec_body Possible values for request_rec.read_body 
@@ -618,10 +662,11 @@ struct ap_method_list_t {
 #define REQUEST_CHUNKED_ERROR    1
 /** If chunked, remove the chunks for me. */
 #define REQUEST_CHUNKED_DECHUNK  2
-/** @} */
+/** @} // values_request_rec_body */
 
 /**
  * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info 
+ * @ingroup APACHE_CORE_DAEMON
  * @{
  * Possible values for request_rec.used_path_info:
  */
@@ -632,7 +677,9 @@ struct ap_method_list_t {
 #define AP_REQ_REJECT_PATH_INFO    1
 /** Module may chose to use the given path_info */
 #define AP_REQ_DEFAULT_PATH_INFO   2
-/** @} */
+
+/** @} // values_request_rec_used_path_info */
+
 
 /*
  * Things which may vary per file-lookup WITHIN a request ---
@@ -649,7 +696,7 @@ struct ap_method_list_t {
  */
 
 /**
- * This represents the result of calling htaccess; these are cached for
+ * @brief This represents the result of calling htaccess; these are cached for
  * each request.
  */
 struct htaccess_result {
@@ -659,6 +706,8 @@ struct htaccess_result {
     int override;
     /** the override options allowed for the .htaccess file */
     int override_opts;
+    /** Table of allowed directives for override */
+    apr_table_t *override_list;
     /** the configuration directives */
     struct ap_conf_vector_t *htaccess;
     /** the next one, or NULL if no more; N.B. never change this */
@@ -688,21 +737,25 @@ typedef struct conn_state_t conn_state_t;
 /* This comes after we have defined the request_rec type */
 #include "apr_uri.h"
 
-/** A structure that represents one process */
+/** 
+ * @brief A structure that represents one process 
+ */
 struct process_rec {
     /** Global pool. Cleared upon normal exit */
     apr_pool_t *pool;
     /** Configuration pool. Cleared upon restart */
     apr_pool_t *pconf;
-    /** Number of command line arguments passed to the program */
-    int argc;
-    /** The command line arguments */
-    const char * const *argv;
     /** The program name used to execute the program */
     const char *short_name;
+    /** The command line arguments */
+    const char * const *argv;
+    /** Number of command line arguments passed to the program */
+    int argc;
 };
 
-/** A structure that represents the current request */
+/** 
+ * @brief A structure that represents the current request 
+ */
 struct request_rec {
     /** The pool associated with the request */
     apr_pool_t *pool;
@@ -734,10 +787,10 @@ struct request_rec {
     int proxyreq;
     /** HEAD request, as opposed to GET */
     int header_only;
-    /** Protocol string, as given to us, or HTTP/0.9 */
-    char *protocol;
     /** Protocol version number of protocol; 1.1 = 1001 */
     int proto_num;
+    /** Protocol string, as given to us, or HTTP/0.9 */
+    char *protocol;
     /** Host, as set by full URI or Host: */
     const char *hostname;
 
@@ -753,10 +806,10 @@ struct request_rec {
      * look, but don't touch.
      */
 
-    /** Request method (eg. GET, HEAD, POST, etc.) */
-    const char *method;
     /** M_GET, M_POST, etc. */
     int method_number;
+    /** Request method (eg. GET, HEAD, POST, etc.) */
+    const char *method;
 
     /**
      *  'allowed' is a bitvector of the allowed methods.
@@ -793,17 +846,13 @@ struct request_rec {
 
     /* HTTP/1.1 connection-level features */
 
-    /** sending chunked transfer-coding */
-    int chunked;
     /** The Range: header */
     const char *range;
     /** The "real" content length */
     apr_off_t clength;
+    /** sending chunked transfer-coding */
+    int chunked;
 
-    /** Remaining bytes left to read from the request body */
-    apr_off_t remaining;
-    /** Number of bytes that have been read  from the request body */
-    apr_off_t read_length;
     /** Method for reading the request body
      * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY,
      *  REQUEST_CHUNKED_DECHUNK, etc...) */
@@ -812,6 +861,16 @@ struct request_rec {
     int read_chunked;
     /** is client waiting for a 100 response? */
     unsigned expecting_100;
+    /** The optional kept body of the request. */
+    apr_bucket_brigade *kept_body;
+    /** For ap_body_to_table(): parsed body */
+    /* XXX: ap_body_to_table has been removed. Remove body_table too or
+     * XXX: keep it to reintroduce ap_body_to_table without major bump? */
+    apr_table_t *body_table;
+    /** Remaining bytes left to read from the request body */
+    apr_off_t remaining;
+    /** Number of bytes that have been read  from the request body */
+    apr_off_t read_length;
 
     /* MIME header environments, in and out.  Also, an array containing
      * environment variables to be passed to subprocesses, so people can
@@ -859,18 +918,13 @@ struct request_rec {
     /** If an authentication check was made, this gets set to the auth type. */
     char *ap_auth_type;
 
-    /** This response can not be cached */
-    int no_cache;
-    /** There is no local copy of this response */
-    int no_local_copy;
-
     /* What object is being requested (either directly, or via include
      * or content-negotiation mapping).
      */
 
     /** The URI without any parsing performed */
     char *unparsed_uri;        
-    /** The path portion of the URI */
+    /** The path portion of the URI, or "/" if no path provided */
     char *uri;
     /** The filename on disk corresponding to this response */
     char *filename;
@@ -881,10 +935,6 @@ struct request_rec {
     char *path_info;
     /** The QUERY_ARGS extracted from this request */
     char *args;        
-    /**  finfo.protection (st_mode) set to zero if no such file */
-    apr_finfo_t finfo;
-    /** A struct containing the components of URI */
-    apr_uri_t parsed_uri;
 
     /**
      * Flag for the handler to accept or reject path_info on 
@@ -896,6 +946,9 @@ struct request_rec {
      */
     int used_path_info;
 
+    /** A flag to determine if the eos bucket has been sent yet */
+    int eos_sent;
+
     /* Various other config info which may change with .htaccess files
      * These are config vectors, with one void* pointer for each module
      * (the thing pointed to being the module's business).
@@ -906,6 +959,16 @@ struct request_rec {
     /** Notes on *this* request */
     struct ap_conf_vector_t *request_config;
 
+    /** Optional request log level configuration. Will usually point
+     *  to a server or per_dir config, i.e. must be copied before
+     *  modifying */
+    const struct ap_logconf *log;
+
+    /** Id to identify request in access and error log. Set when the first
+     *  error log entry for this request is generated.
+     */
+    const char *log_id;
+
     /**
      * A linked list of the .htaccess configuration directives
      * accessed by this request.
@@ -926,14 +989,20 @@ struct request_rec {
      *  request */
     struct ap_filter_t *proto_input_filters;
 
-    /** A flag to determine if the eos bucket has been sent yet */
-    int eos_sent;
+    /** This response can not be cached */
+    int no_cache;
+    /** There is no local copy of this response */
+    int no_local_copy;
 
-/* Things placed at the end of the record to avoid breaking binary
- * compatibility.  It would be nice to remember to reorder the entire
- * record to improve 64bit alignment the next time we need to break
- * binary compatibility for some other reason.
- */
+    /** Mutex protect callbacks registered with ap_mpm_register_timed_callback
+     * from being run before the original handler finishes running
+     */
+    apr_thread_mutex_t *invoke_mtx;
+
+    /** A struct containing the components of URI */
+    apr_uri_t parsed_uri;
+    /**  finfo.protection (st_mode) set to zero if no such file */
+    apr_finfo_t finfo;
 };
 
 /**
@@ -953,13 +1022,18 @@ struct request_rec {
 
 /* @} */
 
+/**
+ * @brief Enumeration of connection keepalive options
+ */
 typedef enum {
     AP_CONN_UNKNOWN,
     AP_CONN_CLOSE,
     AP_CONN_KEEPALIVE
 } ap_conn_keepalive_e;
 
-/** Structure to store things which are per connection */
+/** 
+ * @brief Structure to store things which are per connection 
+ */
 struct conn_rec {
     /** Pool associated with this connection */
     apr_pool_t *pool;
@@ -984,19 +1058,6 @@ struct conn_rec {
      *  get_remote_logname() */
     char *remote_logname;
 
-    /** Are we still talking? */
-    unsigned aborted:1;
-
-    /** Are we going to keep the connection alive for another request?
-     * @see ap_conn_keepalive_e */
-    ap_conn_keepalive_e keepalive;
-
-    /** have we done double-reverse DNS? -1 yes/failure, 0 not yet, 
-     *  1 yes/success */
-    signed int double_reverse:2;
-
-    /** How many times have we used it? */
-    int keepalives;
     /** server IP address */
     char *local_ip;
     /** used for ap_get_server_name when UseCanonicalName is set to DNS
@@ -1023,22 +1084,80 @@ struct conn_rec {
     conn_state_t *cs;
     /** Is there data pending in the input filters? */ 
     int data_in_input_filters;
+    /** Is there data pending in the output filters? */
+    int data_in_output_filters;
+
+    /** Are there any filters that clogg/buffer the input stream, breaking
+     *  the event mpm.
+     */
+    unsigned int clogging_input_filters:1;
+    
+    /** have we done double-reverse DNS? -1 yes/failure, 0 not yet, 
+     *  1 yes/success */
+    signed int double_reverse:2;
+
+    /** Are we still talking? */
+    unsigned aborted;
+
+    /** Are we going to keep the connection alive for another request?
+     * @see ap_conn_keepalive_e */
+    ap_conn_keepalive_e keepalive;
+
+    /** How many times have we used it? */
+    int keepalives;
+
+    /** Optional connection log level configuration. May point to a server or
+     *  per_dir config, i.e. must be copied before modifying */
+    const struct ap_logconf *log;
+
+    /** Id to identify this connection in error log. Set when the first
+     *  error log entry for this connection is generated.
+     */
+    const char *log_id;
+
+
+    /** This points to the current thread being used to process this request,
+     * over the lifetime of a request, the value may change. Users of the connection
+     * record should not rely upon it staying the same between calls that invole
+     * the MPM.
+     */
+#if APR_HAS_THREADS
+    apr_thread_t *current_thread;
+#endif
 };
 
+/** 
+ * Enumeration of connection states 
+ */
 typedef enum  {
     CONN_STATE_CHECK_REQUEST_LINE_READABLE,
     CONN_STATE_READ_REQUEST_LINE,
+    CONN_STATE_HANDLER,
+    CONN_STATE_WRITE_COMPLETION,
+    CONN_STATE_SUSPENDED,
     CONN_STATE_LINGER,
+    CONN_STATE_LINGER_NORMAL,
+    CONN_STATE_LINGER_SHORT
 } conn_state_e;
 
+/** 
+ * @brief A structure to contain connection state information 
+ */
 struct conn_state_t {
-    APR_RING_ENTRY(conn_state_t) timeout_list; 
-    apr_time_t expiration_time; 
-    conn_state_e state;
+    /** APR_RING of expiration timeouts */
+    APR_RING_ENTRY(conn_state_t) timeout_list;
+    /** the expiration time of the next keepalive timeout */
+    apr_time_t expiration_time;
+    /** connection record this struct refers to */
     conn_rec *c;
+    /** memory pool to allocate from */
     apr_pool_t *p;
+    /** bucket allocator */
     apr_bucket_alloc_t *bucket_alloc;
+    /** poll file descriptor information */
     apr_pollfd_t pfd;
+    /** Current state of the connection */
+    conn_state_e state;
 };
 
 /* Per-vhost config... */
@@ -1050,59 +1169,77 @@ struct conn_state_t {
 #define DEFAULT_VHOST_ADDR 0xfffffffful
 
 
-/** A structure to be used for Per-vhost config */
+/**
+ * @struct server_addr_rec
+ * @brief  A structure to be used for Per-vhost config 
+ */
 typedef struct server_addr_rec server_addr_rec;
 struct server_addr_rec {
     /** The next server in the list */
     server_addr_rec *next;
+    /** The name given in "<VirtualHost>" */
+    char *virthost;
     /** The bound address, for this server */
     apr_sockaddr_t *host_addr;
     /** The bound port, for this server */
     apr_port_t host_port;
-    /** The name given in <VirtualHost> */
-    char *virthost;
 };
 
-/** A structure to store information for each virtual server */
+struct ap_logconf {
+    /** The per-module log levels */
+    signed char *module_levels;
+
+    /** The log level for this server */
+    int level;
+};
+/** 
+ * @brief A structure to store information for each virtual server 
+ */
 struct server_rec {
     /** The process this server is running in */
     process_rec *process;
     /** The next server in the list */
     server_rec *next;
 
-    /** The name of the server */
-    const char *defn_name;
-    /** The line of the config file that the server was defined on */
-    unsigned defn_line_number;
-
-    /* Contact information */
-
-    /** The admin's contact information */
-    char *server_admin;
-    /** The server hostname */
-    char *server_hostname;
-    /** for redirects, etc. */
-    apr_port_t port;
-
     /* Log files --- note that transfer log is now in the modules... */
 
     /** The name of the error log */
     char *error_fname;
     /** A file descriptor that references the error log */
     apr_file_t *error_log;
-    /** The log level for this server */
-    int loglevel;
+    /** The log level configuration */
+    struct ap_logconf log;
 
     /* Module-specific configuration for server, and defaults... */
 
-    /** true if this is the virtual server */
-    int is_virtual;
     /** Config vector containing pointers to modules' per-server config 
      *  structures. */
     struct ap_conf_vector_t *module_config; 
     /** MIME type info, etc., before we start checking per-directory info */
     struct ap_conf_vector_t *lookup_defaults;
 
+    /** The name of the server */
+    const char *defn_name;
+    /** The line of the config file that the server was defined on */
+    unsigned defn_line_number;
+    /** true if this is the virtual server */
+    char is_virtual;
+
+
+    /* Information for redirects */
+
+    /** for redirects, etc. */
+    apr_port_t port;
+    /** The server request scheme for redirect responses */
+    const char *server_scheme;
+
+    /* Contact information */
+
+    /** The admin's contact information */
+    char *server_admin;
+    /** The server hostname */
+    char *server_hostname;
+
     /* Transaction handling */
 
     /** I haven't got a clue */
@@ -1116,33 +1253,39 @@ struct server_rec {
     /** Use persistent connections? */
     int keep_alive;
 
-    /** Pathname for ServerPath */
-    const char *path;
-    /** Length of path */
-    int pathlen;
-
     /** Normal names for ServerAlias servers */
     apr_array_header_t *names;
     /** Wildcarded names for ServerAlias servers */
     apr_array_header_t *wild_names;
 
+    /** Pathname for ServerPath */
+    const char *path;
+    /** Length of path */
+    int pathlen;
+
     /** limit on size of the HTTP request line    */
     int limit_req_line;
     /** limit on size of any request header field */
     int limit_req_fieldsize;
     /** limit on number of request header fields  */
     int limit_req_fields; 
+
+
+    /** Opaque storage location */
+    void *context;
 };
 
 typedef struct core_output_filter_ctx {
-    apr_bucket_brigade *b;
-    apr_pool_t *deferred_write_pool; /* subpool of c->pool used for resources 
-                                      * which may outlive the request
-                                      */
+    apr_bucket_brigade *buffered_bb;
+    apr_bucket_brigade *tmp_flush_bb;
+    apr_pool_t *deferred_write_pool;
+    apr_size_t bytes_in;
+    apr_size_t bytes_written;
 } core_output_filter_ctx_t;
  
 typedef struct core_filter_ctx {
     apr_bucket_brigade *b;
+    apr_bucket_brigade *tmpbb;
 } core_ctx_t;
  
 typedef struct core_net_rec {
@@ -1156,6 +1299,42 @@ typedef struct core_net_rec {
     core_ctx_t *in_ctx;
 } core_net_rec;
 
+/**
+ * Get the context_document_root for a request. This is a generalization of
+ * the document root, which is too limited in the presence of mappers like
+ * mod_userdir and mod_alias. The context_document_root is the directory
+ * on disk that maps to the context_prefix URI prefix.
+ * @param r The request
+ * @note For resources that do not map to the file system or for very complex
+ * mappings, this information may still be wrong.
+ */
+AP_DECLARE(const char *) ap_context_document_root(request_rec *r);
+
+/**
+ * Get the context_prefix for a request. The context_prefix URI prefix
+ * maps to the context_document_root on disk.
+ * @param r The request
+ */
+AP_DECLARE(const char *) ap_context_prefix(request_rec *r);
+
+/** Set context_prefix and context_document_root for a request.
+ * @param r The request
+ * @param prefix the URI prefix, without trailing slash
+ * @param document_root the corresponding directory on disk, without trailing
+ * slash
+ * @note If one of prefix of document_root is NULL, the corrsponding
+ * property will not be changed.
+ */
+AP_DECLARE(void) ap_set_context_info(request_rec *r, const char *prefix,
+                                     const char *document_root);
+
+/** Set per-request document root. This is for mass virtual hosting modules
+ * that want to provide the correct DOCUMENT_ROOT value to scripts.
+ * @param r The request
+ * @param document_root the document root for the request.
+ */
+AP_DECLARE(void) ap_set_document_root(request_rec *r, const char *document_root);
+
 /**
  * Examine a field value (such as a media-/content-type) string and return
  * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
@@ -1187,6 +1366,7 @@ AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int
  * @return A copy of the characters up to the first stop character
  */
 AP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop);
+
 /**
  * Get the characters until the first occurance of a specified character
  * @param p The pool to allocate memory from
@@ -1205,18 +1385,19 @@ AP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop);
  * @return The first word in the line
  */
 AP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line);
+
 /**
  * Get the first word from a given string.  A word is defined as all characters
  * up to the first whitespace.
  * @param p The pool to allocate memory from
  * @param line The string to traverse
  * @return The first word in the line
- * @note The same as ap_getword_white(), except it doesn't use const char **.
+ * @note The same as ap_getword_white(), except it doesn't use const char**
  */
 AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line);
 
 /**
- * Get all characters from the first occurance of @a stop to the first '\0'
+ * Get all characters from the first occurance of @a stop to the first "\0"
  * @param p The pool to allocate memory from
  * @param line The line to traverse
  * @param stop The character to start at
@@ -1225,8 +1406,9 @@ AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line);
  */
 AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line,
                                    char stop);
+
 /**
- * Get all characters from the first occurance of @a stop to the first '\0'
+ * Get all characters from the first occurance of @a stop to the first "\0"
  * @param p The pool to allocate memory from
  * @param line The line to traverse
  * @param stop The character to start at
@@ -1243,6 +1425,7 @@ AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop);
  * @return A copy of the string
  */
 AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line);
+
 /**
  * Get the second word in the string paying attention to quoting
  * @param p The pool to allocate from
@@ -1253,10 +1436,11 @@ AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line);
 AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line);
 
 /**
- * Check a string for any ${ENV} environment variable construct and replace 
- * each them by the value of that environment variable, if it exists. If the 
- * environment value does not exist, leave the ${ENV} construct alone; it 
- * means something else.
+ * Check a string for any config define or environment variable construct
+ * and replace each of them by the value of that variable, if it exists.
+ * The default syntax of the constructs is ${ENV} but can be changed by
+ * setting the define::* config defines. If the variable does not exist,
+ * leave the ${ENV} construct alone but print a warning.
  * @param p The pool to allocate from
  * @param word The string to check
  * @return The string with the replaced environment variables
@@ -1333,18 +1517,28 @@ AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *
  */
 AP_DECLARE(int) ap_is_url(const char *u);
 
+/**
+ * Unescape a string
+ * @param url The string to unescape
+ * @return 0 on success, non-zero otherwise
+ */
+AP_DECLARE(int) ap_unescape_all(char *url);
+
 /**
  * Unescape a URL
  * @param url The url to unescape
  * @return 0 on success, non-zero otherwise
  */
 AP_DECLARE(int) ap_unescape_url(char *url);
+
 /**
  * Unescape a URL, but leaving %2f (slashes) escaped
  * @param url The url to unescape
+ * @param decode_slashes Whether or not slashes should be decoded
  * @return 0 on success, non-zero otherwise
  */
-AP_DECLARE(int) ap_unescape_url_keep2f(char *url);
+AP_DECLARE(int) ap_unescape_url_keep2f(char *url, int decode_slashes);
+
 /**
  * Convert all double slashes to single slashes
  * @param name The string to convert
@@ -1365,6 +1559,15 @@ AP_DECLARE(void) ap_getparents(char *name);
  * @return The converted URL
  */
 AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s);
+
+/**
+ * Escape a path segment, as defined in RFC 1808, to a preallocated buffer.
+ * @param c The preallocated buffer to write to
+ * @param s The path to convert
+ * @return The converted URL (c)
+ */
+AP_DECLARE(char *) ap_escape_path_segment_buffer(char *c, const char *s);
+
 /**
  * convert an OS path to a URL in an OS dependant way.
  * @param p The pool to allocate from
@@ -1374,6 +1577,7 @@ AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s);
  * @return The converted URL
  */
 AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial);
+
 /** @see ap_os_escape_path */
 #define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
 
@@ -1383,7 +1587,15 @@ AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partia
  * @param s The html to escape
  * @return The escaped string
  */
-AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s);
+#define ap_escape_html(p,s) ap_escape_html2(p,s,0)
+/**
+ * Escape an html string
+ * @param p The pool to allocate from
+ * @param s The html to escape
+ * @param toasc Whether to escape all non-ASCII chars to \&\#nnn;
+ * @return The escaped string
+ */
+AP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc);
 
 /**
  * Escape a string for logging
@@ -1397,7 +1609,7 @@ AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str);
  * Escape a string for logging into the error log (without a pool)
  * @param dest The buffer to write to
  * @param source The string to escape
- * @param buflen The buffer size for the escaped string (including \0)
+ * @param buflen The buffer size for the escaped string (including "\0")
  * @return The len of the escaped string (always < maxlen)
  */
 AP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source,
@@ -1413,6 +1625,7 @@ AP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source,
  */
 AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname,
                                    apr_port_t port, const request_rec *r);
+
 /**
  * Escape a shell command
  * @param p The pool to allocate from
@@ -1435,7 +1648,7 @@ AP_DECLARE(int) ap_count_dirs(const char *path);
  * @param d The location to copy to
  * @param s The location to copy from
  * @param n The number of directories to copy
- * @return value is the ever useful pointer to the trailing \0 of d
+ * @return value is the ever useful pointer to the trailing "\0" of d
  * @note on platforms with drive letters, n = 0 returns the "/" root, 
  * whereas n = 1 returns the "d:/" root.  On all other platforms, n = 0
  * returns the empty string.  */
@@ -1458,7 +1671,7 @@ AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s);
  * @param dir The directory name
  * @param f The filename
  * @return A copy of the full path
- * @tip Never consider using this function if you are dealing with filesystem
+ * @note Never consider using this function if you are dealing with filesystem
  * names that need to remain canonical, unless you are merging an apr_dir_read
  * path and returned filename.  Otherwise, the result is not canonical.
  */
@@ -1468,7 +1681,7 @@ AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char
  * Test if the given path has an an absolute path.
  * @param p The pool to allocate from
  * @param dir The directory name
- * @tip The converse is not necessarily true, some OS's (Win32/OS2/Netware) have
+ * @note The converse is not necessarily true, some OS's (Win32/OS2/Netware) have
  * multiple forms of absolute paths.  This only reports if the path is absolute
  * in a canonical sense.
  */
@@ -1490,6 +1703,7 @@ AP_DECLARE(int) ap_is_matchexp(const char *str);
  * @return 1 if the two strings match, 0 otherwise
  */
 AP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected);
+
 /**
  * Determine if a string matches a patterm containing the wildcards '?' or '*',
  * ignoring case
@@ -1528,31 +1742,33 @@ AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded);
 /**
  * Encode a string into memory allocated from a pool in base 64 format
  * @param p The pool to allocate from
- * @param strin The plaintext string
+ * @param string The plaintext string
  * @return The encoded string
  */
 AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string); 
 
-
 /**
- * Compile a regular expression to be used later
+ * Compile a regular expression to be used later. The regex is freed when
+ * the pool is destroyed.
  * @param p The pool to allocate from
  * @param pattern the regular expression to compile
  * @param cflags The bitwise or of one or more of the following:
- *   @li #REG_EXTENDED - Use POSIX extended Regular Expressions
- *   @li #REG_ICASE    - Ignore case
- *   @li #REG_NOSUB    - Support for substring addressing of matches
+ *   @li REG_EXTENDED - Use POSIX extended Regular Expressions
+ *   @li REG_ICASE    - Ignore case
+ *   @li REG_NOSUB    - Support for substring addressing of matches
  *       not required
- *   @li #REG_NEWLINE  - Match-any-character operators don't match new-line
+ *   @li REG_NEWLINE  - Match-any-character operators don't match new-line
  * @return The compiled regular expression
  */
 AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
                                      int cflags);
-    
+
 /**
  * Free the memory associated with a compiled regular expression
  * @param p The pool the regex was allocated from
  * @param reg The regular expression to free
+ * @note This function is only necessary if the regex should be cleaned
+ * up before the pool
  */
 AP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
 
@@ -1566,6 +1782,7 @@ AP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
  * @param source The string that was originally matched to the regex
  * @param nmatch the nmatch returned from ap_pregex
  * @param pmatch the pmatch array returned from ap_pregex
+ * @return The substituted string, or NULL on error
  */
 AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source,
                               size_t nmatch, ap_regmatch_t pmatch[]);
@@ -1583,6 +1800,12 @@ AP_DECLARE(void) ap_content_type_tolower(char *s);
  */
 AP_DECLARE(void) ap_str_tolower(char *s);
 
+/**
+ * convert a string to all uppercase
+ * @param s The string to convert to uppercase 
+ */
+AP_DECLARE(void) ap_str_toupper(char *s);
+
 /**
  * Search a string from left to right for the first occurrence of a 
  * specific character
@@ -1602,13 +1825,108 @@ AP_DECLARE(int) ap_ind(const char *str, char c);       /* Sigh... */
 AP_DECLARE(int) ap_rind(const char *str, char c);
 
 /**
- * Given a string, replace any bare " with \" .
+ * Given a string, replace any bare &quot; with \\&quot; .
  * @param p The pool to allocate memory from
- * @param instring The string to search for "
+ * @param instring The string to search for &quot;
  * @return A copy of the string with escaped quotes 
  */
 AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring);
 
+/**
+ * Given a string, append the PID deliminated by delim.
+ * Usually used to create a pid-appended filepath name
+ * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not
+ * a macro, to avoid unistd.h dependency
+ * @param p The pool to allocate memory from
+ * @param string The string to append the PID to
+ * @param delim The string to use to deliminate the string from the PID
+ * @return A copy of the string with the PID appended 
+ */
+AP_DECLARE(char *) ap_append_pid(apr_pool_t *p, const char *string,
+                                 const char *delim);
+
+/**
+ * Parse a given timeout parameter string into an apr_interval_time_t value.
+ * The unit of the time interval is given as postfix string to the numeric
+ * string. Currently the following units are understood:
+ *
+ * ms    : milliseconds
+ * s     : seconds
+ * mi[n] : minutes
+ * h     : hours
+ *
+ * If no unit is contained in the given timeout parameter the default_time_unit
+ * will be used instead.
+ * @param timeout_parameter The string containing the timeout parameter.
+ * @param timeout The timeout value to be returned.
+ * @param default_time_unit The default time unit to use if none is specified
+ * in timeout_parameter.
+ * @return Status value indicating whether the parsing was successful or not.
+ */
+AP_DECLARE(apr_status_t) ap_timeout_parameter_parse(
+                                               const char *timeout_parameter,
+                                               apr_interval_time_t *timeout,
+                                               const char *default_time_unit);
+
+/**
+ * Determine if a request has a request body or not.
+ *
+ * @param r the request_rec of the request
+ * @return truth value
+ */
+AP_DECLARE(int) ap_request_has_body(request_rec *r);
+    
+/**
+ * Cleanup a string (mainly to be filesystem safe)
+ * We only allow '_' and alphanumeric chars. Non-printable
+ * map to 'x' and all others map to '_'
+ *
+ * @param  p pool to use to allocate dest
+ * @param  src string to clean up
+ * @param  dest cleaned up, allocated string
+ * @return Status value indicating whether the cleaning was successful or not.
+ */
+AP_DECLARE(apr_status_t) ap_pstr2_alnum(apr_pool_t *p, const char *src,
+                                        const char **dest);
+
+/**
+ * Cleanup a string (mainly to be filesystem safe)
+ * We only allow '_' and alphanumeric chars. Non-printable
+ * map to 'x' and all others map to '_'
+ *
+ * @param  src string to clean up
+ * @param  dest cleaned up, pre-allocated string
+ * @return Status value indicating whether the cleaning was successful or not.
+ */
+AP_DECLARE(apr_status_t) ap_str2_alnum(const char *src, char *dest);
+
+/**
+ * Structure to store the contents of an HTTP form of the type
+ * application/x-www-form-urlencoded.
+ * 
+ * Currently it contains the name as a char* of maximum length
+ * HUGE_STRING_LEN, and a value in the form of a bucket brigade
+ * of arbitrary length.
+ */
+typedef struct {
+    const char *name;
+    apr_bucket_brigade *value;
+} ap_form_pair_t;
+
+/**
+ * Read the body and parse any form found, which must be of the
+ * type application/x-www-form-urlencoded.
+ * @param r request containing POSTed form data
+ * @param f filter
+ * @param ptr returned array of ap_form_pair_t
+ * @param num max num of params or -1 for unlimited
+ * @param size max size allowed for parsed data
+ * @return OK or HTTP error
+ */
+AP_DECLARE(int) ap_parse_form_data(request_rec *r, struct ap_filter_t *f,
+                                  apr_array_header_t **ptr,
+                                   apr_size_t num, apr_size_t size);
+
 /* Misc system hackery */
 /**
  * Given the name of an object in the file system determine if it is a directory
@@ -1646,7 +1964,9 @@ char *ap_get_local_host(apr_pool_t *p);
 AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
                            __attribute__((noreturn));
 
-/** @internal */
+/** 
+ * @internal Internal Assert function
+ */
 #define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
 
 /**
@@ -1656,7 +1976,6 @@ AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
  * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG
  * is defined.
  */
-
 #ifdef AP_DEBUG
 #define AP_DEBUG_ASSERT(exp) ap_assert(exp)
 #else
@@ -1664,7 +1983,7 @@ AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
 #endif
 
 /**
- * @defgroup stopsignal flags which indicate places where the sever should stop for debugging.
+ * @defgroup stopsignal Flags which indicate places where the server should stop for debugging.
  * @{
  * A set of flags which indicate places where the server should raise(SIGSTOP).
  * This is useful for debugging, because you can then attach to that process
@@ -1725,33 +2044,58 @@ AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
 #ifdef AP_DEBUG
 
 #undef strchr
-# define strchr(s, c)  ap_strchr(s,c)
+# define strchr(s, c)  ap_strchr(s,c)
 #undef strrchr
-# define strrchr(s, c)  ap_strrchr(s,c)
+# define strrchr(s, c) ap_strrchr(s,c)
 #undef strstr
 # define strstr(s, c)  ap_strstr(s,c)
 
 #else
 
 /** use this instead of strchr */
-# define ap_strchr(s, c)       strchr(s, c)
+# define ap_strchr(s, c)     strchr(s, c)
 /** use this instead of strchr */
-# define ap_strchr_c(s, c)     strchr(s, c)
+# define ap_strchr_c(s, c)   strchr(s, c)
 /** use this instead of strrchr */
-# define ap_strrchr(s, c)      strrchr(s, c)
+# define ap_strrchr(s, c)    strrchr(s, c)
 /** use this instead of strrchr */
-# define ap_strrchr_c(s, c)    strrchr(s, c)
+# define ap_strrchr_c(s, c)  strrchr(s, c)
 /** use this instead of strrstr*/
-# define ap_strstr(s, c)       strstr(s, c)
+# define ap_strstr(s, c)     strstr(s, c)
 /** use this instead of strrstr*/
-# define ap_strstr_c(s, c)     strstr(s, c)
+# define ap_strstr_c(s, c)   strstr(s, c)
 
 #endif
 
-#define AP_NORESTART           APR_OS_START_USEERR + 1
+/**
+ * Generate pseudo random bytes.
+ * This is a convenience interface to apr_random. It is cheaper but less
+ * secure than apr_generate_random_bytes().
+ * @param buf where to store the bytes
+ * @param size number of bytes to generate
+ * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on
+ *       threaded MPMs.
+ */
+APR_DECLARE(void) ap_random_insecure_bytes(void *buf, apr_size_t size);
+
+/**
+ * Get a pseudo random number in a range.
+ * @param min low end of range
+ * @param max high end of range
+ * @return a number in the range
+ */
+APR_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max);
+
+
+#define AP_NORESTART APR_OS_START_USEERR + 1
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* !APACHE_HTTPD_H */
+
+/** @} //APACHE Daemon      */
+/** @} //APACHE Core        */
+/** @} //APACHE super group */
+