]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Ran tidy to convert to xhtml
authorRich Bowen <rbowen@apache.org>
Sat, 22 Sep 2001 19:12:40 +0000 (19:12 +0000)
committerRich Bowen <rbowen@apache.org>
Sat, 22 Sep 2001 19:12:40 +0000 (19:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91113 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/developer/API.html
docs/manual/developer/debugging.html
docs/manual/developer/documenting.html
docs/manual/developer/footer.html
docs/manual/developer/header.html
docs/manual/developer/hooks.html
docs/manual/developer/index.html
docs/manual/developer/layeredio.html
docs/manual/developer/modules.html
docs/manual/developer/modules.html.en
docs/manual/developer/request.html

index 496be760c978deb9407c5c57f28731a8a0261638..2c0a4ad8cc682a6c69326c8fb422306baf2da5c7 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<HTML><HEAD>
-<TITLE>Apache API notes</TITLE>
-</HEAD>
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-<!--#include virtual="header.html" -->
-
-<blockquote><strong>Warning:</strong>
-This document has not been updated to take into account changes
-made in the 2.0 version of the Apache HTTP Server.  Some of the
-information may still be relevant, but please use it
-with care.
-</blockquote>
-
-<H1 ALIGN="CENTER">Apache API notes</H1>
-
-These are some notes on the Apache API and the data structures you
-have to deal with, <EM>etc.</EM>  They are not yet nearly complete, but
-hopefully, they will help you get your bearings.  Keep in mind that
-the API is still subject to change as we gain experience with it.
-(See the TODO file for what <EM>might</EM> be coming).  However,
-it will be easy to adapt modules to any changes that are made.
-(We have more modules to adapt than you do).
-<P>
-
-A few notes on general pedagogical style here.  In the interest of
-conciseness, all structure declarations here are incomplete --- the
-real ones have more slots that I'm not telling you about.  For the
-most part, these are reserved to one component of the server core or
-another, and should be altered by modules with caution.  However, in
-some cases, they really are things I just haven't gotten around to
-yet.  Welcome to the bleeding edge.<P>
-
-Finally, here's an outline, to give you some bare idea of what's
-coming up, and in what order:
-
-<UL>
-<LI> <A HREF="#basics">Basic concepts.</A>
-<MENU>
- <LI> <A HREF="#HMR">Handlers, Modules, and Requests</A>
- <LI> <A HREF="#moduletour">A brief tour of a module</A>
-</MENU>
-<LI> <A HREF="#handlers">How handlers work</A>
-<MENU>
- <LI> <A HREF="#req_tour">A brief tour of the <CODE>request_rec</CODE></A>
- <LI> <A HREF="#req_orig">Where request_rec structures come from</A>
- <LI> <A HREF="#req_return">Handling requests, declining, and returning error
-  codes</A>
- <LI> <A HREF="#resp_handlers">Special considerations for response handlers</A>
- <LI> <A HREF="#auth_handlers">Special considerations for authentication
-  handlers</A>
- <LI> <A HREF="#log_handlers">Special considerations for logging handlers</A>
-</MENU>
-<LI> <A HREF="#pools">Resource allocation and resource pools</A>
-<LI> <A HREF="#config">Configuration, commands and the like</A>
-<MENU>
- <LI> <A HREF="#per-dir">Per-directory configuration structures</A>
- <LI> <A HREF="#commands">Command handling</A>
- <LI> <A HREF="#servconf">Side notes --- per-server configuration,
-  virtual servers, <EM>etc</EM>.</A>
-</MENU>
-</UL>
-
-<H2><A NAME="basics">Basic concepts.</A></H2>
-
-We begin with an overview of the basic concepts behind the
-API, and how they are manifested in the code.
-
-<H3><A NAME="HMR">Handlers, Modules, and Requests</A></H3>
-
-Apache breaks down request handling into a series of steps, more or
-less the same way the Netscape server API does (although this API has
-a few more stages than NetSite does, as hooks for stuff I thought
-might be useful in the future).  These are:
-
-<UL>
-  <LI> URI -&gt; Filename translation
-  <LI> Auth ID checking [is the user who they say they are?]
-  <LI> Auth access checking [is the user authorized <EM>here</EM>?]
-  <LI> Access checking other than auth
-  <LI> Determining MIME type of the object requested
-  <LI> `Fixups' --- there aren't any of these yet, but the phase is
-       intended as a hook for possible extensions like
-       <CODE>SetEnv</CODE>, which don't really fit well elsewhere.
-  <LI> Actually sending a response back to the client.
-  <LI> Logging the request
-</UL>
-
-These phases are handled by looking at each of a succession of
-<EM>modules</EM>, looking to see if each of them has a handler for the
-phase, and attempting invoking it if so.  The handler can typically do
-one of three things:
-
-<UL>
-  <LI> <EM>Handle</EM> the request, and indicate that it has done so
-       by returning the magic constant <CODE>OK</CODE>.
-  <LI> <EM>Decline</EM> to handle the request, by returning the magic
-       integer constant <CODE>DECLINED</CODE>.  In this case, the
-       server behaves in all respects as if the handler simply hadn't
-       been there.
-  <LI> Signal an error, by returning one of the HTTP error codes.
-       This terminates normal handling of the request, although an
-       ErrorDocument may be invoked to try to mop up, and it will be
-       logged in any case.
-</UL>
-
-Most phases are terminated by the first module that handles them;
-however, for logging, `fixups', and non-access authentication
-checking, all handlers always run (barring an error).  Also, the
-response phase is unique in that modules may declare multiple handlers
-for it, via a dispatch table keyed on the MIME type of the requested
-object.  Modules may declare a response-phase handler which can handle
-<EM>any</EM> request, by giving it the key <CODE>*/*</CODE> (<EM>i.e.</EM>, a
-wildcard MIME type specification).  However, wildcard handlers are
-only invoked if the server has already tried and failed to find a more
-specific response handler for the MIME type of the requested object
-(either none existed, or they all declined).<P>
-
-The handlers themselves are functions of one argument (a
-<CODE>request_rec</CODE> structure. vide infra), which returns an
-integer, as above.<P>
-
-<H3><A NAME="moduletour">A brief tour of a module</A></H3>
-
-At this point, we need to explain the structure of a module.  Our
-candidate will be one of the messier ones, the CGI module --- this
-handles both CGI scripts and the <CODE>ScriptAlias</CODE> config file
-command.  It's actually a great deal more complicated than most
-modules, but if we're going to have only one example, it might as well
-be the one with its fingers in every place.<P>
-
-Let's begin with handlers.  In order to handle the CGI scripts, the
-module declares a response handler for them. Because of
-<CODE>ScriptAlias</CODE>, it also has handlers for the name
-translation phase (to recognize <CODE>ScriptAlias</CODE>ed URIs), the
-type-checking phase (any <CODE>ScriptAlias</CODE>ed request is typed
-as a CGI script).<P>
-
-The module needs to maintain some per (virtual)
-server information, namely, the <CODE>ScriptAlias</CODE>es in effect;
-the module structure therefore contains pointers to a functions which
-builds these structures, and to another which combines two of them (in
-case the main server and a virtual server both have
-<CODE>ScriptAlias</CODE>es declared).<P>
-
-Finally, this module contains code to handle the
-<CODE>ScriptAlias</CODE> command itself.  This particular module only
-declares one command, but there could be more, so modules have
-<EM>command tables</EM> which declare their commands, and describe
-where they are permitted, and how they are to be invoked.  <P>
-
-A final note on the declared types of the arguments of some of these
-commands: a <CODE>pool</CODE> is a pointer to a <EM>resource pool</EM>
-structure; these are used by the server to keep track of the memory
-which has been allocated, files opened, <EM>etc.</EM>, either to service a
-particular request, or to handle the process of configuring itself.
-That way, when the request is over (or, for the configuration pool,
-when the server is restarting), the memory can be freed, and the files
-closed, <EM>en masse</EM>, without anyone having to write explicit code to
-track them all down and dispose of them.  Also, a
-<CODE>cmd_parms</CODE> structure contains various information about
-the config file being read, and other status information, which is
-sometimes of use to the function which processes a config-file command
-(such as <CODE>ScriptAlias</CODE>).
-
-With no further ado, the module itself:
-
-<PRE>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Apache API notes</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <blockquote>
+      <strong>Warning:</strong> This document has not been updated
+      to take into account changes made in the 2.0 version of the
+      Apache HTTP Server. Some of the information may still be
+      relevant, but please use it with care.
+    </blockquote>
+
+    <h1 align="CENTER">Apache API notes</h1>
+    These are some notes on the Apache API and the data structures
+    you have to deal with, <em>etc.</em> They are not yet nearly
+    complete, but hopefully, they will help you get your bearings.
+    Keep in mind that the API is still subject to change as we gain
+    experience with it. (See the TODO file for what <em>might</em>
+    be coming). However, it will be easy to adapt modules to any
+    changes that are made. (We have more modules to adapt than you
+    do). 
+
+    <p>A few notes on general pedagogical style here. In the
+    interest of conciseness, all structure declarations here are
+    incomplete --- the real ones have more slots that I'm not
+    telling you about. For the most part, these are reserved to one
+    component of the server core or another, and should be altered
+    by modules with caution. However, in some cases, they really
+    are things I just haven't gotten around to yet. Welcome to the
+    bleeding edge.</p>
+
+    <p>Finally, here's an outline, to give you some bare idea of
+    what's coming up, and in what order:</p>
+
+    <ul>
+      <li>
+        <a href="#basics">Basic concepts.</a> 
+
+        <ul>
+          <li><a href="#HMR">Handlers, Modules, and
+          Requests</a></li>
+
+          <li><a href="#moduletour">A brief tour of a
+          module</a></li>
+        </ul>
+      </li>
+
+      <li>
+        <a href="#handlers">How handlers work</a> 
+
+        <ul>
+          <li><a href="#req_tour">A brief tour of the
+          <code>request_rec</code></a></li>
+
+          <li><a href="#req_orig">Where request_rec structures come
+          from</a></li>
+
+          <li><a href="#req_return">Handling requests, declining,
+          and returning error codes</a></li>
+
+          <li><a href="#resp_handlers">Special considerations for
+          response handlers</a></li>
+
+          <li><a href="#auth_handlers">Special considerations for
+          authentication handlers</a></li>
+
+          <li><a href="#log_handlers">Special considerations for
+          logging handlers</a></li>
+        </ul>
+      </li>
+
+      <li><a href="#pools">Resource allocation and resource
+      pools</a></li>
+
+      <li>
+        <a href="#config">Configuration, commands and the like</a> 
+
+        <ul>
+          <li><a href="#per-dir">Per-directory configuration
+          structures</a></li>
+
+          <li><a href="#commands">Command handling</a></li>
+
+          <li><a href="#servconf">Side notes --- per-server
+          configuration, virtual servers, <em>etc</em>.</a></li>
+        </ul>
+      </li>
+    </ul>
+
+    <h2><a id="basics" name="basics">Basic concepts.</a></h2>
+    We begin with an overview of the basic concepts behind the API,
+    and how they are manifested in the code. 
+
+    <h3><a id="HMR" name="HMR">Handlers, Modules, and
+    Requests</a></h3>
+    Apache breaks down request handling into a series of steps,
+    more or less the same way the Netscape server API does
+    (although this API has a few more stages than NetSite does, as
+    hooks for stuff I thought might be useful in the future). These
+    are: 
+
+    <ul>
+      <li>URI -&gt; Filename translation</li>
+
+      <li>Auth ID checking [is the user who they say they
+      are?]</li>
+
+      <li>Auth access checking [is the user authorized
+      <em>here</em>?]</li>
+
+      <li>Access checking other than auth</li>
+
+      <li>Determining MIME type of the object requested</li>
+
+      <li>`Fixups' --- there aren't any of these yet, but the phase
+      is intended as a hook for possible extensions like
+      <code>SetEnv</code>, which don't really fit well
+      elsewhere.</li>
+
+      <li>Actually sending a response back to the client.</li>
+
+      <li>Logging the request</li>
+    </ul>
+    These phases are handled by looking at each of a succession of
+    <em>modules</em>, looking to see if each of them has a handler
+    for the phase, and attempting invoking it if so. The handler
+    can typically do one of three things: 
+
+    <ul>
+      <li><em>Handle</em> the request, and indicate that it has
+      done so by returning the magic constant <code>OK</code>.</li>
+
+      <li><em>Decline</em> to handle the request, by returning the
+      magic integer constant <code>DECLINED</code>. In this case,
+      the server behaves in all respects as if the handler simply
+      hadn't been there.</li>
+
+      <li>Signal an error, by returning one of the HTTP error
+      codes. This terminates normal handling of the request,
+      although an ErrorDocument may be invoked to try to mop up,
+      and it will be logged in any case.</li>
+    </ul>
+    Most phases are terminated by the first module that handles
+    them; however, for logging, `fixups', and non-access
+    authentication checking, all handlers always run (barring an
+    error). Also, the response phase is unique in that modules may
+    declare multiple handlers for it, via a dispatch table keyed on
+    the MIME type of the requested object. Modules may declare a
+    response-phase handler which can handle <em>any</em> request,
+    by giving it the key <code>*/*</code> (<em>i.e.</em>, a
+    wildcard MIME type specification). However, wildcard handlers
+    are only invoked if the server has already tried and failed to
+    find a more specific response handler for the MIME type of the
+    requested object (either none existed, or they all declined). 
+
+    <p>The handlers themselves are functions of one argument (a
+    <code>request_rec</code> structure. vide infra), which returns
+    an integer, as above.</p>
+
+    <h3><a id="moduletour" name="moduletour">A brief tour of a
+    module</a></h3>
+    At this point, we need to explain the structure of a module.
+    Our candidate will be one of the messier ones, the CGI module
+    --- this handles both CGI scripts and the
+    <code>ScriptAlias</code> config file command. It's actually a
+    great deal more complicated than most modules, but if we're
+    going to have only one example, it might as well be the one
+    with its fingers in every place. 
+
+    <p>Let's begin with handlers. In order to handle the CGI
+    scripts, the module declares a response handler for them.
+    Because of <code>ScriptAlias</code>, it also has handlers for
+    the name translation phase (to recognize
+    <code>ScriptAlias</code>ed URIs), the type-checking phase (any
+    <code>ScriptAlias</code>ed request is typed as a CGI
+    script).</p>
+
+    <p>The module needs to maintain some per (virtual) server
+    information, namely, the <code>ScriptAlias</code>es in effect;
+    the module structure therefore contains pointers to a functions
+    which builds these structures, and to another which combines
+    two of them (in case the main server and a virtual server both
+    have <code>ScriptAlias</code>es declared).</p>
+
+    <p>Finally, this module contains code to handle the
+    <code>ScriptAlias</code> command itself. This particular module
+    only declares one command, but there could be more, so modules
+    have <em>command tables</em> which declare their commands, and
+    describe where they are permitted, and how they are to be
+    invoked.</p>
+
+    <p>A final note on the declared types of the arguments of some
+    of these commands: a <code>pool</code> is a pointer to a
+    <em>resource pool</em> structure; these are used by the server
+    to keep track of the memory which has been allocated, files
+    opened, <em>etc.</em>, either to service a particular request,
+    or to handle the process of configuring itself. That way, when
+    the request is over (or, for the configuration pool, when the
+    server is restarting), the memory can be freed, and the files
+    closed, <em>en masse</em>, without anyone having to write
+    explicit code to track them all down and dispose of them. Also,
+    a <code>cmd_parms</code> structure contains various information
+    about the config file being read, and other status information,
+    which is sometimes of use to the function which processes a
+    config-file command (such as <code>ScriptAlias</code>). With no
+    further ado, the module itself:</p>
+<pre>
 /* Declarations of handlers. */
 
 int translate_scriptalias (request_rec *);
@@ -224,59 +266,65 @@ module cgi_module = {
    NULL,                     /* logger */
    NULL                      /* header parser */
 };
-</PRE>
-
-<H2><A NAME="handlers">How handlers work</A></H2>
-
-The sole argument to handlers is a <CODE>request_rec</CODE> structure.
-This structure describes a particular request which has been made to
-the server, on behalf of a client.  In most cases, each connection to
-the client generates only one <CODE>request_rec</CODE> structure.<P>
-
-<H3><A NAME="req_tour">A brief tour of the <CODE>request_rec</CODE></A></H3>
-
-The <CODE>request_rec</CODE> contains pointers to a resource pool
-which will be cleared when the server is finished handling the
-request; to structures containing per-server and per-connection
-information, and most importantly, information on the request itself.<P>
-
-The most important such information is a small set of character
-strings describing attributes of the object being requested, including
-its URI, filename, content-type and content-encoding (these being filled
-in by the translation and type-check handlers which handle the
-request, respectively). <P>
-
-Other commonly used data items are tables giving the MIME headers on
-the client's original request, MIME headers to be sent back with the
-response (which modules can add to at will), and environment variables
-for any subprocesses which are spawned off in the course of servicing
-the request.  These tables are manipulated using the
-<CODE>ap_table_get</CODE> and <CODE>ap_table_set</CODE> routines. <P>
-<BLOCKQUOTE>
- Note that the <SAMP>Content-type</SAMP> header value <EM>cannot</EM> be
- set by module content-handlers using the <SAMP>ap_table_*()</SAMP>
- routines.  Rather, it is set by pointing the <SAMP>content_type</SAMP>
- field in the <SAMP>request_rec</SAMP> structure to an appropriate
- string.  <EM>E.g.</EM>,
- <PRE>
+</pre>
+
+    <h2><a id="handlers" name="handlers">How handlers work</a></h2>
+    The sole argument to handlers is a <code>request_rec</code>
+    structure. This structure describes a particular request which
+    has been made to the server, on behalf of a client. In most
+    cases, each connection to the client generates only one
+    <code>request_rec</code> structure. 
+
+    <h3><a id="req_tour" name="req_tour">A brief tour of the
+    <code>request_rec</code></a></h3>
+    The <code>request_rec</code> contains pointers to a resource
+    pool which will be cleared when the server is finished handling
+    the request; to structures containing per-server and
+    per-connection information, and most importantly, information
+    on the request itself. 
+
+    <p>The most important such information is a small set of
+    character strings describing attributes of the object being
+    requested, including its URI, filename, content-type and
+    content-encoding (these being filled in by the translation and
+    type-check handlers which handle the request,
+    respectively).</p>
+
+    <p>Other commonly used data items are tables giving the MIME
+    headers on the client's original request, MIME headers to be
+    sent back with the response (which modules can add to at will),
+    and environment variables for any subprocesses which are
+    spawned off in the course of servicing the request. These
+    tables are manipulated using the <code>ap_table_get</code> and
+    <code>ap_table_set</code> routines.</p>
+
+    <blockquote>
+      Note that the <samp>Content-type</samp> header value
+      <em>cannot</em> be set by module content-handlers using the
+      <samp>ap_table_*()</samp> routines. Rather, it is set by
+      pointing the <samp>content_type</samp> field in the
+      <samp>request_rec</samp> structure to an appropriate string.
+      <em>E.g.</em>, 
+<pre>
   r-&gt;content_type = "text/html";
- </PRE>
-</BLOCKQUOTE>
-Finally, there are pointers to two data structures which, in turn,
-point to per-module configuration structures.  Specifically, these
-hold pointers to the data structures which the module has built to
-describe the way it has been configured to operate in a given
-directory (via <CODE>.htaccess</CODE> files or
-<CODE>&lt;Directory&gt;</CODE> sections), for private data it has
-built in the course of servicing the request (so modules' handlers for
-one phase can pass `notes' to their handlers for other phases).  There
-is another such configuration vector in the <CODE>server_rec</CODE>
-data structure pointed to by the <CODE>request_rec</CODE>, which
-contains per (virtual) server configuration data.<P>
-
-Here is an abridged declaration, giving the fields most commonly used:<P>
-
-<PRE>
+</pre>
+    </blockquote>
+    Finally, there are pointers to two data structures which, in
+    turn, point to per-module configuration structures.
+    Specifically, these hold pointers to the data structures which
+    the module has built to describe the way it has been configured
+    to operate in a given directory (via <code>.htaccess</code>
+    files or <code>&lt;Directory&gt;</code> sections), for private
+    data it has built in the course of servicing the request (so
+    modules' handlers for one phase can pass `notes' to their
+    handlers for other phases). There is another such configuration
+    vector in the <code>server_rec</code> data structure pointed to
+    by the <code>request_rec</code>, which contains per (virtual)
+    server configuration data. 
+
+    <p>Here is an abridged declaration, giving the fields most
+    commonly used:</p>
+<pre>
 struct request_rec {
 
   pool *pool;
@@ -314,8 +362,8 @@ struct request_rec {
 
   int header_only;     /* HEAD request, as opposed to GET */
   char *protocol;      /* Protocol, as given to us, or HTTP/0.9 */
-  char *method;        /* GET, HEAD, POST, <EM>etc.</EM> */
-  int method_number;   /* M_GET, M_POST, <EM>etc.</EM> */
+  char *method;        /* GET, HEAD, POST, <em>etc.</em> */
+  int method_number;   /* M_GET, M_POST, <em>etc.</em> */
 
   /* Info for logging */
 
@@ -333,109 +381,115 @@ struct request_rec {
    * (the thing pointed to being the module's business).
    */
 
-  void *per_dir_config;   /* Options set in config files, <EM>etc.</EM> */
+  void *per_dir_config;   /* Options set in config files, <em>etc.</em> */
   void *request_config;   /* Notes on *this* request */
 
 };
 
-</PRE>
-
-<H3><A NAME="req_orig">Where request_rec structures come from</A></H3>
-
-Most <CODE>request_rec</CODE> structures are built by reading an HTTP
-request from a client, and filling in the fields.  However, there are
-a few exceptions:
-
-<UL>
-  <LI> If the request is to an imagemap, a type map (<EM>i.e.</EM>, a
-       <CODE>*.var</CODE> file), or a CGI script which returned a
-       local `Location:', then the resource which the user requested
-       is going to be ultimately located by some URI other than what
-       the client originally supplied.  In this case, the server does
-       an <EM>internal redirect</EM>, constructing a new
-       <CODE>request_rec</CODE> for the new URI, and processing it
-       almost exactly as if the client had requested the new URI
-       directly. <P>
-
-  <LI> If some handler signaled an error, and an
-       <CODE>ErrorDocument</CODE> is in scope, the same internal
-       redirect machinery comes into play.<P>
-
-  <LI> Finally, a handler occasionally needs to investigate `what
-       would happen if' some other request were run.  For instance,
-       the directory indexing module needs to know what MIME type
-       would be assigned to a request for each directory entry, in
-       order to figure out what icon to use.<P>
-
-       Such handlers can construct a <EM>sub-request</EM>, using the
-       functions <CODE>ap_sub_req_lookup_file</CODE>,
-       <CODE>ap_sub_req_lookup_uri</CODE>, and
-       <CODE>ap_sub_req_method_uri</CODE>; these construct a new
-       <CODE>request_rec</CODE> structure and processes it as you
-       would expect, up to but not including the point of actually
-       sending a response.  (These functions skip over the access
-       checks if the sub-request is for a file in the same directory
-       as the original request).<P>
-
-       (Server-side includes work by building sub-requests and then
-       actually invoking the response handler for them, via the
-       function <CODE>ap_run_sub_req</CODE>).
-</UL>
-
-<H3><A NAME="req_return">Handling requests, declining, and returning error
- codes</A></H3>
-
-As discussed above, each handler, when invoked to handle a particular
-<CODE>request_rec</CODE>, has to return an <CODE>int</CODE> to
-indicate what happened.  That can either be
-
-<UL>
-  <LI> OK --- the request was handled successfully.  This may or may
-       not terminate the phase.
-  <LI> DECLINED --- no erroneous condition exists, but the module
-       declines to handle the phase; the server tries to find another.
-  <LI> an HTTP error code, which aborts handling of the request.
-</UL>
-
-Note that if the error code returned is <CODE>REDIRECT</CODE>, then
-the module should put a <CODE>Location</CODE> in the request's
-<CODE>headers_out</CODE>, to indicate where the client should be
-redirected <EM>to</EM>. <P>
-
-<H3><A NAME="resp_handlers">Special considerations for response
- handlers</A></H3>
-
-Handlers for most phases do their work by simply setting a few fields
-in the <CODE>request_rec</CODE> structure (or, in the case of access
-checkers, simply by returning the correct error code).  However,
-response handlers have to actually send a request back to the client. <P>
-
-They should begin by sending an HTTP response header, using the
-function <CODE>ap_send_http_header</CODE>.  (You don't have to do
-anything special to skip sending the header for HTTP/0.9 requests; the
-function figures out on its own that it shouldn't do anything).  If
-the request is marked <CODE>header_only</CODE>, that's all they should
-do; they should return after that, without attempting any further
-output.  <P>
-
-Otherwise, they should produce a request body which responds to the
-client as appropriate.  The primitives for this are <CODE>ap_rputc</CODE>
-and <CODE>ap_rprintf</CODE>, for internally generated output, and
-<CODE>ap_send_fd</CODE>, to copy the contents of some <CODE>FILE *</CODE>
-straight to the client.  <P>
-
-At this point, you should more or less understand the following piece
-of code, which is the handler which handles <CODE>GET</CODE> requests
-which have no more specific handler; it also shows how conditional
-<CODE>GET</CODE>s can be handled, if it's desirable to do so in a
-particular response handler --- <CODE>ap_set_last_modified</CODE> checks
-against the <CODE>If-modified-since</CODE> value supplied by the
-client, if any, and returns an appropriate code (which will, if
-nonzero, be USE_LOCAL_COPY).   No similar considerations apply for
-<CODE>ap_set_content_length</CODE>, but it returns an error code for
-symmetry.<P>
-
-<PRE>
+</pre>
+
+    <h3><a id="req_orig" name="req_orig">Where request_rec
+    structures come from</a></h3>
+    Most <code>request_rec</code> structures are built by reading
+    an HTTP request from a client, and filling in the fields.
+    However, there are a few exceptions: 
+
+    <ul>
+      <li>If the request is to an imagemap, a type map
+      (<em>i.e.</em>, a <code>*.var</code> file), or a CGI script
+      which returned a local `Location:', then the resource which
+      the user requested is going to be ultimately located by some
+      URI other than what the client originally supplied. In this
+      case, the server does an <em>internal redirect</em>,
+      constructing a new <code>request_rec</code> for the new URI,
+      and processing it almost exactly as if the client had
+      requested the new URI directly.</li>
+
+      <li>If some handler signaled an error, and an
+      <code>ErrorDocument</code> is in scope, the same internal
+      redirect machinery comes into play.</li>
+
+      <li>
+        Finally, a handler occasionally needs to investigate `what
+        would happen if' some other request were run. For instance,
+        the directory indexing module needs to know what MIME type
+        would be assigned to a request for each directory entry, in
+        order to figure out what icon to use. 
+
+        <p>Such handlers can construct a <em>sub-request</em>,
+        using the functions <code>ap_sub_req_lookup_file</code>,
+        <code>ap_sub_req_lookup_uri</code>, and
+        <code>ap_sub_req_method_uri</code>; these construct a new
+        <code>request_rec</code> structure and processes it as you
+        would expect, up to but not including the point of actually
+        sending a response. (These functions skip over the access
+        checks if the sub-request is for a file in the same
+        directory as the original request).</p>
+
+        <p>(Server-side includes work by building sub-requests and
+        then actually invoking the response handler for them, via
+        the function <code>ap_run_sub_req</code>).</p>
+      </li>
+    </ul>
+
+    <h3><a id="req_return" name="req_return">Handling requests,
+    declining, and returning error codes</a></h3>
+    As discussed above, each handler, when invoked to handle a
+    particular <code>request_rec</code>, has to return an
+    <code>int</code> to indicate what happened. That can either be 
+
+    <ul>
+      <li>OK --- the request was handled successfully. This may or
+      may not terminate the phase.</li>
+
+      <li>DECLINED --- no erroneous condition exists, but the
+      module declines to handle the phase; the server tries to find
+      another.</li>
+
+      <li>an HTTP error code, which aborts handling of the
+      request.</li>
+    </ul>
+    Note that if the error code returned is <code>REDIRECT</code>,
+    then the module should put a <code>Location</code> in the
+    request's <code>headers_out</code>, to indicate where the
+    client should be redirected <em>to</em>. 
+
+    <h3><a id="resp_handlers" name="resp_handlers">Special
+    considerations for response handlers</a></h3>
+    Handlers for most phases do their work by simply setting a few
+    fields in the <code>request_rec</code> structure (or, in the
+    case of access checkers, simply by returning the correct error
+    code). However, response handlers have to actually send a
+    request back to the client. 
+
+    <p>They should begin by sending an HTTP response header, using
+    the function <code>ap_send_http_header</code>. (You don't have
+    to do anything special to skip sending the header for HTTP/0.9
+    requests; the function figures out on its own that it shouldn't
+    do anything). If the request is marked
+    <code>header_only</code>, that's all they should do; they
+    should return after that, without attempting any further
+    output.</p>
+
+    <p>Otherwise, they should produce a request body which responds
+    to the client as appropriate. The primitives for this are
+    <code>ap_rputc</code> and <code>ap_rprintf</code>, for
+    internally generated output, and <code>ap_send_fd</code>, to
+    copy the contents of some <code>FILE *</code> straight to the
+    client.</p>
+
+    <p>At this point, you should more or less understand the
+    following piece of code, which is the handler which handles
+    <code>GET</code> requests which have no more specific handler;
+    it also shows how conditional <code>GET</code>s can be handled,
+    if it's desirable to do so in a particular response handler ---
+    <code>ap_set_last_modified</code> checks against the
+    <code>If-modified-since</code> value supplied by the client, if
+    any, and returns an appropriate code (which will, if nonzero,
+    be USE_LOCAL_COPY). No similar considerations apply for
+    <code>ap_set_content_length</code>, but it returns an error
+    code for symmetry.</p>
+<pre>
 int default_handler (request_rec *r)
 {
     int errstatus;
@@ -445,7 +499,7 @@ int default_handler (request_rec *r)
     if (r-&gt;finfo.st_mode == 0) return NOT_FOUND;
 
     if ((errstatus = ap_set_content_length (r, r-&gt;finfo.st_size))
-       || (errstatus = ap_set_last_modified (r, r-&gt;finfo.st_mtime)))
+    || (errstatus = ap_set_last_modified (r, r-&gt;finfo.st_mtime)))
         return errstatus;
 
     f = fopen (r-&gt;filename, "r");
@@ -463,119 +517,125 @@ int default_handler (request_rec *r)
     ap_pfclose (r-&gt;pool, f);
     return OK;
 }
-</PRE>
-
-Finally, if all of this is too much of a challenge, there are a few
-ways out of it.  First off, as shown above, a response handler which
-has not yet produced any output can simply return an error code, in
-which case the server will automatically produce an error response.
-Secondly, it can punt to some other handler by invoking
-<CODE>ap_internal_redirect</CODE>, which is how the internal redirection
-machinery discussed above is invoked.  A response handler which has
-internally redirected should always return <CODE>OK</CODE>. <P>
-
-(Invoking <CODE>ap_internal_redirect</CODE> from handlers which are
-<EM>not</EM> response handlers will lead to serious confusion).
-
-<H3><A NAME="auth_handlers">Special considerations for authentication
- handlers</A></H3>
-
-Stuff that should be discussed here in detail:
-
-<UL>
-  <LI> Authentication-phase handlers not invoked unless auth is
-       configured for the directory.
-  <LI> Common auth configuration stored in the core per-dir
-       configuration; it has accessors <CODE>ap_auth_type</CODE>,
-       <CODE>ap_auth_name</CODE>, and <CODE>ap_requires</CODE>.
-  <LI> Common routines, to handle the protocol end of things, at least
-       for HTTP basic authentication (<CODE>ap_get_basic_auth_pw</CODE>,
-       which sets the <CODE>connection-&gt;user</CODE> structure field
-       automatically, and <CODE>ap_note_basic_auth_failure</CODE>, which
-       arranges for the proper <CODE>WWW-Authenticate:</CODE> header
-       to be sent back).
-</UL>
-
-<H3><A NAME="log_handlers">Special considerations for logging handlers</A></H3>
-
-When a request has internally redirected, there is the question of
-what to log.  Apache handles this by bundling the entire chain of
-redirects into a list of <CODE>request_rec</CODE> structures which are
-threaded through the <CODE>r-&gt;prev</CODE> and <CODE>r-&gt;next</CODE>
-pointers.  The <CODE>request_rec</CODE> which is passed to the logging
-handlers in such cases is the one which was originally built for the
-initial request from the client; note that the bytes_sent field will
-only be correct in the last request in the chain (the one for which a
-response was actually sent).
-
-<H2><A NAME="pools">Resource allocation and resource pools</A></H2>
-<P>
-One of the problems of writing and designing a server-pool server is
-that of preventing leakage, that is, allocating resources (memory,
-open files, <EM>etc.</EM>), without subsequently releasing them.  The resource
-pool machinery is designed to make it easy to prevent this from
-happening, by allowing resource to be allocated in such a way that
-they are <EM>automatically</EM> released when the server is done with
-them.
-</P>
-<P>
-The way this works is as follows:  the memory which is allocated, file
-opened, <EM>etc.</EM>, to deal with a particular request are tied to a
-<EM>resource pool</EM> which is allocated for the request.  The pool
-is a data structure which itself tracks the resources in question.
-</P>
-<P>
-When the request has been processed, the pool is <EM>cleared</EM>.  At
-that point, all the memory associated with it is released for reuse,
-all files associated with it are closed, and any other clean-up
-functions which are associated with the pool are run.  When this is
-over, we can be confident that all the resource tied to the pool have
-been released, and that none of them have leaked.
-</P>
-<P>
-Server restarts, and allocation of memory and resources for per-server
-configuration, are handled in a similar way.  There is a
-<EM>configuration pool</EM>, which keeps track of resources which were
-allocated while reading the server configuration files, and handling
-the commands therein (for instance, the memory that was allocated for
-per-server module configuration, log files and other files that were
-opened, and so forth).  When the server restarts, and has to reread
-the configuration files, the configuration pool is cleared, and so the
-memory and file descriptors which were taken up by reading them the
-last time are made available for reuse.
-</P>
-<P>
-It should be noted that use of the pool machinery isn't generally
-obligatory, except for situations like logging handlers, where you
-really need to register cleanups to make sure that the log file gets
-closed when the server restarts (this is most easily done by using the
-function <CODE><A HREF="#pool-files">ap_pfopen</A></CODE>, which also
-arranges for the underlying file descriptor to be closed before any
-child processes, such as for CGI scripts, are <CODE>exec</CODE>ed), or
-in case you are using the timeout machinery (which isn't yet even
-documented here).  However, there are two benefits to using it:
-resources allocated to a pool never leak (even if you allocate a
-scratch string, and just forget about it); also, for memory
-allocation, <CODE>ap_palloc</CODE> is generally faster than
-<CODE>malloc</CODE>.
-</P>
-<P>
-We begin here by describing how memory is allocated to pools, and then
-discuss how other resources are tracked by the resource pool
-machinery.
-</P>
-<H3>Allocation of memory in pools</H3>
-<P>
-Memory is allocated to pools by calling the function
-<CODE>ap_palloc</CODE>, which takes two arguments, one being a pointer to
-a resource pool structure, and the other being the amount of memory to
-allocate (in <CODE>char</CODE>s).  Within handlers for handling
-requests, the most common way of getting a resource pool structure is
-by looking at the <CODE>pool</CODE> slot of the relevant
-<CODE>request_rec</CODE>; hence the repeated appearance of the
-following idiom in module code:
-</P>
-<PRE>
+</pre>
+    Finally, if all of this is too much of a challenge, there are a
+    few ways out of it. First off, as shown above, a response
+    handler which has not yet produced any output can simply return
+    an error code, in which case the server will automatically
+    produce an error response. Secondly, it can punt to some other
+    handler by invoking <code>ap_internal_redirect</code>, which is
+    how the internal redirection machinery discussed above is
+    invoked. A response handler which has internally redirected
+    should always return <code>OK</code>. 
+
+    <p>(Invoking <code>ap_internal_redirect</code> from handlers
+    which are <em>not</em> response handlers will lead to serious
+    confusion).</p>
+
+    <h3><a id="auth_handlers" name="auth_handlers">Special
+    considerations for authentication handlers</a></h3>
+    Stuff that should be discussed here in detail: 
+
+    <ul>
+      <li>Authentication-phase handlers not invoked unless auth is
+      configured for the directory.</li>
+
+      <li>Common auth configuration stored in the core per-dir
+      configuration; it has accessors <code>ap_auth_type</code>,
+      <code>ap_auth_name</code>, and <code>ap_requires</code>.</li>
+
+      <li>Common routines, to handle the protocol end of things, at
+      least for HTTP basic authentication
+      (<code>ap_get_basic_auth_pw</code>, which sets the
+      <code>connection-&gt;user</code> structure field
+      automatically, and <code>ap_note_basic_auth_failure</code>,
+      which arranges for the proper <code>WWW-Authenticate:</code>
+      header to be sent back).</li>
+    </ul>
+
+    <h3><a id="log_handlers" name="log_handlers">Special
+    considerations for logging handlers</a></h3>
+    When a request has internally redirected, there is the question
+    of what to log. Apache handles this by bundling the entire
+    chain of redirects into a list of <code>request_rec</code>
+    structures which are threaded through the
+    <code>r-&gt;prev</code> and <code>r-&gt;next</code> pointers.
+    The <code>request_rec</code> which is passed to the logging
+    handlers in such cases is the one which was originally built
+    for the initial request from the client; note that the
+    bytes_sent field will only be correct in the last request in
+    the chain (the one for which a response was actually sent). 
+
+    <h2><a id="pools" name="pools">Resource allocation and resource
+    pools</a></h2>
+
+    <p>One of the problems of writing and designing a server-pool
+    server is that of preventing leakage, that is, allocating
+    resources (memory, open files, <em>etc.</em>), without
+    subsequently releasing them. The resource pool machinery is
+    designed to make it easy to prevent this from happening, by
+    allowing resource to be allocated in such a way that they are
+    <em>automatically</em> released when the server is done with
+    them.</p>
+
+    <p>The way this works is as follows: the memory which is
+    allocated, file opened, <em>etc.</em>, to deal with a
+    particular request are tied to a <em>resource pool</em> which
+    is allocated for the request. The pool is a data structure
+    which itself tracks the resources in question.</p>
+
+    <p>When the request has been processed, the pool is
+    <em>cleared</em>. At that point, all the memory associated with
+    it is released for reuse, all files associated with it are
+    closed, and any other clean-up functions which are associated
+    with the pool are run. When this is over, we can be confident
+    that all the resource tied to the pool have been released, and
+    that none of them have leaked.</p>
+
+    <p>Server restarts, and allocation of memory and resources for
+    per-server configuration, are handled in a similar way. There
+    is a <em>configuration pool</em>, which keeps track of
+    resources which were allocated while reading the server
+    configuration files, and handling the commands therein (for
+    instance, the memory that was allocated for per-server module
+    configuration, log files and other files that were opened, and
+    so forth). When the server restarts, and has to reread the
+    configuration files, the configuration pool is cleared, and so
+    the memory and file descriptors which were taken up by reading
+    them the last time are made available for reuse.</p>
+
+    <p>It should be noted that use of the pool machinery isn't
+    generally obligatory, except for situations like logging
+    handlers, where you really need to register cleanups to make
+    sure that the log file gets closed when the server restarts
+    (this is most easily done by using the function <code><a
+    href="#pool-files">ap_pfopen</a></code>, which also arranges
+    for the underlying file descriptor to be closed before any
+    child processes, such as for CGI scripts, are
+    <code>exec</code>ed), or in case you are using the timeout
+    machinery (which isn't yet even documented here). However,
+    there are two benefits to using it: resources allocated to a
+    pool never leak (even if you allocate a scratch string, and
+    just forget about it); also, for memory allocation,
+    <code>ap_palloc</code> is generally faster than
+    <code>malloc</code>.</p>
+
+    <p>We begin here by describing how memory is allocated to
+    pools, and then discuss how other resources are tracked by the
+    resource pool machinery.</p>
+
+    <h3>Allocation of memory in pools</h3>
+
+    <p>Memory is allocated to pools by calling the function
+    <code>ap_palloc</code>, which takes two arguments, one being a
+    pointer to a resource pool structure, and the other being the
+    amount of memory to allocate (in <code>char</code>s). Within
+    handlers for handling requests, the most common way of getting
+    a resource pool structure is by looking at the
+    <code>pool</code> slot of the relevant
+    <code>request_rec</code>; hence the repeated appearance of the
+    following idiom in module code:</p>
+<pre>
 int my_handler(request_rec *r)
 {
     struct my_structure *foo;
@@ -583,355 +643,374 @@ int my_handler(request_rec *r)
 
     foo = (foo *)ap_palloc (r-&gt;pool, sizeof(my_structure));
 }
-</PRE>
-<P>
-Note that <EM>there is no <CODE>ap_pfree</CODE></EM> ---
-<CODE>ap_palloc</CODE>ed memory is freed only when the associated
-resource pool is cleared.  This means that <CODE>ap_palloc</CODE> does not
-have to do as much accounting as <CODE>malloc()</CODE>; all it does in
-the typical case is to round up the size, bump a pointer, and do a
-range check.
-</P>
-<P>
-(It also raises the possibility that heavy use of <CODE>ap_palloc</CODE>
-could cause a server process to grow excessively large.  There are
-two ways to deal with this, which are dealt with below; briefly, you
-can use <CODE>malloc</CODE>, and try to be sure that all of the memory
-gets explicitly <CODE>free</CODE>d, or you can allocate a sub-pool of
-the main pool, allocate your memory in the sub-pool, and clear it out
-periodically.  The latter technique is discussed in the section on
-sub-pools below, and is used in the directory-indexing code, in order
-to avoid excessive storage allocation when listing directories with
-thousands of files).
-</P>
-<H3>Allocating initialized memory</H3>
-<P>
-There are functions which allocate initialized memory, and are
-frequently useful.  The function <CODE>ap_pcalloc</CODE> has the same
-interface as <CODE>ap_palloc</CODE>, but clears out the memory it
-allocates before it returns it.  The function <CODE>ap_pstrdup</CODE>
-takes a resource pool and a <CODE>char *</CODE> as arguments, and
-allocates memory for a copy of the string the pointer points to,
-returning a pointer to the copy.  Finally <CODE>ap_pstrcat</CODE> is a
-varargs-style function, which takes a pointer to a resource pool, and
-at least two <CODE>char *</CODE> arguments, the last of which must be
-<CODE>NULL</CODE>.  It allocates enough memory to fit copies of each
-of the strings, as a unit; for instance:
-</P>
-<PRE>
+</pre>
+
+    <p>Note that <em>there is no <code>ap_pfree</code></em> ---
+    <code>ap_palloc</code>ed memory is freed only when the
+    associated resource pool is cleared. This means that
+    <code>ap_palloc</code> does not have to do as much accounting
+    as <code>malloc()</code>; all it does in the typical case is to
+    round up the size, bump a pointer, and do a range check.</p>
+
+    <p>(It also raises the possibility that heavy use of
+    <code>ap_palloc</code> could cause a server process to grow
+    excessively large. There are two ways to deal with this, which
+    are dealt with below; briefly, you can use <code>malloc</code>,
+    and try to be sure that all of the memory gets explicitly
+    <code>free</code>d, or you can allocate a sub-pool of the main
+    pool, allocate your memory in the sub-pool, and clear it out
+    periodically. The latter technique is discussed in the section
+    on sub-pools below, and is used in the directory-indexing code,
+    in order to avoid excessive storage allocation when listing
+    directories with thousands of files).</p>
+
+    <h3>Allocating initialized memory</h3>
+
+    <p>There are functions which allocate initialized memory, and
+    are frequently useful. The function <code>ap_pcalloc</code> has
+    the same interface as <code>ap_palloc</code>, but clears out
+    the memory it allocates before it returns it. The function
+    <code>ap_pstrdup</code> takes a resource pool and a <code>char
+    *</code> as arguments, and allocates memory for a copy of the
+    string the pointer points to, returning a pointer to the copy.
+    Finally <code>ap_pstrcat</code> is a varargs-style function,
+    which takes a pointer to a resource pool, and at least two
+    <code>char *</code> arguments, the last of which must be
+    <code>NULL</code>. It allocates enough memory to fit copies of
+    each of the strings, as a unit; for instance:</p>
+<pre>
      ap_pstrcat (r-&gt;pool, "foo", "/", "bar", NULL);
-</PRE>
-<P>
-returns a pointer to 8 bytes worth of memory, initialized to
-<CODE>"foo/bar"</CODE>.
-</P>
-<H3><A NAME="pools-used">Commonly-used pools in the Apache Web server</A></H3>
-<P>
-A pool is really defined by its lifetime more than anything else.  There
-are some static pools in http_main which are passed to various
-non-http_main functions as arguments at opportune times.  Here they are:
-</P>
-<DL COMPACT>
- <DT>permanent_pool
- </DT>
- <DD>
-  <UL>
-   <LI>never passed to anything else, this is the ancestor of all pools
-   </LI>
-  </UL>
- </DD>
- <DT>pconf
- </DT>
- <DD>
-  <UL>
-   <LI>subpool of permanent_pool
-   </LI>
-   <LI>created at the beginning of a config "cycle"; exists until the
-    server is terminated or restarts; passed to all config-time
-    routines, either via cmd-&gt;pool, or as the "pool *p" argument on
-    those which don't take pools
-   </LI>
-   <LI>passed to the module init() functions
-   </LI>
-  </UL>
- </DD>
- <DT>ptemp
- </DT>
- <DD>
-  <UL>
-   <LI>sorry I lie, this pool isn't called this currently in 1.3, I
-    renamed it this in my pthreads development.  I'm referring to
-    the use of ptrans in the parent... contrast this with the later
-    definition of ptrans in the child.
-   </LI>
-   <LI>subpool of permanent_pool
-   </LI>
-   <LI>created at the beginning of a config "cycle"; exists until the
-    end of config parsing; passed to config-time routines <EM>via</EM>
-    cmd-&gt;temp_pool.  Somewhat of a "bastard child" because it isn't
-    available everywhere.  Used for temporary scratch space which
-    may be needed by some config routines but which is deleted at
-    the end of config.
-   </LI>
-  </UL>
- </DD>
- <DT>pchild
- </DT>
- <DD>
-  <UL>
-   <LI>subpool of permanent_pool
-   </LI>
-   <LI>created when a child is spawned (or a thread is created); lives
-    until that child (thread) is destroyed
-   </LI>
-   <LI>passed to the module child_init functions
-   </LI>
-   <LI>destruction happens right after the child_exit functions are
-    called... (which may explain why I think child_exit is redundant
-    and unneeded)
-   </LI>
-  </UL>
- </DD>
- <DT>ptrans
- <DT>
- <DD>
-  <UL>
-   <LI>should be a subpool of pchild, but currently is a subpool of
-    permanent_pool, see above
-   </LI>
-   <LI>cleared by the child before going into the accept() loop to receive
-    a connection
-   </LI>
-   <LI>used as connection-&gt;pool
-   </LI>
-  </UL>
- </DD>
- <DT>r-&gt;pool
- </DT>
- <DD>
-  <UL>
-   <LI>for the main request this is a subpool of connection-&gt;pool; for
-    subrequests it is a subpool of the parent request's pool.
-   </LI>
-   <LI>exists until the end of the request (<EM>i.e.</EM>,
-    ap_destroy_sub_req, or
-    in child_main after process_request has finished)
-   </LI>
-   <LI>note that r itself is allocated from r-&gt;pool; <EM>i.e.</EM>,
-    r-&gt;pool is
-    first created and then r is the first thing palloc()d from it
-   </LI>
-  </UL>
- </DD>
-</DL>
-<P>
-For almost everything folks do, r-&gt;pool is the pool to use.  But you
-can see how other lifetimes, such as pchild, are useful to some
-modules... such as modules that need to open a database connection once
-per child, and wish to clean it up when the child dies.
-</P>
-<P>
-You can also see how some bugs have manifested themself, such as setting
-connection-&gt;user to a value from r-&gt;pool -- in this case
-connection exists
-for the lifetime of ptrans, which is longer than r-&gt;pool (especially if
-r-&gt;pool is a subrequest!).  So the correct thing to do is to allocate
-from connection-&gt;pool.
-</P>
-<P>
-And there was another interesting bug in mod_include/mod_cgi.  You'll see
-in those that they do this test to decide if they should use r-&gt;pool
-or r-&gt;main-&gt;pool.  In this case the resource that they are registering
-for cleanup is a child process.  If it were registered in r-&gt;pool,
-then the code would wait() for the child when the subrequest finishes.
-With mod_include this could be any old #include, and the delay can be up
-to 3 seconds... and happened quite frequently.  Instead the subprocess
-is registered in r-&gt;main-&gt;pool which causes it to be cleaned up when
-the entire request is done -- <EM>i.e.</EM>, after the output has been sent to
-the client and logging has happened.
-</P>
-<H3><A NAME="pool-files">Tracking open files, etc.</A></H3>
-<P>
-As indicated above, resource pools are also used to track other sorts
-of resources besides memory.  The most common are open files.  The
-routine which is typically used for this is <CODE>ap_pfopen</CODE>, which
-takes a resource pool and two strings as arguments; the strings are
-the same as the typical arguments to <CODE>fopen</CODE>, <EM>e.g.</EM>,
-</P>
-<PRE>
+</pre>
+
+    <p>returns a pointer to 8 bytes worth of memory, initialized to
+    <code>"foo/bar"</code>.</p>
+
+    <h3><a id="pools-used" name="pools-used">Commonly-used pools in
+    the Apache Web server</a></h3>
+
+    <p>A pool is really defined by its lifetime more than anything
+    else. There are some static pools in http_main which are passed
+    to various non-http_main functions as arguments at opportune
+    times. Here they are:</p>
+
+    <dl compact="compact">
+      <dt>permanent_pool</dt>
+
+      <dd>
+        <ul>
+          <li>never passed to anything else, this is the ancestor
+          of all pools</li>
+        </ul>
+      </dd>
+
+      <dt>pconf</dt>
+
+      <dd>
+        <ul>
+          <li>subpool of permanent_pool</li>
+
+          <li>created at the beginning of a config "cycle"; exists
+          until the server is terminated or restarts; passed to all
+          config-time routines, either via cmd-&gt;pool, or as the
+          "pool *p" argument on those which don't take pools</li>
+
+          <li>passed to the module init() functions</li>
+        </ul>
+      </dd>
+
+      <dt>ptemp</dt>
+
+      <dd>
+        <ul>
+          <li>sorry I lie, this pool isn't called this currently in
+          1.3, I renamed it this in my pthreads development. I'm
+          referring to the use of ptrans in the parent... contrast
+          this with the later definition of ptrans in the
+          child.</li>
+
+          <li>subpool of permanent_pool</li>
+
+          <li>created at the beginning of a config "cycle"; exists
+          until the end of config parsing; passed to config-time
+          routines <em>via</em> cmd-&gt;temp_pool. Somewhat of a
+          "bastard child" because it isn't available everywhere.
+          Used for temporary scratch space which may be needed by
+          some config routines but which is deleted at the end of
+          config.</li>
+        </ul>
+      </dd>
+
+      <dt>pchild</dt>
+
+      <dd>
+        <ul>
+          <li>subpool of permanent_pool</li>
+
+          <li>created when a child is spawned (or a thread is
+          created); lives until that child (thread) is
+          destroyed</li>
+
+          <li>passed to the module child_init functions</li>
+
+          <li>destruction happens right after the child_exit
+          functions are called... (which may explain why I think
+          child_exit is redundant and unneeded)</li>
+        </ul>
+      </dd>
+
+      <dt>ptrans</dt>
+
+      <dd>
+        <ul>
+          <li>should be a subpool of pchild, but currently is a
+          subpool of permanent_pool, see above</li>
+
+          <li>cleared by the child before going into the accept()
+          loop to receive a connection</li>
+
+          <li>used as connection-&gt;pool</li>
+        </ul>
+      </dd>
+
+      <dt>r-&gt;pool</dt>
+
+      <dd>
+        <ul>
+          <li>for the main request this is a subpool of
+          connection-&gt;pool; for subrequests it is a subpool of
+          the parent request's pool.</li>
+
+          <li>exists until the end of the request (<em>i.e.</em>,
+          ap_destroy_sub_req, or in child_main after
+          process_request has finished)</li>
+
+          <li>note that r itself is allocated from r-&gt;pool;
+          <em>i.e.</em>, r-&gt;pool is first created and then r is
+          the first thing palloc()d from it</li>
+        </ul>
+      </dd>
+    </dl>
+
+    <p>For almost everything folks do, r-&gt;pool is the pool to
+    use. But you can see how other lifetimes, such as pchild, are
+    useful to some modules... such as modules that need to open a
+    database connection once per child, and wish to clean it up
+    when the child dies.</p>
+
+    <p>You can also see how some bugs have manifested themself,
+    such as setting connection-&gt;user to a value from r-&gt;pool
+    -- in this case connection exists for the lifetime of ptrans,
+    which is longer than r-&gt;pool (especially if r-&gt;pool is a
+    subrequest!). So the correct thing to do is to allocate from
+    connection-&gt;pool.</p>
+
+    <p>And there was another interesting bug in
+    mod_include/mod_cgi. You'll see in those that they do this test
+    to decide if they should use r-&gt;pool or r-&gt;main-&gt;pool.
+    In this case the resource that they are registering for cleanup
+    is a child process. If it were registered in r-&gt;pool, then
+    the code would wait() for the child when the subrequest
+    finishes. With mod_include this could be any old #include, and
+    the delay can be up to 3 seconds... and happened quite
+    frequently. Instead the subprocess is registered in
+    r-&gt;main-&gt;pool which causes it to be cleaned up when the
+    entire request is done -- <em>i.e.</em>, after the output has
+    been sent to the client and logging has happened.</p>
+
+    <h3><a id="pool-files" name="pool-files">Tracking open files,
+    etc.</a></h3>
+
+    <p>As indicated above, resource pools are also used to track
+    other sorts of resources besides memory. The most common are
+    open files. The routine which is typically used for this is
+    <code>ap_pfopen</code>, which takes a resource pool and two
+    strings as arguments; the strings are the same as the typical
+    arguments to <code>fopen</code>, <em>e.g.</em>,</p>
+<pre>
      ...
      FILE *f = ap_pfopen (r-&gt;pool, r-&gt;filename, "r");
 
      if (f == NULL) { ... } else { ... }
-</PRE>
-<P>
-There is also a <CODE>ap_popenf</CODE> routine, which parallels the
-lower-level <CODE>open</CODE> system call.  Both of these routines
-arrange for the file to be closed when the resource pool in question
-is cleared.
-</P>
-<P>
-Unlike the case for memory, there <EM>are</EM> functions to close
-files allocated with <CODE>ap_pfopen</CODE>, and <CODE>ap_popenf</CODE>,
-namely <CODE>ap_pfclose</CODE> and <CODE>ap_pclosef</CODE>.  (This is
-because, on many systems, the number of files which a single process
-can have open is quite limited).  It is important to use these
-functions to close files allocated with <CODE>ap_pfopen</CODE> and
-<CODE>ap_popenf</CODE>, since to do otherwise could cause fatal errors on
-systems such as Linux, which react badly if the same
-<CODE>FILE*</CODE> is closed more than once.
-</P>
-<P>
-(Using the <CODE>close</CODE> functions is not mandatory, since the
-file will eventually be closed regardless, but you should consider it
-in cases where your module is opening, or could open, a lot of files).
-</P>
-<H3>Other sorts of resources --- cleanup functions</H3>
-<BLOCKQUOTE>
-More text goes here.  Describe the the cleanup primitives in terms of
-which the file stuff is implemented; also, <CODE>spawn_process</CODE>.
-</BLOCKQUOTE>
-<P>
-Pool cleanups live until clear_pool() is called:  clear_pool(a) recursively
-calls destroy_pool() on all subpools of a; then calls all the cleanups for a; 
-then releases all the memory for a.  destroy_pool(a) calls clear_pool(a) 
-and then releases the pool structure itself.  <EM>i.e.</EM>, clear_pool(a) doesn't
-delete a, it just frees up all the resources and you can start using it
-again immediately. 
-</P>
-<H3>Fine control --- creating and dealing with sub-pools, with a note
-on sub-requests</H3>
-
-On rare occasions, too-free use of <CODE>ap_palloc()</CODE> and the
-associated primitives may result in undesirably profligate resource
-allocation.  You can deal with such a case by creating a
-<EM>sub-pool</EM>, allocating within the sub-pool rather than the main
-pool, and clearing or destroying the sub-pool, which releases the
-resources which were associated with it.  (This really <EM>is</EM> a
-rare situation; the only case in which it comes up in the standard
-module set is in case of listing directories, and then only with
-<EM>very</EM> large directories.  Unnecessary use of the primitives
-discussed here can hair up your code quite a bit, with very little
-gain). <P>
-
-The primitive for creating a sub-pool is <CODE>ap_make_sub_pool</CODE>,
-which takes another pool (the parent pool) as an argument.  When the
-main pool is cleared, the sub-pool will be destroyed.  The sub-pool
-may also be cleared or destroyed at any time, by calling the functions
-<CODE>ap_clear_pool</CODE> and <CODE>ap_destroy_pool</CODE>, respectively.
-(The difference is that <CODE>ap_clear_pool</CODE> frees resources
-associated with the pool, while <CODE>ap_destroy_pool</CODE> also
-deallocates the pool itself.  In the former case, you can allocate new
-resources within the pool, and clear it again, and so forth; in the
-latter case, it is simply gone). <P>
-
-One final note --- sub-requests have their own resource pools, which
-are sub-pools of the resource pool for the main request.  The polite
-way to reclaim the resources associated with a sub request which you
-have allocated (using the <CODE>ap_sub_req_...</CODE> functions)
-is <CODE>ap_destroy_sub_req</CODE>, which frees the resource pool.
-Before calling this function, be sure to copy anything that you care
-about which might be allocated in the sub-request's resource pool into
-someplace a little less volatile (for instance, the filename in its
-<CODE>request_rec</CODE> structure). <P>
-
-(Again, under most circumstances, you shouldn't feel obliged to call
-this function; only 2K of memory or so are allocated for a typical sub
-request, and it will be freed anyway when the main request pool is
-cleared.  It is only when you are allocating many, many sub-requests
-for a single main request that you should seriously consider the
-<CODE>ap_destroy_...</CODE> functions).
-
-<H2><A NAME="config">Configuration, commands and the like</A></H2>
-
-One of the design goals for this server was to maintain external
-compatibility with the NCSA 1.3 server --- that is, to read the same
-configuration files, to process all the directives therein correctly,
-and in general to be a drop-in replacement for NCSA.  On the other
-hand, another design goal was to move as much of the server's
-functionality into modules which have as little as possible to do with
-the monolithic server core.  The only way to reconcile these goals is
-to move the handling of most commands from the central server into the
-modules.  <P>
-
-However, just giving the modules command tables is not enough to
-divorce them completely from the server core.  The server has to
-remember the commands in order to act on them later.  That involves
-maintaining data which is private to the modules, and which can be
-either per-server, or per-directory.  Most things are per-directory,
-including in particular access control and authorization information,
-but also information on how to determine file types from suffixes,
-which can be modified by <CODE>AddType</CODE> and
-<CODE>DefaultType</CODE> directives, and so forth.  In general, the
-governing philosophy is that anything which <EM>can</EM> be made
-configurable by directory should be; per-server information is
-generally used in the standard set of modules for information like
-<CODE>Alias</CODE>es and <CODE>Redirect</CODE>s which come into play
-before the request is tied to a particular place in the underlying
-file system. <P>
-
-Another requirement for emulating the NCSA server is being able to
-handle the per-directory configuration files, generally called
-<CODE>.htaccess</CODE> files, though even in the NCSA server they can
-contain directives which have nothing at all to do with access
-control.  Accordingly, after URI -&gt; filename translation, but before
-performing any other phase, the server walks down the directory
-hierarchy of the underlying filesystem, following the translated
-pathname, to read any <CODE>.htaccess</CODE> files which might be
-present.  The information which is read in then has to be
-<EM>merged</EM> with the applicable information from the server's own
-config files (either from the <CODE>&lt;Directory&gt;</CODE> sections
-in <CODE>access.conf</CODE>, or from defaults in
-<CODE>srm.conf</CODE>, which actually behaves for most purposes almost
-exactly like <CODE>&lt;Directory /&gt;</CODE>).<P>
-
-Finally, after having served a request which involved reading
-<CODE>.htaccess</CODE> files, we need to discard the storage allocated
-for handling them.  That is solved the same way it is solved wherever
-else similar problems come up, by tying those structures to the
-per-transaction resource pool.  <P>
-
-<H3><A NAME="per-dir">Per-directory configuration structures</A></H3>
-
-Let's look out how all of this plays out in <CODE>mod_mime.c</CODE>,
-which defines the file typing handler which emulates the NCSA server's
-behavior of determining file types from suffixes.  What we'll be
-looking at, here, is the code which implements the
-<CODE>AddType</CODE> and <CODE>AddEncoding</CODE> commands.  These
-commands can appear in <CODE>.htaccess</CODE> files, so they must be
-handled in the module's private per-directory data, which in fact,
-consists of two separate <CODE>table</CODE>s for MIME types and
-encoding information, and is declared as follows:
-
-<PRE>
+</pre>
+
+    <p>There is also a <code>ap_popenf</code> routine, which
+    parallels the lower-level <code>open</code> system call. Both
+    of these routines arrange for the file to be closed when the
+    resource pool in question is cleared.</p>
+
+    <p>Unlike the case for memory, there <em>are</em> functions to
+    close files allocated with <code>ap_pfopen</code>, and
+    <code>ap_popenf</code>, namely <code>ap_pfclose</code> and
+    <code>ap_pclosef</code>. (This is because, on many systems, the
+    number of files which a single process can have open is quite
+    limited). It is important to use these functions to close files
+    allocated with <code>ap_pfopen</code> and
+    <code>ap_popenf</code>, since to do otherwise could cause fatal
+    errors on systems such as Linux, which react badly if the same
+    <code>FILE*</code> is closed more than once.</p>
+
+    <p>(Using the <code>close</code> functions is not mandatory,
+    since the file will eventually be closed regardless, but you
+    should consider it in cases where your module is opening, or
+    could open, a lot of files).</p>
+
+    <h3>Other sorts of resources --- cleanup functions</h3>
+
+    <blockquote>
+      More text goes here. Describe the the cleanup primitives in
+      terms of which the file stuff is implemented; also,
+      <code>spawn_process</code>.
+    </blockquote>
+
+    <p>Pool cleanups live until clear_pool() is called:
+    clear_pool(a) recursively calls destroy_pool() on all subpools
+    of a; then calls all the cleanups for a; then releases all the
+    memory for a. destroy_pool(a) calls clear_pool(a) and then
+    releases the pool structure itself. <em>i.e.</em>,
+    clear_pool(a) doesn't delete a, it just frees up all the
+    resources and you can start using it again immediately.</p>
+
+    <h3>Fine control --- creating and dealing with sub-pools, with
+    a note on sub-requests</h3>
+    On rare occasions, too-free use of <code>ap_palloc()</code> and
+    the associated primitives may result in undesirably profligate
+    resource allocation. You can deal with such a case by creating
+    a <em>sub-pool</em>, allocating within the sub-pool rather than
+    the main pool, and clearing or destroying the sub-pool, which
+    releases the resources which were associated with it. (This
+    really <em>is</em> a rare situation; the only case in which it
+    comes up in the standard module set is in case of listing
+    directories, and then only with <em>very</em> large
+    directories. Unnecessary use of the primitives discussed here
+    can hair up your code quite a bit, with very little gain). 
+
+    <p>The primitive for creating a sub-pool is
+    <code>ap_make_sub_pool</code>, which takes another pool (the
+    parent pool) as an argument. When the main pool is cleared, the
+    sub-pool will be destroyed. The sub-pool may also be cleared or
+    destroyed at any time, by calling the functions
+    <code>ap_clear_pool</code> and <code>ap_destroy_pool</code>,
+    respectively. (The difference is that
+    <code>ap_clear_pool</code> frees resources associated with the
+    pool, while <code>ap_destroy_pool</code> also deallocates the
+    pool itself. In the former case, you can allocate new resources
+    within the pool, and clear it again, and so forth; in the
+    latter case, it is simply gone).</p>
+
+    <p>One final note --- sub-requests have their own resource
+    pools, which are sub-pools of the resource pool for the main
+    request. The polite way to reclaim the resources associated
+    with a sub request which you have allocated (using the
+    <code>ap_sub_req_...</code> functions) is
+    <code>ap_destroy_sub_req</code>, which frees the resource pool.
+    Before calling this function, be sure to copy anything that you
+    care about which might be allocated in the sub-request's
+    resource pool into someplace a little less volatile (for
+    instance, the filename in its <code>request_rec</code>
+    structure).</p>
+
+    <p>(Again, under most circumstances, you shouldn't feel obliged
+    to call this function; only 2K of memory or so are allocated
+    for a typical sub request, and it will be freed anyway when the
+    main request pool is cleared. It is only when you are
+    allocating many, many sub-requests for a single main request
+    that you should seriously consider the
+    <code>ap_destroy_...</code> functions).</p>
+
+    <h2><a id="config" name="config">Configuration, commands and
+    the like</a></h2>
+    One of the design goals for this server was to maintain
+    external compatibility with the NCSA 1.3 server --- that is, to
+    read the same configuration files, to process all the
+    directives therein correctly, and in general to be a drop-in
+    replacement for NCSA. On the other hand, another design goal
+    was to move as much of the server's functionality into modules
+    which have as little as possible to do with the monolithic
+    server core. The only way to reconcile these goals is to move
+    the handling of most commands from the central server into the
+    modules. 
+
+    <p>However, just giving the modules command tables is not
+    enough to divorce them completely from the server core. The
+    server has to remember the commands in order to act on them
+    later. That involves maintaining data which is private to the
+    modules, and which can be either per-server, or per-directory.
+    Most things are per-directory, including in particular access
+    control and authorization information, but also information on
+    how to determine file types from suffixes, which can be
+    modified by <code>AddType</code> and <code>DefaultType</code>
+    directives, and so forth. In general, the governing philosophy
+    is that anything which <em>can</em> be made configurable by
+    directory should be; per-server information is generally used
+    in the standard set of modules for information like
+    <code>Alias</code>es and <code>Redirect</code>s which come into
+    play before the request is tied to a particular place in the
+    underlying file system.</p>
+
+    <p>Another requirement for emulating the NCSA server is being
+    able to handle the per-directory configuration files, generally
+    called <code>.htaccess</code> files, though even in the NCSA
+    server they can contain directives which have nothing at all to
+    do with access control. Accordingly, after URI -&gt; filename
+    translation, but before performing any other phase, the server
+    walks down the directory hierarchy of the underlying
+    filesystem, following the translated pathname, to read any
+    <code>.htaccess</code> files which might be present. The
+    information which is read in then has to be <em>merged</em>
+    with the applicable information from the server's own config
+    files (either from the <code>&lt;Directory&gt;</code> sections
+    in <code>access.conf</code>, or from defaults in
+    <code>srm.conf</code>, which actually behaves for most purposes
+    almost exactly like <code>&lt;Directory /&gt;</code>).</p>
+
+    <p>Finally, after having served a request which involved
+    reading <code>.htaccess</code> files, we need to discard the
+    storage allocated for handling them. That is solved the same
+    way it is solved wherever else similar problems come up, by
+    tying those structures to the per-transaction resource
+    pool.</p>
+
+    <h3><a id="per-dir" name="per-dir">Per-directory configuration
+    structures</a></h3>
+    Let's look out how all of this plays out in
+    <code>mod_mime.c</code>, which defines the file typing handler
+    which emulates the NCSA server's behavior of determining file
+    types from suffixes. What we'll be looking at, here, is the
+    code which implements the <code>AddType</code> and
+    <code>AddEncoding</code> commands. These commands can appear in
+    <code>.htaccess</code> files, so they must be handled in the
+    module's private per-directory data, which in fact, consists of
+    two separate <code>table</code>s for MIME types and encoding
+    information, and is declared as follows: 
+<pre>
 typedef struct {
     table *forced_types;      /* Additional AddTyped stuff */
     table *encoding_types;    /* Added with AddEncoding... */
 } mime_dir_config;
-</PRE>
-
-When the server is reading a configuration file, or
-<CODE>&lt;Directory&gt;</CODE> section, which includes one of the MIME
-module's commands, it needs to create a <CODE>mime_dir_config</CODE>
-structure, so those commands have something to act on.  It does this
-by invoking the function it finds in the module's `create per-dir
-config slot', with two arguments: the name of the directory to which
-this configuration information applies (or <CODE>NULL</CODE> for
-<CODE>srm.conf</CODE>), and a pointer to a resource pool in which the
-allocation should happen. <P>
-
-(If we are reading a <CODE>.htaccess</CODE> file, that resource pool
-is the per-request resource pool for the request; otherwise it is a
-resource pool which is used for configuration data, and cleared on
-restarts.  Either way, it is important for the structure being created
-to vanish when the pool is cleared, by registering a cleanup on the
-pool if necessary). <P>
-
-For the MIME module, the per-dir config creation function just
-<CODE>ap_palloc</CODE>s the structure above, and a creates a couple of
-<CODE>table</CODE>s to fill it.  That looks like this:
-
-<PRE>
+</pre>
+    When the server is reading a configuration file, or
+    <code>&lt;Directory&gt;</code> section, which includes one of
+    the MIME module's commands, it needs to create a
+    <code>mime_dir_config</code> structure, so those commands have
+    something to act on. It does this by invoking the function it
+    finds in the module's `create per-dir config slot', with two
+    arguments: the name of the directory to which this
+    configuration information applies (or <code>NULL</code> for
+    <code>srm.conf</code>), and a pointer to a resource pool in
+    which the allocation should happen. 
+
+    <p>(If we are reading a <code>.htaccess</code> file, that
+    resource pool is the per-request resource pool for the request;
+    otherwise it is a resource pool which is used for configuration
+    data, and cleared on restarts. Either way, it is important for
+    the structure being created to vanish when the pool is cleared,
+    by registering a cleanup on the pool if necessary).</p>
+
+    <p>For the MIME module, the per-dir config creation function
+    just <code>ap_palloc</code>s the structure above, and a creates
+    a couple of <code>table</code>s to fill it. That looks like
+    this:</p>
+<pre>
 void *create_mime_dir_config (pool *p, char *dummy)
 {
     mime_dir_config *new =
@@ -942,24 +1021,24 @@ void *create_mime_dir_config (pool *p, char *dummy)
 
     return new;
 }
-</PRE>
-
-Now, suppose we've just read in a <CODE>.htaccess</CODE> file.  We
-already have the per-directory configuration structure for the next
-directory up in the hierarchy.  If the <CODE>.htaccess</CODE> file we
-just read in didn't have any <CODE>AddType</CODE> or
-<CODE>AddEncoding</CODE> commands, its per-directory config structure
-for the MIME module is still valid, and we can just use it.
-Otherwise, we need to merge the two structures somehow. <P>
-
-To do that, the server invokes the module's per-directory config merge
-function, if one is present.  That function takes three arguments:
-the two structures being merged, and a resource pool in which to
-allocate the result.  For the MIME module, all that needs to be done
-is overlay the tables from the new per-directory config structure with
-those from the parent:
-
-<PRE>
+</pre>
+    Now, suppose we've just read in a <code>.htaccess</code> file.
+    We already have the per-directory configuration structure for
+    the next directory up in the hierarchy. If the
+    <code>.htaccess</code> file we just read in didn't have any
+    <code>AddType</code> or <code>AddEncoding</code> commands, its
+    per-directory config structure for the MIME module is still
+    valid, and we can just use it. Otherwise, we need to merge the
+    two structures somehow. 
+
+    <p>To do that, the server invokes the module's per-directory
+    config merge function, if one is present. That function takes
+    three arguments: the two structures being merged, and a
+    resource pool in which to allocate the result. For the MIME
+    module, all that needs to be done is overlay the tables from
+    the new per-directory config structure with those from the
+    parent:</p>
+<pre>
 void *merge_mime_dir_configs (pool *p, void *parent_dirv, void *subdirv)
 {
     mime_dir_config *parent_dir = (mime_dir_config *)parent_dirv;
@@ -974,118 +1053,121 @@ void *merge_mime_dir_configs (pool *p, void *parent_dirv, void *subdirv)
 
     return new;
 }
-</PRE>
-
-As a note --- if there is no per-directory merge function present, the
-server will just use the subdirectory's configuration info, and ignore
-the parent's.  For some modules, that works just fine (<EM>e.g.</EM>, for the
-includes module, whose per-directory configuration information
-consists solely of the state of the <CODE>XBITHACK</CODE>), and for
-those modules, you can just not declare one, and leave the
-corresponding structure slot in the module itself <CODE>NULL</CODE>.<P>
-
-<H3><A NAME="commands">Command handling</A></H3>
-
-Now that we have these structures, we need to be able to figure out
-how to fill them.  That involves processing the actual
-<CODE>AddType</CODE> and <CODE>AddEncoding</CODE> commands.  To find
-commands, the server looks in the module's <CODE>command table</CODE>.
-That table contains information on how many arguments the commands
-take, and in what formats, where it is permitted, and so forth.  That
-information is sufficient to allow the server to invoke most
-command-handling functions with pre-parsed arguments.  Without further
-ado, let's look at the <CODE>AddType</CODE> command handler, which
-looks like this (the <CODE>AddEncoding</CODE> command looks basically
-the same, and won't be shown here):
-
-<PRE>
+</pre>
+    As a note --- if there is no per-directory merge function
+    present, the server will just use the subdirectory's
+    configuration info, and ignore the parent's. For some modules,
+    that works just fine (<em>e.g.</em>, for the includes module,
+    whose per-directory configuration information consists solely
+    of the state of the <code>XBITHACK</code>), and for those
+    modules, you can just not declare one, and leave the
+    corresponding structure slot in the module itself
+    <code>NULL</code>. 
+
+    <h3><a id="commands" name="commands">Command handling</a></h3>
+    Now that we have these structures, we need to be able to figure
+    out how to fill them. That involves processing the actual
+    <code>AddType</code> and <code>AddEncoding</code> commands. To
+    find commands, the server looks in the module's <code>command
+    table</code>. That table contains information on how many
+    arguments the commands take, and in what formats, where it is
+    permitted, and so forth. That information is sufficient to
+    allow the server to invoke most command-handling functions with
+    pre-parsed arguments. Without further ado, let's look at the
+    <code>AddType</code> command handler, which looks like this
+    (the <code>AddEncoding</code> command looks basically the same,
+    and won't be shown here): 
+<pre>
 char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct, char *ext)
 {
     if (*ext == '.') ++ext;
     ap_table_set (m-&gt;forced_types, ext, ct);
     return NULL;
 }
-</PRE>
-
-This command handler is unusually simple.  As you can see, it takes
-four arguments, two of which are pre-parsed arguments, the third being
-the per-directory configuration structure for the module in question,
-and the fourth being a pointer to a <CODE>cmd_parms</CODE> structure.
-That structure contains a bunch of arguments which are frequently of
-use to some, but not all, commands, including a resource pool (from
-which memory can be allocated, and to which cleanups should be tied),
-and the (virtual) server being configured, from which the module's
-per-server configuration data can be obtained if required.<P>
-
-Another way in which this particular command handler is unusually
-simple is that there are no error conditions which it can encounter.
-If there were, it could return an error message instead of
-<CODE>NULL</CODE>; this causes an error to be printed out on the
-server's <CODE>stderr</CODE>, followed by a quick exit, if it is in
-the main config files; for a <CODE>.htaccess</CODE> file, the syntax
-error is logged in the server error log (along with an indication of
-where it came from), and the request is bounced with a server error
-response (HTTP error status, code 500). <P>
-
-The MIME module's command table has entries for these commands, which
-look like this:
-
-<PRE>
+</pre>
+    This command handler is unusually simple. As you can see, it
+    takes four arguments, two of which are pre-parsed arguments,
+    the third being the per-directory configuration structure for
+    the module in question, and the fourth being a pointer to a
+    <code>cmd_parms</code> structure. That structure contains a
+    bunch of arguments which are frequently of use to some, but not
+    all, commands, including a resource pool (from which memory can
+    be allocated, and to which cleanups should be tied), and the
+    (virtual) server being configured, from which the module's
+    per-server configuration data can be obtained if required. 
+
+    <p>Another way in which this particular command handler is
+    unusually simple is that there are no error conditions which it
+    can encounter. If there were, it could return an error message
+    instead of <code>NULL</code>; this causes an error to be
+    printed out on the server's <code>stderr</code>, followed by a
+    quick exit, if it is in the main config files; for a
+    <code>.htaccess</code> file, the syntax error is logged in the
+    server error log (along with an indication of where it came
+    from), and the request is bounced with a server error response
+    (HTTP error status, code 500).</p>
+
+    <p>The MIME module's command table has entries for these
+    commands, which look like this:</p>
+<pre>
 command_rec mime_cmds[] = {
 { "AddType", add_type, NULL, OR_FILEINFO, TAKE2,
     "a mime type followed by a file extension" },
 { "AddEncoding", add_encoding, NULL, OR_FILEINFO, TAKE2,
-    "an encoding (<EM>e.g.</EM>, gzip), followed by a file extension" },
+    "an encoding (<em>e.g.</em>, gzip), followed by a file extension" },
 { NULL }
 };
-</PRE>
-
-The entries in these tables are:
-
-<UL>
-  <LI> The name of the command
-  <LI> The function which handles it
-  <LI> a <CODE>(void *)</CODE> pointer, which is passed in the
-       <CODE>cmd_parms</CODE> structure to the command handler ---
-       this is useful in case many similar commands are handled by the
-       same function.
-  <LI> A bit mask indicating where the command may appear.  There are
-       mask bits corresponding to each <CODE>AllowOverride</CODE>
-       option, and an additional mask bit, <CODE>RSRC_CONF</CODE>,
-       indicating that the command may appear in the server's own
-       config files, but <EM>not</EM> in any <CODE>.htaccess</CODE>
-       file.
-  <LI> A flag indicating how many arguments the command handler wants
-       pre-parsed, and how they should be passed in.
-       <CODE>TAKE2</CODE> indicates two pre-parsed arguments.  Other
-       options are <CODE>TAKE1</CODE>, which indicates one pre-parsed
-       argument, <CODE>FLAG</CODE>, which indicates that the argument
-       should be <CODE>On</CODE> or <CODE>Off</CODE>, and is passed in
-       as a boolean flag, <CODE>RAW_ARGS</CODE>, which causes the
-       server to give the command the raw, unparsed arguments
-       (everything but the command name itself).  There is also
-       <CODE>ITERATE</CODE>, which means that the handler looks the
-       same as <CODE>TAKE1</CODE>, but that if multiple arguments are
-       present, it should be called multiple times, and finally
-       <CODE>ITERATE2</CODE>, which indicates that the command handler
-       looks like a <CODE>TAKE2</CODE>, but if more arguments are
-       present, then it should be called multiple times, holding the
-       first argument constant.
-  <LI> Finally, we have a string which describes the arguments that
-       should be present.  If the arguments in the actual config file
-       are not as required, this string will be used to help give a
-       more specific error message.  (You can safely leave this
-       <CODE>NULL</CODE>).
-</UL>
-
-Finally, having set this all up, we have to use it.  This is
-ultimately done in the module's handlers, specifically for its
-file-typing handler, which looks more or less like this; note that the
-per-directory configuration structure is extracted from the
-<CODE>request_rec</CODE>'s per-directory configuration vector by using
-the <CODE>ap_get_module_config</CODE> function.
-
-<PRE>
+</pre>
+    The entries in these tables are: 
+
+    <ul>
+      <li>The name of the command</li>
+
+      <li>The function which handles it</li>
+
+      <li>a <code>(void *)</code> pointer, which is passed in the
+      <code>cmd_parms</code> structure to the command handler ---
+      this is useful in case many similar commands are handled by
+      the same function.</li>
+
+      <li>A bit mask indicating where the command may appear. There
+      are mask bits corresponding to each
+      <code>AllowOverride</code> option, and an additional mask
+      bit, <code>RSRC_CONF</code>, indicating that the command may
+      appear in the server's own config files, but <em>not</em> in
+      any <code>.htaccess</code> file.</li>
+
+      <li>A flag indicating how many arguments the command handler
+      wants pre-parsed, and how they should be passed in.
+      <code>TAKE2</code> indicates two pre-parsed arguments. Other
+      options are <code>TAKE1</code>, which indicates one
+      pre-parsed argument, <code>FLAG</code>, which indicates that
+      the argument should be <code>On</code> or <code>Off</code>,
+      and is passed in as a boolean flag, <code>RAW_ARGS</code>,
+      which causes the server to give the command the raw, unparsed
+      arguments (everything but the command name itself). There is
+      also <code>ITERATE</code>, which means that the handler looks
+      the same as <code>TAKE1</code>, but that if multiple
+      arguments are present, it should be called multiple times,
+      and finally <code>ITERATE2</code>, which indicates that the
+      command handler looks like a <code>TAKE2</code>, but if more
+      arguments are present, then it should be called multiple
+      times, holding the first argument constant.</li>
+
+      <li>Finally, we have a string which describes the arguments
+      that should be present. If the arguments in the actual config
+      file are not as required, this string will be used to help
+      give a more specific error message. (You can safely leave
+      this <code>NULL</code>).</li>
+    </ul>
+    Finally, having set this all up, we have to use it. This is
+    ultimately done in the module's handlers, specifically for its
+    file-typing handler, which looks more or less like this; note
+    that the per-directory configuration structure is extracted
+    from the <code>request_rec</code>'s per-directory configuration
+    vector by using the <code>ap_get_module_config</code> function.
+    
+<pre>
 int find_ct(request_rec *r)
 {
     int i;
@@ -1121,29 +1203,29 @@ int find_ct(request_rec *r)
     return OK;
 }
 
-</PRE>
-
-<H3><A NAME="servconf">Side notes --- per-server configuration, virtual
servers, <EM>etc</EM>.</A></H3>
-
-The basic ideas behind per-server module configuration are basically
-the same as those for per-directory configuration; there is a creation
-function and a merge function, the latter being invoked where a
-virtual server has partially overridden the base server configuration,
-and a combined structure must be computed.  (As with per-directory
-configuration, the default if no merge function is specified, and a
-module is configured in some virtual server, is that the base
-configuration is simply ignored). <P>
-
-The only substantial difference is that when a command needs to
-configure the per-server private module data, it needs to go to the
-<CODE>cmd_parms</CODE> data to get at it.  Here's an example, from the
-alias module, which also indicates how a syntax error can be returned
-(note that the per-directory configuration argument to the command
-handler is declared as a dummy, since the module doesn't actually have
-per-directory config data):
-
-<PRE>
+</pre>
+
+    <h3><a id="servconf" name="servconf">Side notes --- per-server
   configuration, virtual servers, <em>etc</em>.</a></h3>
+    The basic ideas behind per-server module configuration are
+    basically the same as those for per-directory configuration;
+    there is a creation function and a merge function, the latter
+    being invoked where a virtual server has partially overridden
+    the base server configuration, and a combined structure must be
+    computed. (As with per-directory configuration, the default if
+    no merge function is specified, and a module is configured in
+    some virtual server, is that the base configuration is simply
+    ignored). 
+
+    <p>The only substantial difference is that when a command needs
+    to configure the per-server private module data, it needs to go
+    to the <code>cmd_parms</code> data to get at it. Here's an
+    example, from the alias module, which also indicates how a
+    syntax error can be returned (note that the per-directory
+    configuration argument to the command handler is declared as a
+    dummy, since the module doesn't actually have per-directory
+    config data):</p>
+<pre>
 char *add_redirect(cmd_parms *cmd, void *dummy, char *f, char *url)
 {
     server_rec *s = cmd-&gt;server;
@@ -1156,6 +1238,8 @@ char *add_redirect(cmd_parms *cmd, void *dummy, char *f, char *url)
     new-&gt;fake = f; new-&gt;real = url;
     return NULL;
 }
-</PRE>
-<!--#include virtual="footer.html" -->
-</BODY></HTML>
+</pre>
+    <!--#include virtual="footer.html" -->
+  </body>
+</html>
+
index 12d2d11eeba9b40370406f1a9a60a7de7a5eddc6..79594dfbe57d25457a823fdf4dc5b12560be67ad 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<HTML>
-<HEAD>
-<TITLE>Debugging Memory Allocation in APR</TITLE>
-</HEAD>
-
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-
-<!--#include virtual="header.html" -->
-
-<H1 ALIGN="CENTER">Debugging Memory Allocation in APR<br></H1>
-
-<p>The allocation mechanism's within APR have a number of debugging
-modes that can be used to assist in finding memory problems.  This document describes
-the modes available and gives instructions on activating them.</p>
-
-<ul>
-<li><a href="#options">Available debugging options</a></li>
-<li><a href="#combo">Allowable combinations</a></li>
-<li><a href="#howto">How to activate debugging</a></li>
-</ul>
-
-<hr>
-<a name="options">
-<h2>Allocation Debugging</h2>
-
-<h3>ALLOC_DEBUG</h3>
-<p><em>Debugging support: Define this to enable code which helps detect re-use of freed memory and other such nonsense.</em></p>
-
-<p>The theory is simple.  The FILL_BYTE (0xa5) is written over all malloc'd memory as we receive it, and is written over everything that we free up during a clear_pool.  We check that blocks on the free list always have the FILL_BYTE in them, and we check during palloc() that the bytes still have FILL_BYTE in them.  If you ever see garbage URLs or whatnot containing lots of 0xa5s then you know something used data that's been freed or uninitialized.</p>
-
-<h2>Malloc Support</h2>
-<h3>ALLOC_USE_MALLOC</h3>
-<p><em>If defined all allocations will be done with malloc and free()d appropriately at the end.
-</em></p>
-
-<p>This is intended to be used with something like Electric Fence or Purify to help detect memory problems.  Note that if you're using efence then you should also add in ALLOC_DEBUG.  But don't add in ALLOC_DEBUG if you're using Purify because ALLOC_DEBUG would hide all the uninitialized read errors that Purify can diagnose.</p>
-
-<h2>Pool Debugging</h2>
-<h3>POOL_DEBUG</h3>
-<p><em>This is intended to detect cases where the wrong pool is used when assigning data to an object in another pool.</em></p>
-
-<p>In particular, it causes the table_{set,add,merge}n routines to check that their arguments are safe for the apr_table_t they're being placed in.  It currently only works with the unix multiprocess model, but could be extended to others.</p>
-
-<h2>Table Debugging</h2>
-<h3>MAKE_TABLE_PROFILE</h3>
-<p><em>Provide diagnostic information about make_table() calls which are possibly too small.</em></p>
-
-<p>This requires a recent gcc which supports __builtin_return_address().  The error_log output will be a message such as: </p>
-<pre>table_push: apr_table_t created by 0x804d874 hit limit of 10</pre>
-<p>Use "<em><strong>l *0x804d874</strong></em>" to find the source that corresponds to.  It
- indicates that a apr_table_t allocated by a call at that address has possibly too small an initial apr_table_t size guess.</p>
-
-<h2>Allocation Statistics</h2>
-<h3>ALLOC_STATS</h3>
-<p><em>Provide some statistics on the cost of allocations.</em></p>
-
-<p>This requires a bit of an understanding of how alloc.c works.</p>
-
-<hr>
-
-<a name="combo">
-<h2>Allowable Combinations</h2>
-
-<p>Not all the options outlined above can be activated at the same time.  the following table gives more information.</p>
-
-<p align="center">
-<table width="80%">
-<tr>
-<th width="25%">Option 1</th>
-<th width="15%">ALLOC<br>DEBUG</th>
-<th width="15%">ALLOC<br>USE<br>MALLOC</th>
-<th width="15%">POOL<br>DEBUG</th>
-<th width="15%">MAKE<br>TABLE<br>PROFILE</th>
-<th width="15%">ALLOC<br>STATS</th>
-</tr>
-<tr>
-<td>ALLOC_DEBUG</td>
-<td bgcolor="#ff0000">&nbsp;</td>
-<td align="center">No</td>
-<td align="center">Yes</td>
-<td align="center">Yes</td>
-<td align="center">Yes</td>
-</tr>
-<tr>
-<td>ALLOC_USE<br>MALLOC</td>
-<td align="center">No</td>
-<td bgcolor="#ff0000">&nbsp;</td>
-<td align="center">No</td>
-<td align="center">No</td>
-<td align="center">No</td>
-</tr>
-<tr>
-<td>POOL_DEBUG</td>
-<td align="center">Yes</td>
-<td align="center">No</td>
-<td bgcolor="#ff0000">&nbsp;</td>
-<td align="center">Yes</td>
-<td align="center">Yes</td>
-</tr>
-<tr>
-<td>MAKE_TABLE<br>PROFILE</td>
-<td align="center">Yes</td>
-<td align="center">No</td>
-<td align="center">Yes</td>
-<td bgcolor="#ff0000">&nbsp;</td>
-<td align="center">Yes</td>
-</tr>
-<tr>
-<td>ALLOC_STATS</td>
-<td align="center">Yes</td>
-<td align="center">No</td>
-<td align="center">Yes</td>
-<td align="center">Yes</td>
-<td bgcolor="#ff0000">&nbsp;</td>
-</tr>
-
-</table>
-
-<p>Additionally the debugging options are not suitable for multi-threaded versions of the server.  When trying to debug with these options the server should be started in single process mode.</p>
-
-<hr>
-
-<a name="howto">
-<h2>Activating Debugging Options</h2>
-<p>The various options for debugging memory are now enabled in the apr_general.h header file in APR.  The various options are enabled by uncommenting the define for the option you wish to use.  The section of the code currently looks like this <em>(contained in srclib/apr/include/apr_pools.h)</em></p>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Debugging Memory Allocation in APR</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <h1 align="CENTER">Debugging Memory Allocation in APR<br />
+    </h1>
+
+    <p>The allocation mechanism's within APR have a number of
+    debugging modes that can be used to assist in finding memory
+    problems. This document describes the modes available and gives
+    instructions on activating them.</p>
+
+    <ul>
+      <li><a href="#options">Available debugging options</a></li>
+
+      <li><a href="#combo">Allowable combinations</a></li>
+
+      <li><a href="#howto">How to activate debugging</a></li>
+    </ul>
+    <hr />
+
+    <h2>Allocation Debugging</h2>
+
+    <h3>ALLOC_DEBUG</h3>
+
+    <p><em>Debugging support: Define this to enable code which
+    helps detect re-use of freed memory and other such
+    nonsense.</em></p>
+
+    <p>The theory is simple. The FILL_BYTE (0xa5) is written over
+    all malloc'd memory as we receive it, and is written over
+    everything that we free up during a clear_pool. We check that
+    blocks on the free list always have the FILL_BYTE in them, and
+    we check during palloc() that the bytes still have FILL_BYTE in
+    them. If you ever see garbage URLs or whatnot containing lots
+    of 0xa5s then you know something used data that's been freed or
+    uninitialized.</p>
+
+    <h2>Malloc Support</h2>
+
+    <h3>ALLOC_USE_MALLOC</h3>
+
+    <p><em>If defined all allocations will be done with malloc and
+    free()d appropriately at the end.</em></p>
+
+    <p>This is intended to be used with something like Electric
+    Fence or Purify to help detect memory problems. Note that if
+    you're using efence then you should also add in ALLOC_DEBUG.
+    But don't add in ALLOC_DEBUG if you're using Purify because
+    ALLOC_DEBUG would hide all the uninitialized read errors that
+    Purify can diagnose.</p>
+
+    <h2>Pool Debugging</h2>
+
+    <h3>POOL_DEBUG</h3>
+
+    <p><em>This is intended to detect cases where the wrong pool is
+    used when assigning data to an object in another pool.</em></p>
+
+    <p>In particular, it causes the table_{set,add,merge}n routines
+    to check that their arguments are safe for the apr_table_t
+    they're being placed in. It currently only works with the unix
+    multiprocess model, but could be extended to others.</p>
+
+    <h2>Table Debugging</h2>
+
+    <h3>MAKE_TABLE_PROFILE</h3>
+
+    <p><em>Provide diagnostic information about make_table() calls
+    which are possibly too small.</em></p>
+
+    <p>This requires a recent gcc which supports
+    __builtin_return_address(). The error_log output will be a
+    message such as:</p>
+<pre>
+table_push: apr_table_t created by 0x804d874 hit limit of 10
+</pre>
+
+    <p>Use "<em><strong>l *0x804d874</strong></em>" to find the
+    source that corresponds to. It indicates that a apr_table_t
+    allocated by a call at that address has possibly too small an
+    initial apr_table_t size guess.</p>
+
+    <h2>Allocation Statistics</h2>
+
+    <h3>ALLOC_STATS</h3>
+
+    <p><em>Provide some statistics on the cost of
+    allocations.</em></p>
+
+    <p>This requires a bit of an understanding of how alloc.c
+    works.</p>
+    <hr />
+
+    <h2>Allowable Combinations</h2>
+
+    <p>Not all the options outlined above can be activated at the
+    same time. the following table gives more information.</p>
+
+    <table width="80%">
+      <tr>
+        <th width="25%">Option 1</th>
+
+        <th width="15%">ALLOC<br />
+         DEBUG</th>
+
+        <th width="15%">ALLOC<br />
+         USE<br />
+         MALLOC</th>
+
+        <th width="15%">POOL<br />
+         DEBUG</th>
+
+        <th width="15%">MAKE<br />
+         TABLE<br />
+         PROFILE</th>
+
+        <th width="15%">ALLOC<br />
+         STATS</th>
+      </tr>
+
+      <tr>
+        <td>ALLOC_DEBUG</td>
+
+        <td bgcolor="#ff0000">&nbsp;</td>
+
+        <td align="center">No</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">Yes</td>
+      </tr>
+
+      <tr>
+        <td>ALLOC_USE<br />
+         MALLOC</td>
+
+        <td align="center">No</td>
+
+        <td bgcolor="#ff0000">&nbsp;</td>
+
+        <td align="center">No</td>
+
+        <td align="center">No</td>
+
+        <td align="center">No</td>
+      </tr>
+
+      <tr>
+        <td>POOL_DEBUG</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">No</td>
+
+        <td bgcolor="#ff0000">&nbsp;</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">Yes</td>
+      </tr>
+
+      <tr>
+        <td>MAKE_TABLE<br />
+         PROFILE</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">No</td>
+
+        <td align="center">Yes</td>
+
+        <td bgcolor="#ff0000">&nbsp;</td>
+
+        <td align="center">Yes</td>
+      </tr>
+
+      <tr>
+        <td>ALLOC_STATS</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">No</td>
+
+        <td align="center">Yes</td>
+
+        <td align="center">Yes</td>
+
+        <td bgcolor="#ff0000">&nbsp;</td>
+      </tr>
+    </table>
+
+    <p>Additionally the debugging options are not suitable for
+    multi-threaded versions of the server. When trying to debug
+    with these options the server should be started in single
+    process mode.</p>
+    <hr />
+
+    <h2>Activating Debugging Options</h2>
+
+    <p>The various options for debugging memory are now enabled in
+    the apr_general.h header file in APR. The various options are
+    enabled by uncommenting the define for the option you wish to
+    use. The section of the code currently looks like this
+    <em>(contained in srclib/apr/include/apr_pools.h)</em></p>
 <pre>
 /*
 #define ALLOC_DEBUG
@@ -162,17 +246,12 @@ typedef struct ap_pool_t {
 }ap_pool_t;
 </pre>
 
-<p>To enable allocation debugging simply move the #define ALLOC_DEBUG above the start of the comments block and rebuild the server.</p>
-
-<strong>NB. In order to use the various options the server MUST be rebuilt after editing the header file.
-</strong>
-
-<!--#include virtual="footer.html" -->
-
-</body>
+    <p>To enable allocation debugging simply move the #define
+    ALLOC_DEBUG above the start of the comments block and rebuild
+    the server.</p>
+    <strong>NB. In order to use the various options the server MUST
+    be rebuilt after editing the header file.</strong> 
+    <!--#include virtual="footer.html" -->
+  </body>
 </html>
 
-
-
-
-
index 9cb7017b843496842ccc598882eac26def899737..a342a62afe58f10008e8777650ca4f03c545078e 100644 (file)
@@ -1,38 +1,42 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>Documenting Apache 2.0</title>
-</head>
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<!--#include virtual="header.html" -->
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
 
-<h1 align="center">Documentating Apache 2.0</h1>
+    <title>Documenting Apache 2.0</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
 
-<p>Apache 2.0 uses DoxyGen to document the API's and global variables in the
-   the code.  This will explain the basics of how to document using DoxyGen.
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
 
-<p>To start a documentation block, use /**<br />
-   To end a documentation block, use */</p>
+    <h1 align="center">Documentating Apache 2.0</h1>
 
-<p>In the middle of the block, there are multiple tags we can use:</p>
+    <p>Apache 2.0 uses DoxyGen to document the API's and global
+    variables in the the code. This will explain the basics of how
+    to document using DoxyGen.</p>
+
+    <p>To start a documentation block, use /**<br />
+     To end a documentation block, use */</p>
+
+    <p>In the middle of the block, there are multiple tags we can
+    use:</p>
 <pre>
     Description of this functions purpose
     @param parameter_name description
-</p>
 
-<p>The deffunc is not always necessary.  DoxyGen does not have a full parser 
+
+<br />
+The deffunc is not always necessary.  DoxyGen does not have a full parser 
    in it, so any prototype that use a macro in the return type declaration 
-   is too complex for scandoc.  Those functions require a deffunc.</p>
+   is too complex for scandoc.  Those functions require a deffunc.
 
-<p>An example (using &amp;gt; rather than &gt;):</p>
+<br />
+An example (using &amp;gt; rather than &gt;):
+</pre>
 <pre>
 /**
  * return the final element of the pathname
  * @deffunc const char * ap_filename_of_pathname(const char *pathname)
  */
 </pre>
-
-<p>At the top of the header file, always include:</p>
+<pre>
+<br />
+At the top of the header file, always include:
+</pre>
 <pre>
 /**
  * @package Name of library header
  */
 </pre>
-
-<p>ScanDoc uses a new html file for each package.  The html files are named
-   {Name_of_library_header}.html, so try to be concise with your names.</p>
+<pre>
+<br />
+ScanDoc uses a new html file for each package.  The html files are named
+   {Name_of_library_header}.html, so try to be concise with your names.
  
 <!--#include virtual="footer.html" -->
-</body>
+</pre>
+  </body>
 </html>
+
index 1e5f739ebe35aee950cac4c83991a7d6dc33664d..edcc022ccc5b85ef36ea6d4a28ff30ed3c9a93c6 100644 (file)
@@ -1,8 +1,19 @@
-<HR>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<H3 ALIGN="CENTER">
- Apache HTTP Server Version 2.0 
-</H3>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title></title>
+  </head>
+
+  <body>
+    <hr />
+
+    <h3 align="CENTER">Apache HTTP Server Version 2.0</h3>
+    <a href="./"><img src="../images/index.gif" alt="Index" /></a>
+    <a href="../"><img src="../images/home.gif" alt="Home" /></a>
+  </body>
+</html>
 
-<A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A>
-<A HREF="../"><IMG SRC="../images/home.gif" ALT="Home"></A>
index 9533b02bdaf0830b9932a8977d447cd709426a05..6c4764044e6281b09505397d5deb3ba8d28dd2ea 100644 (file)
@@ -1,6 +1,19 @@
-<DIV ALIGN="CENTER">
- <IMG SRC="../images/sub.gif" ALT="[APACHE DOCUMENTATION]">
- <H3>
-  Apache HTTP Server Version 2.0 
- </H3>
-</DIV>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title></title>
+  </head>
+
+  <body>
+    <div align="CENTER">
+      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 
+
+      <h3>Apache HTTP Server Version 2.0</h3>
+    </div>
+  </body>
+</html>
+
index 715c13626d678f274252155e93ba2d63c35c8790..f7a5575d16f5958205872a116955520c407e3e12 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>Apache 2.0 Hook Functions</title>
-</head>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
 
-<!--#include virtual="header.html" -->
+    <title>Apache 2.0 Hook Functions</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
 
-<H1 align="center">Apache Hook Functions</H1>
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
 
-<P>In general, a hook function is one that Apache will call at some
-point during the processing of a request. Modules can provide
-functions that are called, and specify when they get called in
-comparison to other modules.</P>
+    <h1 align="center">Apache Hook Functions</h1>
 
-<H2>Creating a hook function</H2>
+    <p>In general, a hook function is one that Apache will call at
+    some point during the processing of a request. Modules can
+    provide functions that are called, and specify when they get
+    called in comparison to other modules.</p>
 
-<P>In order to create a new hook, four things need to be done:</P>
+    <h2>Creating a hook function</h2>
 
-<H3>Declare the hook function</H3>
+    <p>In order to create a new hook, four things need to be
+    done:</p>
 
-<P>Use the AP_DECLARE_HOOK macro, which needs to be given the return
-type of the hook function, the name of the hook, and the arguments. For
-example, if the hook returns an <TT>int</TT> and takes a
-<TT>request_rec *</TT> and an <TT>int</TT> and is called
-"do_something", then declare it like this:</P>
+    <h3>Declare the hook function</h3>
 
-<TT>AP_DECLARE_HOOK(int,do_something,(request_rec *r,int n))</TT>
+    <p>Use the AP_DECLARE_HOOK macro, which needs to be given the
+    return type of the hook function, the name of the hook, and the
+    arguments. For example, if the hook returns an <tt>int</tt> and
+    takes a <tt>request_rec *</tt> and an <tt>int</tt> and is
+    called "do_something", then declare it like this:</p>
+    <tt>AP_DECLARE_HOOK(int,do_something,(request_rec *r,int
+    n))</tt> 
 
-<P>This should go in a header which modules will include if they want
-to use the hook.</P>
+    <p>This should go in a header which modules will include if
+    they want to use the hook.</p>
 
-<H3>Create the hook structure</H3>
+    <h3>Create the hook structure</h3>
 
-<P>Each source file that exports a hook has a private structure which
-is used to record the module functions that use the hook. This is
-declared as follows:</P>
-
-<PRE>
+    <p>Each source file that exports a hook has a private structure
+    which is used to record the module functions that use the hook.
+    This is declared as follows:</p>
+<pre>
 APR_HOOK_STRUCT(
             APR_HOOK_LINK(do_something)
             ...
            )
-</PRE>
-
-<H3>Implement the hook caller</H3>
-
-<P>The source file that exports the hook has to implement a function
-that will call the hook. There are currently three possible ways to do
-this. In all cases, the calling function is called
-<TT>ap_run_<I>hookname</I>()</TT>.</P>
+</pre>
 
-<H4>Void hooks</H4>
+    <h3>Implement the hook caller</h3>
 
-<P>If the return value of a hook is <TT>void</TT>, then all the hooks are
-called, and the caller is implemented like this:</P>
+    <p>The source file that exports the hook has to implement a
+    function that will call the hook. There are currently three
+    possible ways to do this. In all cases, the calling function is
+    called <tt>ap_run_<i>hookname</i>()</tt>.</p>
 
-<TT>AP_IMPLEMENT_HOOK_VOID(do_something,(request_rec *r,int
-n),(r,n))</TT>
+    <h4>Void hooks</h4>
 
-<P>The second and third arguments are the dummy argument declaration and
-the dummy arguments as they will be used when calling the hook. In
-other words, this macro expands to something like this:</P>
+    <p>If the return value of a hook is <tt>void</tt>, then all the
+    hooks are called, and the caller is implemented like this:</p>
+    <tt>AP_IMPLEMENT_HOOK_VOID(do_something,(request_rec *r,int
+    n),(r,n))</tt> 
 
-<PRE>
+    <p>The second and third arguments are the dummy argument
+    declaration and the dummy arguments as they will be used when
+    calling the hook. In other words, this macro expands to
+    something like this:</p>
+<pre>
 void ap_run_do_something(request_rec *r,int n)
 {
     ...
     do_something(r,n);
 }
-</PRE>
-
-<H4>Hooks that return a value</H4>
-
-<P>If the hook returns a value, then it can either be run until the first
-hook that does something interesting, like so:</P>
-
-<TT>AP_IMPLEMENT_HOOK_RUN_FIRST(int,do_something,(request_rec *r,int n),(r,n),DECLINED)</TT>
-
-<P>The first hook that <I>doesn't</I> return <TT>DECLINED</TT> stops
-the loop and its return value is returned from the hook caller. Note
-that <TT>DECLINED</TT> is the tradition Apache hook return meaning "I
-didn't do anything", but it can be whatever suits you.</P>
-
-<P>Alternatively, all hooks can be run until an error occurs. This
-boils down to permitting <I>two</I> return values, one of which means
-"I did something, and it was OK" and the other meaning "I did
-nothing". The first function that returns a value other than one of
-those two stops the loop, and its return is the return value. Declare
-these like so:</P>
-
-<TT>AP_IMPLEMENT_HOOK_RUN_ALL(int,do_something,(request_rec *r,int
-n),(r,n),OK,DECLINED)</TT>
-
-<P>Again, <TT>OK</TT> and <TT>DECLINED</TT> are the traditional
-values. You can use what you want.</P>
-
-<H3>Call the hook callers</H3>
-
-<P>At appropriate moments in the code, call the hook caller, like
-so:</P>
-
-<PRE>
+</pre>
+
+    <h4>Hooks that return a value</h4>
+
+    <p>If the hook returns a value, then it can either be run until
+    the first hook that does something interesting, like so:</p>
+    <tt>AP_IMPLEMENT_HOOK_RUN_FIRST(int,do_something,(request_rec
+    *r,int n),(r,n),DECLINED)</tt> 
+
+    <p>The first hook that <i>doesn't</i> return <tt>DECLINED</tt>
+    stops the loop and its return value is returned from the hook
+    caller. Note that <tt>DECLINED</tt> is the tradition Apache
+    hook return meaning "I didn't do anything", but it can be
+    whatever suits you.</p>
+
+    <p>Alternatively, all hooks can be run until an error occurs.
+    This boils down to permitting <i>two</i> return values, one of
+    which means "I did something, and it was OK" and the other
+    meaning "I did nothing". The first function that returns a
+    value other than one of those two stops the loop, and its
+    return is the return value. Declare these like so:</p>
+    <tt>AP_IMPLEMENT_HOOK_RUN_ALL(int,do_something,(request_rec
+    *r,int n),(r,n),OK,DECLINED)</tt> 
+
+    <p>Again, <tt>OK</tt> and <tt>DECLINED</tt> are the traditional
+    values. You can use what you want.</p>
+
+    <h3>Call the hook callers</h3>
+
+    <p>At appropriate moments in the code, call the hook caller,
+    like so:</p>
+<pre>
     int n,ret;
     request_rec *r;
 
     ret=ap_run_do_something(r,n);
-</PRE>
-
-<H2>Hooking the hook</H2>
+</pre>
 
-<P>A module that wants a hook to be called needs to do two
-things.</P>
+    <h2>Hooking the hook</h2>
 
-<H3>Implement the hook function</H3>
+    <p>A module that wants a hook to be called needs to do two
+    things.</p>
 
-<P>Include the appropriate header, and define a static function of the
-correct type:</P>
+    <h3>Implement the hook function</h3>
 
-<PRE>
+    <p>Include the appropriate header, and define a static function
+    of the correct type:</p>
+<pre>
 static int my_something_doer(request_rec *r,int n)
 {
     ...
     return OK;
 }
-</PRE>
+</pre>
 
-<H3>Add a hook registering function</H3>
+    <h3>Add a hook registering function</h3>
 
-<P>During initialisation, Apache will call each modules hook
-registering function, which is included in the module structure:</P>
-
-<PRE>
+    <p>During initialisation, Apache will call each modules hook
+    registering function, which is included in the module
+    structure:</p>
+<pre>
 static void my_register_hooks()
 {
     ap_hook_do_something(my_something_doer,NULL,NULL,HOOK_MIDDLE);
@@ -150,58 +145,55 @@ mode MODULE_VAR_EXPORT my_module =
     ...
     my_register_hooks       /* register hooks */
 };
-</PRE>
-
-<H3>Controlling hook calling order</H3>
+</pre>
 
-<P>In the example above, we didn't use the three arguments in the hook
-registration function that control calling order. There are two
-mechanisms for doing this. The first, rather crude, method, allows us
-to specify roughly where the hook is run relative to other
-modules. The final argument control this. There are three possible
-values:</P>
+    <h3>Controlling hook calling order</h3>
 
-<PRE>
+    <p>In the example above, we didn't use the three arguments in
+    the hook registration function that control calling order.
+    There are two mechanisms for doing this. The first, rather
+    crude, method, allows us to specify roughly where the hook is
+    run relative to other modules. The final argument control this.
+    There are three possible values:</p>
+<pre>
 HOOK_FIRST
 HOOK_MIDDLE
 HOOK_LAST
-</PRE>
-
-<P>All modules using any particular value may be run in any order
-relative to each other, but, of course, all modules using
-<TT>HOOK_FIRST</TT> will be run before <TT>HOOK_MIDDLE</TT> which are
-before <TT>HOOK_LAST</TT>. Modules that don't care when they are run
-should use <TT>HOOK_MIDDLE</TT>. <I>(I spaced these out so people
-could do stuff like <TT>HOOK_FIRST-2</TT> to get in slightly earlier,
-but is this wise? - Ben)</I></P>
-
-<P>Note that there are two more values, <TT>HOOK_REALLY_FIRST</TT> and
-<TT>HOOK_REALLY_LAST</TT>. These should only be used by the hook
-exporter.</P>
-
-<P>The other method allows finer control. When a module knows that it
-must be run before (or after) some other modules, it can specify them
-by name. The second (third) argument is a NULL-terminated array of
-strings consisting of the names of modules that must be run before
-(after) the current module. For example, suppose we want "mod_xyz.c"
-and "mod_abc.c" to run before we do, then we'd hook as follows:</P>
-
-<PRE>
+</pre>
+
+    <p>All modules using any particular value may be run in any
+    order relative to each other, but, of course, all modules using
+    <tt>HOOK_FIRST</tt> will be run before <tt>HOOK_MIDDLE</tt>
+    which are before <tt>HOOK_LAST</tt>. Modules that don't care
+    when they are run should use <tt>HOOK_MIDDLE</tt>. <i>(I spaced
+    these out so people could do stuff like <tt>HOOK_FIRST-2</tt>
+    to get in slightly earlier, but is this wise? - Ben)</i></p>
+
+    <p>Note that there are two more values,
+    <tt>HOOK_REALLY_FIRST</tt> and <tt>HOOK_REALLY_LAST</tt>. These
+    should only be used by the hook exporter.</p>
+
+    <p>The other method allows finer control. When a module knows
+    that it must be run before (or after) some other modules, it
+    can specify them by name. The second (third) argument is a
+    NULL-terminated array of strings consisting of the names of
+    modules that must be run before (after) the current module. For
+    example, suppose we want "mod_xyz.c" and "mod_abc.c" to run
+    before we do, then we'd hook as follows:</p>
+<pre>
 static void register_hooks()
 {
     static const char * const aszPre[]={ "mod_xyz.c", "mod_abc.c", NULL };
 
     ap_hook_do_something(my_something_doer,aszPre,NULL,HOOK_MIDDLE);
 }
-</PRE>
-
-<P>Note that the sort used to achieve this is stable, so ordering set
-by <TT>HOOK_<I>ORDER</I></TT> is preserved, as far as is
-possible.</P>
-
-<I>Ben Laurie, 15th August 1999</I>
-
-<!--#include virtual="footer.html" -->
-
-</body>
+</pre>
+
+    <p>Note that the sort used to achieve this is stable, so
+    ordering set by <tt>HOOK_<i>ORDER</i></tt> is preserved, as far
+    as is possible.</p>
+    <i>Ben Laurie, 15th August 1999</i> 
+    <!--#include virtual="footer.html" -->
+  </body>
 </html>
+
index 8da1052cdd7a83da82e8b93aba5c52f6fd6c558e..c825f969487247fcb036a24fa7847fb2bb665d79 100644 (file)
@@ -1,40 +1,54 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>Apache-2.0 Developer Documentation</title>
-</head>
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-
-<!--#include virtual="header.html" -->
-
-<h1 align="center">Developer Documentation for Apache-2.0</h1>
-
-<p>Many of the documents on these Developer pages are lifted from Apache 1.3's
-   documentation.  While they are all being updated to Apache 2.0, they are
-   in different stages of progress.  Please be patient, and point out any
-   discrepancies or errors on the developer/ pages directly to the 
-   dev@httpd.apache.org mailing list.</p>
-
-<h3>Topics</h3>
-<dl>
-   <dt><a href="API.html">Apache 2.0 API Notes</a></dt>
-      <dd>Overview of Apache's Application Programming Interface.</dd>
-   <dt><a href="hooks.html">Apache Hook Functions</a></dt>
-      <dl>
-      <dt><a href="request.html">Request Processing in Apache 2.0</a></dt>
-      </dl>
-   <dt><a href="modules.html">Porting Apache 1.3 Modules</a></dt>
-   <dt><a href="debugging.html">Debugging Memory Allocation</a></dt>
-   <dt><a href="documenting.html">Documenting Apache 2.0</a></dt>
-</dl>
-
-<!--#include virtual="footer.html" -->
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Apache-2.0 Developer Documentation</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <h1 align="center">Developer Documentation for Apache-2.0</h1>
+
+    <p>Many of the documents on these Developer pages are lifted
+    from Apache 1.3's documentation. While they are all being
+    updated to Apache 2.0, they are in different stages of
+    progress. Please be patient, and point out any discrepancies or
+    errors on the developer/ pages directly to the
+    dev@httpd.apache.org mailing list.</p>
+
+    <h3>Topics</h3>
+
+    <dl>
+      <dt><a href="API.html">Apache 2.0 API Notes</a></dt>
+
+      <dd>Overview of Apache's Application Programming
+      Interface.</dd>
+
+      <dt><a href="hooks.html">Apache Hook Functions</a></dt>
+
+      <dd>
+        <dl>
+          <dt><a href="request.html">Request Processing in Apache
+          2.0</a></dt>
+        </dl>
+      </dd>
+
+      <dt><a href="modules.html">Porting Apache 1.3
+      Modules</a></dt>
+
+      <dt><a href="debugging.html">Debugging Memory
+      Allocation</a></dt>
+
+      <dt><a href="documenting.html">Documenting Apache
+      2.0</a></dt>
+    </dl>
+    <!--#include virtual="footer.html" -->
+  </body>
 </html>
+
index acf9c1b802357d094a061598b3388a5c9895827a..a4d1f5cda429f923c981158d209ba90f2be13da6 100644 (file)
@@ -1,76 +1,85 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>Apache 2.0 Layered I/O</title>
-</head>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
 
-<H1 align="center">Apache Layered I/O</H1>
+    <title>Apache 2.0 Layered I/O</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
 
-<P>Layered I/O has been the holy grail of Apache module writers for years.  
-With Apache 2.0, module writers can finally take advantage of layered I/O
-in their modules.
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <h1 align="center">Apache Layered I/O</h1>
 
-<P>In all previous versions of Apache, only one handler was allowed to modify
-the data stream that was sent to the client.  With Apache 2.0, one module
-can modify the data and then specify that other modules can modify the data
-if they would like.
+    <p>Layered I/O has been the holy grail of Apache module writers
+    for years. With Apache 2.0, module writers can finally take
+    advantage of layered I/O in their modules.</p>
 
-<H2>Taking advantage of layered I/O</H2>
+    <p>In all previous versions of Apache, only one handler was
+    allowed to modify the data stream that was sent to the client.
+    With Apache 2.0, one module can modify the data and then
+    specify that other modules can modify the data if they would
+    like.</p>
 
-<P>In order to make a module use layered I/O, there are some modifications 
-needed.  A new return value has been added for modules, RERUN_HANDLERS.
-When a handler returns this value, the core searches through the list of 
-handlers looking for another module that wants to try the request.
+    <h2>Taking advantage of layered I/O</h2>
 
-<P>When a module returns RERUN_HANDLERS, it must modify two fields of the
-request_rec, the handler and content_type fields.  Most modules will
-set the handler field to NULL, and allow the core to choose the which 
-module gets run next.  If these two fields are not modified, then the server
-will loop forever calling the same module's handler.
+    <p>In order to make a module use layered I/O, there are some
+    modifications needed. A new return value has been added for
+    modules, RERUN_HANDLERS. When a handler returns this value, the
+    core searches through the list of handlers looking for another
+    module that wants to try the request.</p>
 
-<P>Most modules should not write out to the network if they want to take 
-advantage of layered I/O.  Two BUFF structures have been added to the
-request_rec, one for input and one for output.  The module should read and
-write to these BUFFs.  The module will also have to setup the input field for
-the next module in the list.  A new function has been added, ap_setup_input,
-which all modules should call before they do any reading to get data to modify.
-This function checks to determine if the previous module set the input field,
-if so, that input is used, if not the file is opened and that data source 
-is used.  The output field is used basically the same way.  The module must
-set this field before they call ap_r* in order to take advantage of
-layered I/O.  If this field is not set, ap_r* will write directly to the
-client.  Usually at the end of a handler, the input (for the next module)
-will be the read side of a pipe, and the output will be the write side of
-the same pipe.
+    <p>When a module returns RERUN_HANDLERS, it must modify two
+    fields of the request_rec, the handler and content_type fields.
+    Most modules will set the handler field to NULL, and allow the
+    core to choose the which module gets run next. If these two
+    fields are not modified, then the server will loop forever
+    calling the same module's handler.</p>
 
-<H3>An Example of Layered I/O.</H3> 
+    <p>Most modules should not write out to the network if they
+    want to take advantage of layered I/O. Two BUFF structures have
+    been added to the request_rec, one for input and one for
+    output. The module should read and write to these BUFFs. The
+    module will also have to setup the input field for the next
+    module in the list. A new function has been added,
+    ap_setup_input, which all modules should call before they do
+    any reading to get data to modify. This function checks to
+    determine if the previous module set the input field, if so,
+    that input is used, if not the file is opened and that data
+    source is used. The output field is used basically the same
+    way. The module must set this field before they call ap_r* in
+    order to take advantage of layered I/O. If this field is not
+    set, ap_r* will write directly to the client. Usually at the
+    end of a handler, the input (for the next module) will be the
+    read side of a pipe, and the output will be the write side of
+    the same pipe.</p>
 
-<P>This example is the most basic layered I/O example possible.  It is 
-basically CGIs generated by mod_cgi and sent to the network via http_core.
+    <h3>An Example of Layered I/O.</h3>
 
-<P>mod_cgi executes the cgi script, and then sets request_rec->input to 
-the output pipe of the CGI.  It then NULLs out request_rec->handler, and 
-sets request_rec->content_type to whatever the CGI writes out (in this case,
-text/html).  Finally, mod_cgi returns RERUN_HANDLERS.
+    <p>This example is the most basic layered I/O example possible.
+    It is basically CGIs generated by mod_cgi and sent to the
+    network via http_core.</p>
 
-<P>ap_invoke_handlers() then loops back to the top of the handler list 
-and searches for a handler that can deal with this content_type.  In this case
-the correct module is the default_handler from http_core.
+    <p>mod_cgi executes the cgi script, and then sets
+    request_rec-&gt;input to the output pipe of the CGI. It then
+    NULLs out request_rec-&gt;handler, and sets
+    request_rec-&gt;content_type to whatever the CGI writes out (in
+    this case, text/html). Finally, mod_cgi returns
+    RERUN_HANDLERS.</p>
 
-<P>When default handler starts, it calls ap_setup_input, which has found
-a valid request_rec->input, so that is used for all inputs.  The output field
-in the request_rec is NULL, so when default_handler calls an output primitive
-it gets sent out over the network.</P>
+    <p>ap_invoke_handlers() then loops back to the top of the
+    handler list and searches for a handler that can deal with this
+    content_type. In this case the correct module is the
+    default_handler from http_core.</p>
 
-<I>Ryan Bloom, 25th March 2000</I>
-</body>
+    <p>When default handler starts, it calls ap_setup_input, which
+    has found a valid request_rec-&gt;input, so that is used for
+    all inputs. The output field in the request_rec is NULL, so
+    when default_handler calls an output primitive it gets sent out
+    over the network.</p>
+    <i>Ryan Bloom, 25th March 2000</i>
+  </body>
 </html>
+
index d2d898f88ff034a33cdb6fec7943d317f0e41daf..ebf7c33da201ef2b73cd69d7b99cd826d4e09894 100644 (file)
@@ -1,65 +1,84 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<HTML>
-<HEAD>
-<TITLE>Converting Modules from Apache 1.3 to Apache 2.0</TITLE>
-</HEAD>
-
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-
-<!--#include virtual="header.html" -->
-
-<H1 ALIGN="CENTER">From Apache 1.3 to Apache 2.0<br>Modules</H1>
-
-<p>
-This is a first attempt at writing the lessons I learned when trying to convert the mod_mmap_static module to Apache 2.0.  It's by no means definitive and probably won't even be correct in some ways, but it's a start.
-</p>
-<hr>
-<h2>The easier changes...
-</h2>
-
-<h3>Cleanup Routines</h3>
-<p>
-These now need to be of type apr_status_t and return a value of that type.  Normally the return value will be APR_SUCCESS unless there is some need to signal an error in the cleanup.  Be aware that even though you signal an error not all code yet checks and acts upon the error.
-</p>
-
-<h3>Initialisation Routines</h3>
-
-<p>
-These should now be renamed to better signify where they sit in the overall process.  So the name gets a small change from mmap_init to mmap_post_config.  The arguments passed have undergone a radical change and now look like
-</p>
-<ul style="list-style:none">
-<li>apr_pool_t *p,</li>
-<li>apr_pool_t *plog,</li>
-<li>apr_pool_t *ptemp,</li>
-<li>server_rec *s</li>
-</ul>
-
-<h3>Data Types</h3>
-<p>
-A lot of the data types have been moved into the APR.  This means that some have had a name change, such as the one shown above.  The following is a brief list of some of the changes that you are likely to have to make.
-<ul style="list-style:none">
-<li>pool becomes apr_pool_t</li>
-<li>table becomes apr_table_t</li>
-</ul>
-<hr>
-
-<h2>
-The <em>messier</em> changes...
-</h2>
-<h3>Register Hooks</h3>
-<p>
-The new architecture uses a series of hooks to provide for calling your functions.  These you'll need to add to your module by way of a new function, static void register_hooks(void).  The function is really reasonably straightforward once you understand what needs to be done.  Each function that needs calling at some stage in the processing of a request needs to be registered, handlers do not.  There are a number of phases where functions can be added, and for each you can specify with a high degree of control the relative order that the function will be called in.
-</p>
-<p>
-This is the code that was added to mod_mmap_static:
-</p>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Converting Modules from Apache 1.3 to Apache 2.0</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <h1 align="CENTER">From Apache 1.3 to Apache 2.0<br />
+     Modules</h1>
+
+    <p>This is a first attempt at writing the lessons I learned
+    when trying to convert the mod_mmap_static module to Apache
+    2.0. It's by no means definitive and probably won't even be
+    correct in some ways, but it's a start.</p>
+    <hr />
+
+    <h2>The easier changes...</h2>
+
+    <h3>Cleanup Routines</h3>
+
+    <p>These now need to be of type apr_status_t and return a value
+    of that type. Normally the return value will be APR_SUCCESS
+    unless there is some need to signal an error in the cleanup. Be
+    aware that even though you signal an error not all code yet
+    checks and acts upon the error.</p>
+
+    <h3>Initialisation Routines</h3>
+
+    <p>These should now be renamed to better signify where they sit
+    in the overall process. So the name gets a small change from
+    mmap_init to mmap_post_config. The arguments passed have
+    undergone a radical change and now look like</p>
+
+    <ul style="list-style:none">
+      <li>apr_pool_t *p,</li>
+
+      <li>apr_pool_t *plog,</li>
+
+      <li>apr_pool_t *ptemp,</li>
+
+      <li>server_rec *s</li>
+    </ul>
+
+    <h3>Data Types</h3>
+
+    <p>A lot of the data types have been moved into the APR. This
+    means that some have had a name change, such as the one shown
+    above. The following is a brief list of some of the changes
+    that you are likely to have to make.</p>
+
+    <ul style="list-style:none">
+      <li>pool becomes apr_pool_t</li>
+
+      <li>table becomes apr_table_t</li>
+    </ul>
+    <hr />
+
+    <h2>The <em>messier</em> changes...</h2>
+
+    <h3>Register Hooks</h3>
+
+    <p>The new architecture uses a series of hooks to provide for
+    calling your functions. These you'll need to add to your module
+    by way of a new function, static void register_hooks(void). The
+    function is really reasonably straightforward once you
+    understand what needs to be done. Each function that needs
+    calling at some stage in the processing of a request needs to
+    be registered, handlers do not. There are a number of phases
+    where functions can be added, and for each you can specify with
+    a high degree of control the relative order that the function
+    will be called in.</p>
+
+    <p>This is the code that was added to mod_mmap_static:</p>
 <pre>
 static void register_hooks(void)
 {
@@ -68,31 +87,43 @@ static void register_hooks(void)
     ap_hook_translate_name(mmap_static_xlat,aszPre,NULL,HOOK_LAST);
 };
 </pre>
-<p>
-This registers 2 functions that need to be called, one in the post_config stage (virtually every module will need this one) and one for the translate_name phase.  note that while there are different function names the format of each is identical.  So what is the format?
-</p>
-<p><strong>
-ap_hook_[phase_name](function_name, predecessors, successors, position);
-</strong></p>
-<p>
-There are 3 hook positions defined...
-</p>
-<ul style="list-style:none">
-<li>HOOK_FIRST</li>
-<li>HOOK_MIDDLE</li>
-<li>HOOK_LAST</li>
-</ul>
-<p>
-To define the position you use the position and then modify it with the predecessors and successors.  each of the modifiers can be a list of functions that should be called, either before the function is run (predecessors) or after the function has run (successors).
-</p>
-<p>
-In the mod_mmap_static case I didn't care about the post_config stage, but the mmap_static_xlat MUST be called after the core module had done it's name translation, hence the use of the aszPre to define a modifier to the position HOOK_LAST.
-</p>
-<h3>Module Definition</h3>
-
-<p>
-There are now a lot fewer stages to worry about when creating your module definition.  The old defintion looked like
-</p>
+
+    <p>This registers 2 functions that need to be called, one in
+    the post_config stage (virtually every module will need this
+    one) and one for the translate_name phase. note that while
+    there are different function names the format of each is
+    identical. So what is the format?</p>
+
+    <p><strong>ap_hook_[phase_name](function_name, predecessors,
+    successors, position);</strong></p>
+
+    <p>There are 3 hook positions defined...</p>
+
+    <ul style="list-style:none">
+      <li>HOOK_FIRST</li>
+
+      <li>HOOK_MIDDLE</li>
+
+      <li>HOOK_LAST</li>
+    </ul>
+
+    <p>To define the position you use the position and then modify
+    it with the predecessors and successors. each of the modifiers
+    can be a list of functions that should be called, either before
+    the function is run (predecessors) or after the function has
+    run (successors).</p>
+
+    <p>In the mod_mmap_static case I didn't care about the
+    post_config stage, but the mmap_static_xlat MUST be called
+    after the core module had done it's name translation, hence the
+    use of the aszPre to define a modifier to the position
+    HOOK_LAST.</p>
+
+    <h3>Module Definition</h3>
+
+    <p>There are now a lot fewer stages to worry about when
+    creating your module definition. The old defintion looked
+    like</p>
 <pre>
 module MODULE_VAR_EXPORT [module_name]_module =
 {
@@ -117,9 +148,8 @@ module MODULE_VAR_EXPORT [module_name]_module =
     /* post read-request */
 };
 </pre>
-<p>
-The new structure is a great deal simpler...
-</p>
+
+    <p>The new structure is a great deal simpler...</p>
 <pre>
 module MODULE_VAR_EXPORT [module_name]_module =
 {
@@ -133,107 +163,96 @@ module MODULE_VAR_EXPORT [module_name]_module =
     /* register hooks */
  };
 </pre>
-<p>
-Some of these read directly across, some don't.  I'll try to summarise what should be done below.
-</p>
-<p>
-The stages that read directly across :
-</p>
-<ul style="list-style:none">
-<li>
-/* dir config creater */ ==> /* create per-directory config structures */
-</li>
-<li>
-/* server config */ ==> /* create per-server config structures    */
-</li>
-<li>
-/* dir merger */ ==> /* merge per-directory config structures  */
-</li>
-<li>
-/* merge server config */ ==> /* merge per-server config structures     */
-</li>
-<li>
-/* command table */ ==> /* command apr_table_t */
-</li>
-<li>
-/* handlers */ ==> /* handlers */
-</li>
-</ul>
-<P>
-The remainder of the old functions should be registered as hooks.  There are the following hook stages defined so far...
-</P>
-
-<ul style="list-style:none">
-<li>
-ap_hook_post_config  <em>(this is where the old _init routines get registered)</em>
-</li>
-<li>
-ap_hook_http_method  <em>(retrieve the http method from a request.  (legacy))</em>
-</li>
-<li>
-ap_hook_open_logs  <em>(open any specified logs)</em>
-</li>
-<li>
-ap_hook_auth_checker  <em>(check if the resource requires authorization)</em>
-</li>
-<li>
-ap_hook_access_checker  <em>(check for module-specific restrictions)</em>
-</li>
-<li>
-ap_hook_check_user_id  <em>(check the user-id and password)</em>
-</li>
-<li>
-ap_hook_default_port  <em>(retrieve the default port for the server)</em>
-</li>
-<li>
-ap_hook_pre_connection  <em>(do any setup required just before processing, but after accepting)</em>
-</li>
-<li>
-ap_hook_process_connection  <em>(run the correct protocol)</em>
-</li>
-<li>
-ap_hook_child_init  <em>(call as soon as the child is started)</em>
-</li>
-<li>
-ap_hook_create_request  <em>(??)</em>
-</li>
-<li>
-ap_hook_fixups  <em>(last chance to modify things before generating content)</em>
-</li>
-<li>
-ap_hook_handler  <em>(generate the content)</em>
-</li>
-<li>
-ap_hook_header_parser  <em>(let's modules look at the headers, not used by most modules, because they use post_read_request for this.)</em>
-</li>
-<li>
-ap_hook_insert_filter  <em>(to insert filters into the filter chain)</em>
-</li>
-<li>
-ap_hook_log_transaction  <em>(log information about the request)</em>
-</li>
-<li>
-ap_hook_optional_fn_retrieve  <em>(retrieve any functions registered as optional)</em>
-</li>
-<li>
-ap_hook_post_read_request  <em>(called after reading the request, before any other phase)</em>
-</li>
-<li>
-ap_hook_quick_handler  <em>(??)</em>
-</li>
-<li>
-ap_hook_translate_name  <em>(translate the URI into a filename)</em>
-</li>
-<li>
-ap_hook_type_checker  <em>(determine and/or set the doc type)</em>
-
-
-<!--#include virtual="footer.html" -->
-
-</body>
-</html>
 
+    <p>Some of these read directly across, some don't. I'll try to
+    summarise what should be done below.</p>
+
+    <p>The stages that read directly across :</p>
+
+    <ul style="list-style:none">
+      <li>/* dir config creater */ ==&gt; /* create per-directory
+      config structures */</li>
+
+      <li>/* server config */ ==&gt; /* create per-server config
+      structures */</li>
+
+      <li>/* dir merger */ ==&gt; /* merge per-directory config
+      structures */</li>
+
+      <li>/* merge server config */ ==&gt; /* merge per-server
+      config structures */</li>
+
+      <li>/* command table */ ==&gt; /* command apr_table_t */</li>
+
+      <li>/* handlers */ ==&gt; /* handlers */</li>
+    </ul>
+
+    <p>The remainder of the old functions should be registered as
+    hooks. There are the following hook stages defined so
+    far...</p>
+
+    <ul style="list-style:none">
+      <li>ap_hook_post_config <em>(this is where the old _init
+      routines get registered)</em></li>
+
+      <li>ap_hook_http_method <em>(retrieve the http method from a
+      request. (legacy))</em></li>
+
+      <li>ap_hook_open_logs <em>(open any specified logs)</em></li>
+
+      <li>ap_hook_auth_checker <em>(check if the resource requires
+      authorization)</em></li>
 
+      <li>ap_hook_access_checker <em>(check for module-specific
+      restrictions)</em></li>
 
+      <li>ap_hook_check_user_id <em>(check the user-id and
+      password)</em></li>
 
+      <li>ap_hook_default_port <em>(retrieve the default port for
+      the server)</em></li>
+
+      <li>ap_hook_pre_connection <em>(do any setup required just
+      before processing, but after accepting)</em></li>
+
+      <li>ap_hook_process_connection <em>(run the correct
+      protocol)</em></li>
+
+      <li>ap_hook_child_init <em>(call as soon as the child is
+      started)</em></li>
+
+      <li>ap_hook_create_request <em>(??)</em></li>
+
+      <li>ap_hook_fixups <em>(last chance to modify things before
+      generating content)</em></li>
+
+      <li>ap_hook_handler <em>(generate the content)</em></li>
+
+      <li>ap_hook_header_parser <em>(let's modules look at the
+      headers, not used by most modules, because they use
+      post_read_request for this.)</em></li>
+
+      <li>ap_hook_insert_filter <em>(to insert filters into the
+      filter chain)</em></li>
+
+      <li>ap_hook_log_transaction <em>(log information about the
+      request)</em></li>
+
+      <li>ap_hook_optional_fn_retrieve <em>(retrieve any functions
+      registered as optional)</em></li>
+
+      <li>ap_hook_post_read_request <em>(called after reading the
+      request, before any other phase)</em></li>
+
+      <li>ap_hook_quick_handler <em>(??)</em></li>
+
+      <li>ap_hook_translate_name <em>(translate the URI into a
+      filename)</em></li>
+
+      <li>ap_hook_type_checker <em>(determine and/or set the doc
+      type)</em> <!--#include virtual="footer.html" -->
+      </li>
+    </ul>
+  </body>
+</html>
 
index d2d898f88ff034a33cdb6fec7943d317f0e41daf..ebf7c33da201ef2b73cd69d7b99cd826d4e09894 100644 (file)
@@ -1,65 +1,84 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<HTML>
-<HEAD>
-<TITLE>Converting Modules from Apache 1.3 to Apache 2.0</TITLE>
-</HEAD>
-
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-
-<!--#include virtual="header.html" -->
-
-<H1 ALIGN="CENTER">From Apache 1.3 to Apache 2.0<br>Modules</H1>
-
-<p>
-This is a first attempt at writing the lessons I learned when trying to convert the mod_mmap_static module to Apache 2.0.  It's by no means definitive and probably won't even be correct in some ways, but it's a start.
-</p>
-<hr>
-<h2>The easier changes...
-</h2>
-
-<h3>Cleanup Routines</h3>
-<p>
-These now need to be of type apr_status_t and return a value of that type.  Normally the return value will be APR_SUCCESS unless there is some need to signal an error in the cleanup.  Be aware that even though you signal an error not all code yet checks and acts upon the error.
-</p>
-
-<h3>Initialisation Routines</h3>
-
-<p>
-These should now be renamed to better signify where they sit in the overall process.  So the name gets a small change from mmap_init to mmap_post_config.  The arguments passed have undergone a radical change and now look like
-</p>
-<ul style="list-style:none">
-<li>apr_pool_t *p,</li>
-<li>apr_pool_t *plog,</li>
-<li>apr_pool_t *ptemp,</li>
-<li>server_rec *s</li>
-</ul>
-
-<h3>Data Types</h3>
-<p>
-A lot of the data types have been moved into the APR.  This means that some have had a name change, such as the one shown above.  The following is a brief list of some of the changes that you are likely to have to make.
-<ul style="list-style:none">
-<li>pool becomes apr_pool_t</li>
-<li>table becomes apr_table_t</li>
-</ul>
-<hr>
-
-<h2>
-The <em>messier</em> changes...
-</h2>
-<h3>Register Hooks</h3>
-<p>
-The new architecture uses a series of hooks to provide for calling your functions.  These you'll need to add to your module by way of a new function, static void register_hooks(void).  The function is really reasonably straightforward once you understand what needs to be done.  Each function that needs calling at some stage in the processing of a request needs to be registered, handlers do not.  There are a number of phases where functions can be added, and for each you can specify with a high degree of control the relative order that the function will be called in.
-</p>
-<p>
-This is the code that was added to mod_mmap_static:
-</p>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Converting Modules from Apache 1.3 to Apache 2.0</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <h1 align="CENTER">From Apache 1.3 to Apache 2.0<br />
+     Modules</h1>
+
+    <p>This is a first attempt at writing the lessons I learned
+    when trying to convert the mod_mmap_static module to Apache
+    2.0. It's by no means definitive and probably won't even be
+    correct in some ways, but it's a start.</p>
+    <hr />
+
+    <h2>The easier changes...</h2>
+
+    <h3>Cleanup Routines</h3>
+
+    <p>These now need to be of type apr_status_t and return a value
+    of that type. Normally the return value will be APR_SUCCESS
+    unless there is some need to signal an error in the cleanup. Be
+    aware that even though you signal an error not all code yet
+    checks and acts upon the error.</p>
+
+    <h3>Initialisation Routines</h3>
+
+    <p>These should now be renamed to better signify where they sit
+    in the overall process. So the name gets a small change from
+    mmap_init to mmap_post_config. The arguments passed have
+    undergone a radical change and now look like</p>
+
+    <ul style="list-style:none">
+      <li>apr_pool_t *p,</li>
+
+      <li>apr_pool_t *plog,</li>
+
+      <li>apr_pool_t *ptemp,</li>
+
+      <li>server_rec *s</li>
+    </ul>
+
+    <h3>Data Types</h3>
+
+    <p>A lot of the data types have been moved into the APR. This
+    means that some have had a name change, such as the one shown
+    above. The following is a brief list of some of the changes
+    that you are likely to have to make.</p>
+
+    <ul style="list-style:none">
+      <li>pool becomes apr_pool_t</li>
+
+      <li>table becomes apr_table_t</li>
+    </ul>
+    <hr />
+
+    <h2>The <em>messier</em> changes...</h2>
+
+    <h3>Register Hooks</h3>
+
+    <p>The new architecture uses a series of hooks to provide for
+    calling your functions. These you'll need to add to your module
+    by way of a new function, static void register_hooks(void). The
+    function is really reasonably straightforward once you
+    understand what needs to be done. Each function that needs
+    calling at some stage in the processing of a request needs to
+    be registered, handlers do not. There are a number of phases
+    where functions can be added, and for each you can specify with
+    a high degree of control the relative order that the function
+    will be called in.</p>
+
+    <p>This is the code that was added to mod_mmap_static:</p>
 <pre>
 static void register_hooks(void)
 {
@@ -68,31 +87,43 @@ static void register_hooks(void)
     ap_hook_translate_name(mmap_static_xlat,aszPre,NULL,HOOK_LAST);
 };
 </pre>
-<p>
-This registers 2 functions that need to be called, one in the post_config stage (virtually every module will need this one) and one for the translate_name phase.  note that while there are different function names the format of each is identical.  So what is the format?
-</p>
-<p><strong>
-ap_hook_[phase_name](function_name, predecessors, successors, position);
-</strong></p>
-<p>
-There are 3 hook positions defined...
-</p>
-<ul style="list-style:none">
-<li>HOOK_FIRST</li>
-<li>HOOK_MIDDLE</li>
-<li>HOOK_LAST</li>
-</ul>
-<p>
-To define the position you use the position and then modify it with the predecessors and successors.  each of the modifiers can be a list of functions that should be called, either before the function is run (predecessors) or after the function has run (successors).
-</p>
-<p>
-In the mod_mmap_static case I didn't care about the post_config stage, but the mmap_static_xlat MUST be called after the core module had done it's name translation, hence the use of the aszPre to define a modifier to the position HOOK_LAST.
-</p>
-<h3>Module Definition</h3>
-
-<p>
-There are now a lot fewer stages to worry about when creating your module definition.  The old defintion looked like
-</p>
+
+    <p>This registers 2 functions that need to be called, one in
+    the post_config stage (virtually every module will need this
+    one) and one for the translate_name phase. note that while
+    there are different function names the format of each is
+    identical. So what is the format?</p>
+
+    <p><strong>ap_hook_[phase_name](function_name, predecessors,
+    successors, position);</strong></p>
+
+    <p>There are 3 hook positions defined...</p>
+
+    <ul style="list-style:none">
+      <li>HOOK_FIRST</li>
+
+      <li>HOOK_MIDDLE</li>
+
+      <li>HOOK_LAST</li>
+    </ul>
+
+    <p>To define the position you use the position and then modify
+    it with the predecessors and successors. each of the modifiers
+    can be a list of functions that should be called, either before
+    the function is run (predecessors) or after the function has
+    run (successors).</p>
+
+    <p>In the mod_mmap_static case I didn't care about the
+    post_config stage, but the mmap_static_xlat MUST be called
+    after the core module had done it's name translation, hence the
+    use of the aszPre to define a modifier to the position
+    HOOK_LAST.</p>
+
+    <h3>Module Definition</h3>
+
+    <p>There are now a lot fewer stages to worry about when
+    creating your module definition. The old defintion looked
+    like</p>
 <pre>
 module MODULE_VAR_EXPORT [module_name]_module =
 {
@@ -117,9 +148,8 @@ module MODULE_VAR_EXPORT [module_name]_module =
     /* post read-request */
 };
 </pre>
-<p>
-The new structure is a great deal simpler...
-</p>
+
+    <p>The new structure is a great deal simpler...</p>
 <pre>
 module MODULE_VAR_EXPORT [module_name]_module =
 {
@@ -133,107 +163,96 @@ module MODULE_VAR_EXPORT [module_name]_module =
     /* register hooks */
  };
 </pre>
-<p>
-Some of these read directly across, some don't.  I'll try to summarise what should be done below.
-</p>
-<p>
-The stages that read directly across :
-</p>
-<ul style="list-style:none">
-<li>
-/* dir config creater */ ==> /* create per-directory config structures */
-</li>
-<li>
-/* server config */ ==> /* create per-server config structures    */
-</li>
-<li>
-/* dir merger */ ==> /* merge per-directory config structures  */
-</li>
-<li>
-/* merge server config */ ==> /* merge per-server config structures     */
-</li>
-<li>
-/* command table */ ==> /* command apr_table_t */
-</li>
-<li>
-/* handlers */ ==> /* handlers */
-</li>
-</ul>
-<P>
-The remainder of the old functions should be registered as hooks.  There are the following hook stages defined so far...
-</P>
-
-<ul style="list-style:none">
-<li>
-ap_hook_post_config  <em>(this is where the old _init routines get registered)</em>
-</li>
-<li>
-ap_hook_http_method  <em>(retrieve the http method from a request.  (legacy))</em>
-</li>
-<li>
-ap_hook_open_logs  <em>(open any specified logs)</em>
-</li>
-<li>
-ap_hook_auth_checker  <em>(check if the resource requires authorization)</em>
-</li>
-<li>
-ap_hook_access_checker  <em>(check for module-specific restrictions)</em>
-</li>
-<li>
-ap_hook_check_user_id  <em>(check the user-id and password)</em>
-</li>
-<li>
-ap_hook_default_port  <em>(retrieve the default port for the server)</em>
-</li>
-<li>
-ap_hook_pre_connection  <em>(do any setup required just before processing, but after accepting)</em>
-</li>
-<li>
-ap_hook_process_connection  <em>(run the correct protocol)</em>
-</li>
-<li>
-ap_hook_child_init  <em>(call as soon as the child is started)</em>
-</li>
-<li>
-ap_hook_create_request  <em>(??)</em>
-</li>
-<li>
-ap_hook_fixups  <em>(last chance to modify things before generating content)</em>
-</li>
-<li>
-ap_hook_handler  <em>(generate the content)</em>
-</li>
-<li>
-ap_hook_header_parser  <em>(let's modules look at the headers, not used by most modules, because they use post_read_request for this.)</em>
-</li>
-<li>
-ap_hook_insert_filter  <em>(to insert filters into the filter chain)</em>
-</li>
-<li>
-ap_hook_log_transaction  <em>(log information about the request)</em>
-</li>
-<li>
-ap_hook_optional_fn_retrieve  <em>(retrieve any functions registered as optional)</em>
-</li>
-<li>
-ap_hook_post_read_request  <em>(called after reading the request, before any other phase)</em>
-</li>
-<li>
-ap_hook_quick_handler  <em>(??)</em>
-</li>
-<li>
-ap_hook_translate_name  <em>(translate the URI into a filename)</em>
-</li>
-<li>
-ap_hook_type_checker  <em>(determine and/or set the doc type)</em>
-
-
-<!--#include virtual="footer.html" -->
-
-</body>
-</html>
 
+    <p>Some of these read directly across, some don't. I'll try to
+    summarise what should be done below.</p>
+
+    <p>The stages that read directly across :</p>
+
+    <ul style="list-style:none">
+      <li>/* dir config creater */ ==&gt; /* create per-directory
+      config structures */</li>
+
+      <li>/* server config */ ==&gt; /* create per-server config
+      structures */</li>
+
+      <li>/* dir merger */ ==&gt; /* merge per-directory config
+      structures */</li>
+
+      <li>/* merge server config */ ==&gt; /* merge per-server
+      config structures */</li>
+
+      <li>/* command table */ ==&gt; /* command apr_table_t */</li>
+
+      <li>/* handlers */ ==&gt; /* handlers */</li>
+    </ul>
+
+    <p>The remainder of the old functions should be registered as
+    hooks. There are the following hook stages defined so
+    far...</p>
+
+    <ul style="list-style:none">
+      <li>ap_hook_post_config <em>(this is where the old _init
+      routines get registered)</em></li>
+
+      <li>ap_hook_http_method <em>(retrieve the http method from a
+      request. (legacy))</em></li>
+
+      <li>ap_hook_open_logs <em>(open any specified logs)</em></li>
+
+      <li>ap_hook_auth_checker <em>(check if the resource requires
+      authorization)</em></li>
 
+      <li>ap_hook_access_checker <em>(check for module-specific
+      restrictions)</em></li>
 
+      <li>ap_hook_check_user_id <em>(check the user-id and
+      password)</em></li>
 
+      <li>ap_hook_default_port <em>(retrieve the default port for
+      the server)</em></li>
+
+      <li>ap_hook_pre_connection <em>(do any setup required just
+      before processing, but after accepting)</em></li>
+
+      <li>ap_hook_process_connection <em>(run the correct
+      protocol)</em></li>
+
+      <li>ap_hook_child_init <em>(call as soon as the child is
+      started)</em></li>
+
+      <li>ap_hook_create_request <em>(??)</em></li>
+
+      <li>ap_hook_fixups <em>(last chance to modify things before
+      generating content)</em></li>
+
+      <li>ap_hook_handler <em>(generate the content)</em></li>
+
+      <li>ap_hook_header_parser <em>(let's modules look at the
+      headers, not used by most modules, because they use
+      post_read_request for this.)</em></li>
+
+      <li>ap_hook_insert_filter <em>(to insert filters into the
+      filter chain)</em></li>
+
+      <li>ap_hook_log_transaction <em>(log information about the
+      request)</em></li>
+
+      <li>ap_hook_optional_fn_retrieve <em>(retrieve any functions
+      registered as optional)</em></li>
+
+      <li>ap_hook_post_read_request <em>(called after reading the
+      request, before any other phase)</em></li>
+
+      <li>ap_hook_quick_handler <em>(??)</em></li>
+
+      <li>ap_hook_translate_name <em>(translate the URI into a
+      filename)</em></li>
+
+      <li>ap_hook_type_checker <em>(determine and/or set the doc
+      type)</em> <!--#include virtual="footer.html" -->
+      </li>
+    </ul>
+  </body>
+</html>
 
index 6becc938a4edfe14307d54bb7c0b8e3fdf226eed..2bd05319731eabe4cf086be1ec5fba46e0826dd3 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<HTML>
-<HEAD>
-<TITLE>Request Processing in Apache 2.0</TITLE>
-</HEAD>
-
-<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-<BODY
- BGCOLOR="#FFFFFF"
- TEXT="#000000"
- LINK="#0000FF"
- VLINK="#000080"
- ALINK="#FF0000"
->
-
-<!--#include virtual="header.html" -->
-
-<h1>Request Processing in Apache 2.0</h1>
-
-<p>Warning - this is a first (fast) draft that needs further revision!</p>
-
-<p>Several changes in Apache 2.0 affect the internal request processing
-   mechanics.  Module authors need to be aware of these changes so they
-   may take advantage of the optimizations and security enhancements.</p>
-
-<p>The first major change is to the subrequest and redirect mechanisms.
-   There were a number of different code paths in Apache 1.3 to attempt
-   to optimize subrequest or redirect behavior.  As patches were introduced
-   to 2.0, these optimizations (and the server behavior) were quickly broken
-   due to this duplication of code.  All duplicate code has been folded
-   back into <code>ap_process_internal_request()</code> to prevent the
-   code from falling out of sync again.</p>
-
-<p>This means that much of the existing code was 'unoptimized'.  It is 
-   the Apache HTTP Project's first goal to create a robust and correct
-   implementation of the HTTP server RFC.  Additional goals include
-   security, scalability and optimization.  New methods were sought to
-   optimize the server (beyond the performance of Apache 1.3) without
-   introducing fragile or insecure code.</p>
-
-<h2>The Request Processing Cycle</h2>
-
-<p>All requests pass through <code>ap_process_request_internal()</code>
-   in request.c, including subrequests and redirects.  If a module doesn't 
-   pass generated requests through this code, the author is cautioned that
-   the module may be broken by future changes to request processing.</p>
-
-<p>To streamline requests, the module author can take advantage of the
-   hooks offered to drop out of the request cycle early, or to bypass
-   core Apache hooks which are irrelevant (and costly in terms of CPU.)</p>
-
-<h2>The Request Parsing Phase</h3>
-
-<h3>Unescapes the URL</h3>
-
-<p>The request's parsed_uri path is unescaped, once and only once, at the
-   beginning of internal request processing.</p>
-
-<p>This step is bypassed if the proxyreq flag is set, or the parsed_uri.path
-   element is unset.  The module has no further control of this one-time 
-   unescape operation, either failing to unescape or multiply unescaping
-   the URL leads to security reprecussions.</p>
-
-<h3>Strips Parent and This Elements from the URI</h3>
-
-<p>All <code>/../</code> and <code>/./</code> elements are removed by
-   <code>ap_getparents()</code>.  This helps to ensure the path is (nearly) 
-   absolute before the request processing continues.</p>
-
-<p>This step cannot be bypassed.</p>
-
-<h3>Initial URI Location Walk</h3>
-
-<p>Every request is subject to an <code>ap_location_walk()</code> call.
-   This ensures that &lt;Location &gt; sections are consistently enforced for 
-   all requests.  If the request is an internal redirect or a sub-request, 
-   it may borrow some or all of the processing from the previous or parent 
-   request's ap_location_walk, so this step is generally very efficient 
-   after processing the main request.</p>
-
-<h3>Hook: translate_name</h3>
-
-<p>Modules can determine the file name, or alter the given URI in this step.
-   For example, mod_vhost_alias will translate the URI's path into the
-   configured virtual host, mod_alias will translate the path to an alias
-   path, and if the request falls back on the core, the DocumentRoot is
-   prepended to the request resource.
-
-<p>If all modules DECLINE this phase, an error 500 is returned to the browser,
-   and a "couldn't translate name" error is logged automatically.</p>
-
-<h3>Hook: map_to_storage</h3>
-
-<p>After the file or correct URI was determined, the appropriate per-dir
-   configurations are merged together.  For example, mod_proxy compares 
-   and merges the appropriate &lt;Proxy &gt; sections.  If the URI is nothing 
-   more than a local (non-proxy) TRACE request, the core handles the
-   request and returns DONE.  If no module answers this hook with OK or
-   DONE, the core will run the request filename against the &lt;Directory &gt;
-   and &lt;Files &gt; sections.  If the request 'filename' isn't an absolute,
-   legal filename, a note is set for later termination.</p>
-
-<h3>Initial URI Location Walk</h3>
-
-<p>Every request is hardened by a second <code>ap_location_walk()</code> 
-  call.  This reassures that a translated request is still subjected to 
-  the configured &lt;Location &gt; sections.  The request again borrows 
-  some or all of the processing from it's previous location_walk above, 
-  so this step is almost always very efficient unless the translated URI 
-  mapped to a substantially different path or Virtual Host.</p>
-
-<h3>Hook: header_parser</h3>
-
-<p>The main request then parses the client's headers.  This prepares 
-the remaining request processing steps to better serve the client's 
-request.</p>
-
-<h2>The Security Phase</h3>
-
-<p>Needs Documentation.  Code is;</p>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="generator" content="HTML Tidy, see www.w3.org" />
+
+    <title>Request Processing in Apache 2.0</title>
+  </head>
+  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
+
+  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
+  vlink="#000080" alink="#FF0000">
+    <!--#include virtual="header.html" -->
+
+    <h1>Request Processing in Apache 2.0</h1>
+
+    <p>Warning - this is a first (fast) draft that needs further
+    revision!</p>
+
+    <p>Several changes in Apache 2.0 affect the internal request
+    processing mechanics. Module authors need to be aware of these
+    changes so they may take advantage of the optimizations and
+    security enhancements.</p>
+
+    <p>The first major change is to the subrequest and redirect
+    mechanisms. There were a number of different code paths in
+    Apache 1.3 to attempt to optimize subrequest or redirect
+    behavior. As patches were introduced to 2.0, these
+    optimizations (and the server behavior) were quickly broken due
+    to this duplication of code. All duplicate code has been folded
+    back into <code>ap_process_internal_request()</code> to prevent
+    the code from falling out of sync again.</p>
+
+    <p>This means that much of the existing code was 'unoptimized'.
+    It is the Apache HTTP Project's first goal to create a robust
+    and correct implementation of the HTTP server RFC. Additional
+    goals include security, scalability and optimization. New
+    methods were sought to optimize the server (beyond the
+    performance of Apache 1.3) without introducing fragile or
+    insecure code.</p>
+
+    <h2>The Request Processing Cycle</h2>
+
+    <p>All requests pass through
+    <code>ap_process_request_internal()</code> in request.c,
+    including subrequests and redirects. If a module doesn't pass
+    generated requests through this code, the author is cautioned
+    that the module may be broken by future changes to request
+    processing.</p>
+
+    <p>To streamline requests, the module author can take advantage
+    of the hooks offered to drop out of the request cycle early, or
+    to bypass core Apache hooks which are irrelevant (and costly in
+    terms of CPU.)</p>
+
+    <h2>The Request Parsing Phase</h2>
+
+    <h3>Unescapes the URL</h3>
+
+    <p>The request's parsed_uri path is unescaped, once and only
+    once, at the beginning of internal request processing.</p>
+
+    <p>This step is bypassed if the proxyreq flag is set, or the
+    parsed_uri.path element is unset. The module has no further
+    control of this one-time unescape operation, either failing to
+    unescape or multiply unescaping the URL leads to security
+    reprecussions.</p>
+
+    <h3>Strips Parent and This Elements from the URI</h3>
+
+    <p>All <code>/../</code> and <code>/./</code> elements are
+    removed by <code>ap_getparents()</code>. This helps to ensure
+    the path is (nearly) absolute before the request processing
+    continues.</p>
+
+    <p>This step cannot be bypassed.</p>
+
+    <h3>Initial URI Location Walk</h3>
+
+    <p>Every request is subject to an
+    <code>ap_location_walk()</code> call. This ensures that
+    &lt;Location &gt; sections are consistently enforced for all
+    requests. If the request is an internal redirect or a
+    sub-request, it may borrow some or all of the processing from
+    the previous or parent request's ap_location_walk, so this step
+    is generally very efficient after processing the main
+    request.</p>
+
+    <h3>Hook: translate_name</h3>
+
+    <p>Modules can determine the file name, or alter the given URI
+    in this step. For example, mod_vhost_alias will translate the
+    URI's path into the configured virtual host, mod_alias will
+    translate the path to an alias path, and if the request falls
+    back on the core, the DocumentRoot is prepended to the request
+    resource.</p>
+
+    <p>If all modules DECLINE this phase, an error 500 is returned
+    to the browser, and a "couldn't translate name" error is logged
+    automatically.</p>
+
+    <h3>Hook: map_to_storage</h3>
+
+    <p>After the file or correct URI was determined, the
+    appropriate per-dir configurations are merged together. For
+    example, mod_proxy compares and merges the appropriate
+    &lt;Proxy &gt; sections. If the URI is nothing more than a
+    local (non-proxy) TRACE request, the core handles the request
+    and returns DONE. If no module answers this hook with OK or
+    DONE, the core will run the request filename against the
+    &lt;Directory &gt; and &lt;Files &gt; sections. If the request
+    'filename' isn't an absolute, legal filename, a note is set for
+    later termination.</p>
+
+    <h3>Initial URI Location Walk</h3>
+
+    <p>Every request is hardened by a second
+    <code>ap_location_walk()</code> call. This reassures that a
+    translated request is still subjected to the configured
+    &lt;Location &gt; sections. The request again borrows some or
+    all of the processing from it's previous location_walk above,
+    so this step is almost always very efficient unless the
+    translated URI mapped to a substantially different path or
+    Virtual Host.</p>
+
+    <h3>Hook: header_parser</h3>
+
+    <p>The main request then parses the client's headers. This
+    prepares the remaining request processing steps to better serve
+    the client's request.</p>
+
+    <h2>The Security Phase</h2>
+
+    <p>Needs Documentation. Code is;</p>
 <pre>
     switch (ap_satisfies(r)) {
     case SATISFY_ALL:
@@ -128,13 +143,13 @@ request.</p>
         if (ap_some_auth_required(r)) {
             if (((access_status = ap_run_check_user_id(r)) != 0) || !ap_auth_type(r)) {
                 return decl_die(access_status, ap_auth_type(r)
-                           ? "check user.  No user file?"
-                           : "perform authentication. AuthType not set!", r);
+                    ? "check user.  No user file?"
+                    : "perform authentication. AuthType not set!", r);
             }
             if (((access_status = ap_run_auth_checker(r)) != 0) || !ap_auth_type(r)) {
                 return decl_die(access_status, ap_auth_type(r)
-                           ? "check access.  No groups file?"
-                           : "perform authentication. AuthType not set!", r);
+                    ? "check access.  No groups file?"
+                    : "perform authentication. AuthType not set!", r);
             }
         }
         break;
@@ -142,76 +157,75 @@ request.</p>
         if (((access_status = ap_run_access_checker(r)) != 0) || !ap_auth_type(r)) {
             if (!ap_some_auth_required(r)) {
                 return decl_die(access_status, ap_auth_type(r)
-                           ? "check access"
-                           : "perform authentication. AuthType not set!", r);
+                    ? "check access"
+                    : "perform authentication. AuthType not set!", r);
             }
             if (((access_status = ap_run_check_user_id(r)) != 0) || !ap_auth_type(r)) {
                 return decl_die(access_status, ap_auth_type(r)
-                           ? "check user.  No user file?"
-                           : "perform authentication. AuthType not set!", r);
+                    ? "check user.  No user file?"
+                    : "perform authentication. AuthType not set!", r);
             }
             if (((access_status = ap_run_auth_checker(r)) != 0) || !ap_auth_type(r)) {
                 return decl_die(access_status, ap_auth_type(r)
-                           ? "check access.  No groups file?"
-                           : "perform authentication. AuthType not set!", r);
+                    ? "check access.  No groups file?"
+                    : "perform authentication. AuthType not set!", r);
+            }
             }
-               }
         break;
     }
 </pre>
-<h2>The Preparation Phase</h2>
-
-<h3>Hook: type_checker</h3>
-
-<p>The modules have an opportunity to test the URI or filename against
-   the target resource, and set mime information for the request.  Both
-   mod_mime and mod_mime_magic use this phase to compare the file name
-   or contents against the administrator's configuration and set the
-   content type, language, character set and request handler.  Some
-   modules may set up their filters or other request handling parameters
-   at this time.</p>
-
-<p>If all modules DECLINE this phase, an error 500 is returned to the browser,
-   and a "couldn't find types" error is logged automatically.</p>
-
-<h3>Hook: fixups</h3>
-
-<p>Many modules are 'trounced' by some phase above.  The fixups phase is
-   used by modules to 'reassert' their ownership or force the request's
-   fields to their appropriate values.  It isn't always the cleanest
-   mechanism, but occasionally it's the only option.</p>
 
-<h3>Hook: insert_filter</h3>
-
-<p>Modules that transform the content in some way can insert their values
-   and override existing filters, such that if the user configured a more
-   advanced filter out-of-order, then the module can move it's order as
-   need be.
-
-<h2>The Handler Phase</h2>
-
-<p>This phase is <strong><em>not</em></strong> part of the processing in
-   <code>ap_process_request_internal()</code>.  Many modules prepare one
-   or more subrequests prior to creating any content at all.  After the
-   core, or a module calls <code>ap_process_request_internal()</code> it 
-   then calls <code>ap_invoke_handler()</code> to generate the request.</p>
-
-<h3>Hook: handler</h3>
-
-<p>The module finally has a chance to serve the request in it's handler
-   hook.  Note that not every prepared request is sent to the handler
-   hook.  Many modules, such as mod_autoindex, will create subrequests
-   for a given URI, and then never serve the subrequest, but simply
-   lists it for the user.  Remember not to put required teardown from
-   the hooks above into this module, but register pool cleanups against
-   the request pool to free resources as required.</p>
-
-<!--#include virtual="footer.html" -->
-
-</body>
+    <h2>The Preparation Phase</h2>
+
+    <h3>Hook: type_checker</h3>
+
+    <p>The modules have an opportunity to test the URI or filename
+    against the target resource, and set mime information for the
+    request. Both mod_mime and mod_mime_magic use this phase to
+    compare the file name or contents against the administrator's
+    configuration and set the content type, language, character set
+    and request handler. Some modules may set up their filters or
+    other request handling parameters at this time.</p>
+
+    <p>If all modules DECLINE this phase, an error 500 is returned
+    to the browser, and a "couldn't find types" error is logged
+    automatically.</p>
+
+    <h3>Hook: fixups</h3>
+
+    <p>Many modules are 'trounced' by some phase above. The fixups
+    phase is used by modules to 'reassert' their ownership or force
+    the request's fields to their appropriate values. It isn't
+    always the cleanest mechanism, but occasionally it's the only
+    option.</p>
+
+    <h3>Hook: insert_filter</h3>
+
+    <p>Modules that transform the content in some way can insert
+    their values and override existing filters, such that if the
+    user configured a more advanced filter out-of-order, then the
+    module can move it's order as need be.</p>
+
+    <h2>The Handler Phase</h2>
+
+    <p>This phase is <strong><em>not</em></strong> part of the
+    processing in <code>ap_process_request_internal()</code>. Many
+    modules prepare one or more subrequests prior to creating any
+    content at all. After the core, or a module calls
+    <code>ap_process_request_internal()</code> it then calls
+    <code>ap_invoke_handler()</code> to generate the request.</p>
+
+    <h3>Hook: handler</h3>
+
+    <p>The module finally has a chance to serve the request in it's
+    handler hook. Note that not every prepared request is sent to
+    the handler hook. Many modules, such as mod_autoindex, will
+    create subrequests for a given URI, and then never serve the
+    subrequest, but simply lists it for the user. Remember not to
+    put required teardown from the hooks above into this module,
+    but register pool cleanups against the request pool to free
+    resources as required.</p>
+    <!--#include virtual="footer.html" -->
+  </body>
 </html>
 
-
-
-
-