]> granicus.if.org Git - apache/blobdiff - docs/manual/developer/modguide.xml
xforms
[apache] / docs / manual / developer / modguide.xml
index fa61654b62715408dede2ea11a2a39499fdc90b2..e1c2b155b934b420cbe7dd92b696615dbb259dfb 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
+
 <!-- $LastChangedRevision$ -->
 
 <!--
@@ -36,7 +37,7 @@ Server 2.4</p>
 <section id="introduction"><title>Introduction</title>
 <section id="what"><title>What we will be discussing in this document</title>
 <p>
-This document will discuss how you can easily create modules for the Apache 
+This document will discuss how you can create modules for the Apache 
 HTTP Server 2.4, by exploring an example module called 
 <code>mod_example</code>. In the first part of this document, the purpose 
 of this module will be to calculate and print out various digest values for 
@@ -46,19 +47,21 @@ MD5 digest value of the file located at <code>
 http://www.example.com/index.html</code>, we would visit <code>
 http://www.example.com/index.html.sum</code>. 
 </p>
+
 <p>
 In the second part of this document, which deals with configuration 
 directive and context awareness, we will be looking at a module that simply 
 write out its own configuration to the client.
 </p>
 </section>
+
 <section id="prerequisites"><title>Prerequisites</title>
 <p>
 First and foremost, you are expected to have a basic knowledge of how the C 
 programming language works. In most cases, we will try to be as pedagogical 
 as possible and link to documents describing the functions used in the 
 examples, but there are also many cases where it is necessary to either 
-just assume that "it works" or do some digging youself into what the hows 
+just assume that "it works" or do some digging yourself into what the hows 
 and whys of various function calls. 
 </p>
 <p>
@@ -74,45 +77,53 @@ To compile the source code we are building in this document, we will be
 using <a href="../programs/apxs.html">APXS</a>. Assuming your source file 
 is called mod_example.c, compiling, installing and activating the module is 
 as simple as: 
+</p>
 <example><pre>
 apxs -i -a -c mod_example.c
 </pre></example>
-</p>
+
 </section>
 </section>
 
 <section id="basics"><title>Defining a module</title>
-<img src="../images/build_a_mod_3.png"/><br/>
-<p>Every module starts with the same declaration, or name tag if you will, 
-that defines a module as <em>a separate entity within Apache</em>:
+<p>
+<img src="../images/build_a_mod_3.png" alt="Module name tags"/><br/>
+Every module starts with the same declaration, or name tag if you will, 
+that defines a module as <em>a separate entity within Apache</em>:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-module AP_MODULE_DECLARE_DATA   example_module <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    STANDARD20_MODULE_STUFF<code style='color:#806030; '>,</code>
-    create_dir_conf<code style='color:#806030; '>,</code> <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    merge_dir_conf<code style='color:#806030; '>,</code>  <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    create_svr_conf<code style='color:#806030; '>,</code> <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    merge_svr_conf<code style='color:#806030; '>,</code>  <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    directives<code style='color:#806030; '>,</code>      <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks   <code style='color:#c34e00; '>/* Our hook registering function */</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-</pre>
+<highlight language="c">
+module AP_MODULE_DECLARE_DATA   example_module =
+{ 
+    STANDARD20_MODULE_STUFF,
+    create_dir_conf, /* Per-directory configuration handler */
+    merge_dir_conf,  /* Merge handler for per-directory configurations */
+    create_svr_conf, /* Per-server configuration handler */
+    merge_svr_conf,  /* Merge handler for per-server configurations */
+    directives,      /* Any directives we may have for httpd */
+    register_hooks   /* Our hook registering function */
+};
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 This bit of code lets the server know that we have now registered a new module 
 in the system, and that its name is <code>example_module</code>. The name 
-of the module is used primarilly for two things:<br/>
+of the module is used primarily for two things:<br/>
+</p>
 <ul>
 <li>Letting the server know how to load the module using the LoadModule</li>
 <li>Setting up a namespace for the module to use in configurations</li>
 </ul>
+<p>
 For now, we're only concerned with the first purpose of the module name, 
-which comes into play when we need to load the module:<br/>
-<example><pre><a href="../mod/mod_so.html#LoadModule">LoadModule</a> example_module modules/mod_example.so</pre></example>
+which comes into play when we need to load the module:
+</p>
+<highlight language="config">
+LoadModule example_module modules/mod_example.so
+</highlight>
+<p>
 In essence, this tells the server to open up <code>mod_example.so</code> and look for a module 
 called <code>example_module</code>.
 </p>
@@ -142,7 +153,7 @@ request, and will ask each module whether they have an interest in a given
 request or not. It is then up to each module to either gently decline 
 serving a request, accept serving it or flat out deny the request from 
 being served, as authentication/authorization modules do: <br/>
-<img src="../images/build_a_mod_2.png" /><br/>
+<img src="../images/build_a_mod_2.png" alt="Hook handling in httpd"/><br/>
 To make it a bit easier for handlers such as our mod_example to know 
 whether the client is requesting content we should handle or not, the server 
 has directives for hinting to modules whether their assistance is needed or 
@@ -152,9 +163,11 @@ an example using <directive module="mod_mime">AddHandler</directive>. In
 our example case, we want every request ending with .sum to be served by 
 <code>mod_example</code>, so we'll add a configuration directive that tells 
 the server to do just that:
-<example><pre>
+</p>
+<highlight language="config">
 AddHandler example-handler .sum
-</pre></example>
+</highlight>
+<p>
 What this tells the server is the following: <em>Whenever we receive a request 
 for a URI ending in .sum, we are to let all modules know that we are 
 looking for whoever goes by the name of &quot;example-handler&quot; </em>. 
@@ -170,46 +183,47 @@ the server based on the value of this tag.
 To begin with, we only want to create a simple handler, that replies to the 
 client browser when a specific URL is requested, so we won't bother setting 
 up configuration handlers and directives just yet. Our initial module 
-definition will look like this:<br/>
+definition will look like this:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
+<highlight language="c">
 module AP_MODULE_DECLARE_DATA   example_module =
 {
     STANDARD20_MODULE_STUFF,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,
-    <code style='color:#800040; '>register_hooks</code>   <code style='color:#c34e00; '><code style='color:#c34e00; '>/* Our hook registering function */</code></code>
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    register_hooks   /* Our hook registering function */
 };
-</pre>
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-This lets the server know that we are not interesting in anything fancy, we 
+<p>This lets the server know that we are not interesting in anything fancy, we 
 just want to hook onto the requests and possibly handle some of them. </p> 
+
 <p> The reference in our example declaration, <code>register_hooks</code> 
 is the name of a function we will create to manage how we hook onto the 
 request process. In this example module, the function has just one purpose; 
 To create a simple hook that gets called after all the rewrites, access 
 control etc has been handled. Thus, we will let the server know, that we want 
 to hook into its process as one of the last modules: 
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code> register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/* Create a hook in the request handler, so we get called when a request arrives */</code>
-    <code style='color:#800040; '>ap_hook_handler</code><code style='color:#806030; '>(</code>example_handler<code style='color:#806030; '>,</code> <code style='color:#7f0055; font-weight:bold; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#7f0055; font-weight:bold; '>NULL</code><code style='color:#806030; '>,</code> APR_HOOK_LAST<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+static void register_hooks(apr_pool_t *pool)
+{
+    /* Create a hook in the request handler, so we get called when a request arrives */
+    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 The <code>example_handler</code> reference is the function that will handle 
 the request. We will discuss how to create a handler in the next chapter.
 </p>
@@ -218,13 +232,16 @@ the request. We will discuss how to create a handler in the next chapter.
 <p>
 Hooking into the request handling phase is but one of many hooks that you 
 can create. Some other ways of hooking are:
+</p>
 <ul>
 <li><code>ap_hook_child_init</code>: Place a hook that executes when a child process is spawned (commonly used for initializing modules after the server has forked)</li>
 <li><code>ap_hook_pre_config</code>: Place a hook that executes before any configuration data has been read (very early hook)</li>
 <li><code>ap_hook_post_config</code>: Place a hook that executes after configuration has been parsed, but before the server has forked</li>
 <li><code>ap_hook_translate_name</code>: Place a hook that executes when a URI needs to be translated into a filename on the server (think <code>mod_rewrite</code>)</li>
+<li><code>ap_hook_quick_handler</code>: Similar to <code>ap_hook_handler</code>, except it is run before any other request hooks (translation, auth, fixups etc)</li>
+<li><code>ap_hook_log_transaction</code>: Place a hook that executes when the server is about to add a log entry of the current request</li>
 </ul>
-</p>
+
 </section>
 </section>
 
@@ -237,103 +254,111 @@ request and so on), and is put in charge of either telling the server that it's
 not interested in the request or handle the request with the tools provided.
 </p>
 <section id="simple_handler"><title>A simple &quot;Hello, world!&quot; 
-handler</title> Let's start off by making a very simple request handler 
-that does the following: <br/>
+handler</title> 
+<p>Let's start off by making a very simple request handler 
+that does the following:
+</p>
 <ol>
 <li>Check that this is a request that should be served by &quot;example-handler&quot;</li>
 <li>Set the content type of our output to <code>text/html</code></li>
 <li>Write &quot;Hello, world!&quot; back to the client browser</li>
 <li>Let the server know that we took care of this request and everything went fine</li>
 </ol>
-In C code, our example handler will now look like this:<br/>
-
+<p>
+In C code, our example handler will now look like this:
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/* First off, we need to check if this is a call for the "example-handler" handler.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;* If it is, we accept it and do our things, if not, we simply return DECLINED,</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;* and the server will try somewhere else.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;*/</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    /* First off, we need to check if this is a call for the "example-handler" handler.
+     * If it is, we accept it and do our things, if not, we simply return DECLINED,
+     * and the server will try somewhere else.
+     */
+    if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);
     
-    <code style='color:#c34e00; '>/* Now that we are handling this request, we'll write out "Hello, world!" to the client.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;* To do so, we must first set the appropriate content type, followed by our output.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;*/</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#gaa2f8412c400197338ec509f4a45e4579">ap_set_content_type</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/html</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Hello, world!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    /* Now that we are handling this request, we'll write out "Hello, world!" to the client.
+     * To do so, we must first set the appropriate content type, followed by our output.
+     */
+    ap_set_content_type(r, "text/html");
+    ap_rprintf(r, "Hello, world!");
     
-    <code style='color:#c34e00; '>/* Lastly, we must tell the server that we took care of this request and everything went fine.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;* We do so by simply returning the value OK to the server.</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;*/</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    /* Lastly, we must tell the server that we took care of this request and everything went fine.
+     * We do so by simply returning the value OK to the server.
+     */
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 Now, we put all we have learned together and end up with a program that 
 looks like 
 <a href="http://people.apache.org/~humbedooh/mods/examples/mod_example_1.c">mod_example_1.c</a>
 . The functions used in this example will be explained later in the section 
-<a href= "#functions">&quot;Some useful functions you should know&quot;</a>
-. </section> <section id="request_rec"><title>The request_rec structure 
-</title> <p>The most essential part of any request is the <em>request record
+<a href= "#functions">&quot;Some useful functions you should know&quot;</a>. 
+</p>
+</section> 
+<section id="request_rec"><title>The request_rec structure</title> 
+<p>The most essential part of any request is the <em>request record
 </em>. In a call to a handler function, this is represented by the <code>
 request_req* </code> structure passed along with every call that is made. 
 This struct, typically just refered to as <code>r</code> in modules, 
 contains all the information you need for your module to fully process any 
 HTTP request and respond accordingly.</p> <p>Some key elements of the <code>
 request_req </code> structure are:
+</p>
 <ul>
-<li><code><code style='color:#008833'>r-&gt;handler</code> (char*)</code>: Contains the name of the handler the server is currently asking to do the handling of this request</li>
-<li><code><code style='color:#008833'>r-&gt;method</code> (char*)</code>: Contains the HTTP method being used, f.x. GET or POST</li>
-<li><code><code style='color:#008833'>r-&gt;filename</code> (char*)</code>: Contains the translated filename the client is requesting</li>
-<li><code><code style='color:#008833'>r-&gt;args</code> (char*)</code>: Contains the query string of the request, if any</li>
-<li><code><code style='color:#008833'>r-&gt;headers_in</code> (apr_table_t*)</code>: Contains all the headers sent by the client</li>
-<li><code><code style='color:#008833'>r-&gt;connection</code> (conn_rec*)</code>: A record containing information about the current connection</li>
-<li><code><code style='color:#008833'>r-&gt;useragent_ip</code> (char*)</code>: The IP address of the client connecting to us</li>
-<li><code><code style='color:#008833'>r-&gt;pool</code> (apr_pool_t*)</code>: The memory pool of this request. We'll discuss this in the &quot;
-<a href="#memory">Memory management</a>&quot; chapter.</li>
+<li><code>r-&gt;handler (char*):</code> Contains the name of the handler the server is currently asking to do the handling of this request</li>
+<li><code>r-&gt;method (char*):</code> Contains the HTTP method being used, f.x. GET or POST</li>
+<li><code>r-&gt;filename (char*):</code> Contains the translated filename the client is requesting</li>
+<li><code>r-&gt;args (char*):</code> Contains the query string of the request, if any</li>
+<li><code>r-&gt;headers_in (apr_table_t*):</code> Contains all the headers sent by the client</li>
+<li><code>r-&gt;connection (conn_rec*):</code> A record containing information about the current connection</li>
+<li><code>r-&gt;user (char*):</code> If the URI requires authentication, this is set to the username provided</li>
+<li><code>r-&gt;useragent_ip (char*):</code> The IP address of the client connecting to us</li>
+<li><code>r-&gt;pool (apr_pool_t*)</code>: The memory pool of this request. We'll discuss this in the 
+&quot;<a href="#memory">Memory management</a>&quot; chapter.</li>
 </ul>
+<p>
 A complete list of all the values contained with in the <code>request_req</code> structure can be found in 
 the <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/include/httpd.h"><code>httpd.h</code></a> header 
 file or at <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/structrequest__rec.html">http://ci.apache.org/projects/httpd/trunk/doxygen/structrequest__rec.html</a>.
 </p>
+
+
 <p>
 Let's try out some of these variables in another example handler:<br/>
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/* Set the appropriate content type */</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#gaa2f8412c400197338ec509f4a45e4579">ap_set_content_type</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/html</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-
-    <code style='color:#c34e00; '>/* Print out the IP address of the client connecting to us: */</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;h2>Hello, </code><code style='color:#0f6900; '>%s</code><code style='color:#e60000; '>!&lt;/h2></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>useragent_ip</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    /* Set the appropriate content type */
+    ap_set_content_type(r, &quot;text/html&quot;);
+
+    /* Print out the IP address of the client connecting to us: */
+    ap_rprintf(r, &quot;&lt;h2&gt;Hello, %s!&lt;/h2&gt;&quot;, r-&gt;useragent_ip);
     
-    <code style='color:#c34e00; '>/* If we were reached through a GET or a POST request, be happy, else sad. */</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code> <code style='color:#806030; '>!</code><code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>method</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>POST</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#806030; '>!</code><code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>method</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>GET</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>You used a GET or a POST method, that makes us happy!&lt;br></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> <code style='color:#806030; '>{</code>
-        ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>You did not use POST or GET, that makes us sad :(&lt;br></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#c34e00; '>/* Lastly, if there was a query string, let's print that too! */</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>args</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Your query string was: </code><code style='color:#0f6900; '>%s</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>args</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    /* If we were reached through a GET or a POST request, be happy, else sad. */
+    if ( !strcmp(r-&gt;method, &quot;POST&quot;) || !strcmp(r-&gt;method, &quot;GET&quot;) ) {
+        ap_rputs(&quot;You used a GET or a POST method, that makes us happy!&lt;br/&gt;&quot;, r);
+    }
+    else {
+        ap_rputs(&quot;You did not use POST or GET, that makes us sad :(&lt;br/&gt;&quot;, r);
+    }
+
+    /* Lastly, if there was a query string, let's print that too! */
+    if (r-&gt;args) {
+        ap_rprintf(r, &quot;Your query string was: %s&quot;, r-&gt;args);
+    }
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-</p>
 </section>
 
 <section id="return_value"><title>Return values</title>
@@ -344,20 +369,20 @@ module is not interested in handling a specific request, it should always
 return the value <code>DECLINED</code>. If it is handling a request, it 
 should either return the generic value <code>OK</code>, or a specific HTTP 
 status code, for example:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/* Return 404: Not found */</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> HTTP_NOT_FOUND<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    /* Return 404: Not found */
+    return HTTP_NOT_FOUND;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-Returning <code>OK</code> or a HTTP status code does not necessarilly mean 
+<p>
+Returning <code>OK</code> or a HTTP status code does not necessarily mean 
 that the request will end. The server may still have other handlers that are 
 interested in this request, for instance the logging modules which, upon a 
 successful request, will write down a summary of what was requested and how 
@@ -367,12 +392,15 @@ know that it should cease all activity on this request and carry on with
 the next, without informing other handlers.
 <br/>
 <strong>General response codes:</strong>
+</p>
 <ul>
 <li><code>DECLINED</code>: We are not handling this request</li>
 <li><code>OK</code>: We handled this request and it went well</li>
 <li><code>DONE</code>: We handled this request and the server should just close this thread without further processing</li>
-</ul><br/>
+</ul>
+<p>
 <strong>HTTP specific return codes (excerpt):</strong>
+</p>
 <ul>
 <li><code>HTTP_OK (200)</code>: Request was okay</li>
 <li><code>HTTP_MOVED_PERMANENTLY (301)</code>: The resource has moved to a new URL</li>
@@ -381,7 +409,6 @@ the next, without informing other handlers.
 <li><code>HTTP_NOT_FOUND (404)</code>: File not found</li>
 <li><code>HTTP_INTERNAL_SERVER_ERROR (500)</code>: Internal server error (self explanatory)</li>
 </ul>
-</p>
 </section>
 
 <section id="functions"><title>Some useful functions you should know</title>
@@ -395,7 +422,7 @@ the next, without informing other handlers.
     
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Hello, world!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code></pre>
+<highlight language="c">ap_rputs("Hello, world!", r);</highlight>
 <!-- END EXAMPLE CODE -->
 
 
@@ -407,7 +434,7 @@ the next, without informing other handlers.
     
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'><code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a></code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Hello, </code><code style='color:#0f6900; '>%s</code><code style='color:#e60000; '>!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>useragent_ip</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code></pre>
+<highlight language="c">ap_rprintf(r, "Hello, %s!", r->useragent_ip);</highlight>
 <!-- END EXAMPLE CODE -->
 
 </li>
@@ -418,7 +445,7 @@ the next, without informing other handlers.
     
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'><code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#gaa2f8412c400197338ec509f4a45e4579">ap_set_content_type</a></code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/plain</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* force a raw text output */</code></pre>
+<highlight language="c">ap_set_content_type(r, "text/plain"); /* force a raw text output */</highlight>
 <!-- END EXAMPLE CODE -->
 
 </li>
@@ -438,10 +465,11 @@ clean up after yourself - pretty neat, huh?
 </p>
 
 <p>
-In our module, we will primarilly be allocating memory for each request, so 
-it's appropriate to use the <code style='color:#008833'>r-&gt;pool</code> 
+In our module, we will primarily be allocating memory for each request, so 
+it's appropriate to use the <code>r-&gt;pool</code> 
 reference when creating new objects. A few of the functions for allocating 
 memory within a pool are:
+</p>
 <ul>
 <li><code>void* <a href="http://apr.apache.org/docs/apr/1.4/group__apr__pools.html#ga85f1e193c31d109affda72f9a92c6915">apr_palloc</a>(
 apr_pool_t *p, apr_size_t size)</code>: Allocates <code>size</code> number of bytes in the pool for you</li>
@@ -451,52 +479,54 @@ apr_pool_t *p, apr_size_t size)</code>: Allocates <code>size</code> number of by
 apr_pool_t *p, const char *s)</code>: Creates a duplicate of the string <code>s</code>. This is useful for copying constant values so you can edit them</li>
 <li><code>char* <a href="http://apr.apache.org/docs/apr/1.4/group__apr__strings.html#ga3eca76b8d293c5c3f8021e45eda813d8">apr_psprintf</a>(
 apr_pool_t *p, const char *fmt, ...)</code>: Similar to <code>sprintf</code>, except the server supplies you with an appropriately allocated target variable</li>
-
 </ul>
-Let's put these functions into an example handler:<br/>
+
+<p>Let's put these functions into an example handler:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '>*</code> original <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>You can't edit this!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '>*</code> copy<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code><code style='color:#806030; '>*</code> integers<code style='color:#806030; '>;</code>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    const char* original = "You can't edit this!";
+    char* copy;
+    int* integers;
     
-    <code style='color:#c34e00; '>/* Allocate space for 10 integer values and set them all to zero. */</code>
-    integers <code style='color:#806030; '>=</code> apr_pcalloc<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>sizeof</code><code style='color:#806030; '>(</code><code style='color:#400000; font-weight:bold; '>int</code><code style='color:#806030; '>)</code><code style='color:#806030; '>*</code><code style='color:#c00000; '>10</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code> 
+    /* Allocate space for 10 integer values and set them all to zero. */
+    integers = apr_pcalloc(r->pool, sizeof(int)*10); 
     
-    <code style='color:#c34e00; '>/* Create a copy of the 'original' variable that we can edit. */</code>
-    copy <code style='color:#806030; '>=</code> apr_pstrdup<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>pool<code style='color:#806030; '>,</code> original<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    /* Create a copy of the 'original' variable that we can edit. */
+    copy = apr_pstrdup(r->pool, original);
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
+<p>
 This is all well and good for our module, which won't need any 
 pre-initialized variables or structures. However, if we wanted to 
 initialize something early on, before the requests come rolling in, we 
 could simply add a call to a function in our <code>register_hooks</code> 
 function to sort it out:
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code> register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/* Call a function that initializes some stuff */</code>
-    <code style='color:#800040; '>example_init_function</code><code style='color:#806030; '>(</code>pool<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/* Create a hook in the request handler, so we get called when a request arrives */</code>
-    <code style='color:#800040; '>ap_hook_handler</code><code style='color:#806030; '>(</code>example_handler<code style='color:#806030; '>,</code> <code style='color:#7f0055; font-weight:bold; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#7f0055; font-weight:bold; '>NULL</code><code style='color:#806030; '>,</code> APR_HOOK_LAST<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+static void register_hooks(apr_pool_t *pool)
+{
+    /* Call a function that initializes some stuff */
+    example_init_function(pool);
+    /* Create a hook in the request handler, so we get called when a request arrives */
+    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
+<p>
 In this pre-request initialization function we would not be using the 
 same pool as we did when allocating resources for request-based functions. 
 Instead, we would use the pool given to us by the server for allocating memory 
 on a per-process based level.
-
 </p>
 </section>
 
@@ -515,38 +545,41 @@ digest.
 <p>
 Since the introduction of Apache HTTP Server 2.4, parsing request data from GET and 
 POST requests have never been easier. All we require to parse both GET and 
-POST data is four simple lines: 
+POST data is four simple lines:
+</p> 
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__apr__tables.html#gad7ea82d6608a4a633fc3775694ab71e4">apr_table_t</a> *GET;
-<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/structapr__array__header__t.html">apr_array_header_t</a> *POST;
-
-<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__SCRIPT.html#gaed25877b529623a4d8f99f819ba1b7bd">ap_args_to_table</a>(r, &amp;GET);
-<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__DAEMON.html#ga9d426b6382b49754d4f87c55f65af202">ap_parse_form_data</a>(r, <code style='color:#7f0055; font-weight:bold; '>NULL</code>, &amp;POST, -1, 8192);
-</pre>
+<highlight language="c">
+<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__apr__tables.html#gad7ea82d6608a4a633fc3775694ab71e4">apr_table_t</a> *GET; <em>
+</em><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/structapr__array__header__t.html">apr_array_header_t</a>*POST; 
+<em>
+</em>
+<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__SCRIPT.html#gaed25877b529623a4d8f99f819ba1b7bd">
+ap_args_to_table</a>(r, &amp;GET); <em>
+</em><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__DAEMON.html#ga9d426b6382b49754d4f87c55f65af202">
+ap_parse_form_data</a>(r, NULL, &amp;POST, -1, 8192); 
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 In our specific example module, we're looking for the <code>digest</code> 
 value from the query string, which now resides inside a table called <code>
 GET</code>. To extract this value, we need only perform a simple operation:
-<br/>
+</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#c34e00; '>/* Get the "digest" key from the query string, if any. */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>digestType <code style='color:#806030; '>=</code> <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__apr__tables.html#ga4db13e3915c6b9a3142b175d4c15d915">apr_table_get</a><code style='color:#806030; '>(</code>GET<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>digest</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/* If no key was returned, we will set a default value instead. */</code>
-<code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>digestType<code style='color:#806030; '>)</code> digestType <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>sha1</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+/* Get the "digest" key from the query string, if any. */
+const char *digestType = apr_table_get(GET, "digest");
 
-</pre>
+/* If no key was returned, we will set a default value instead. */
+if (!digestType) digestType = "sha1";
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 The structures used for the POST and GET data are not exactly the same, so 
 if we were to fetch a value from POST data instead of the query string, we 
 would have to resort to a few more lines, as outlined in <a href="#get_post"
@@ -555,130 +588,130 @@ would have to resort to a few more lines, as outlined in <a href="#get_post"
 </section>
 
 <section id="advanced_handler"><title>Making an advanced handler</title>
+<p>
 Now that we have learned how to parse form data and manage our resources, 
 we can move on to creating an advanced version of our module, that spits 
-out the MD5 or SHA1 digest of files:<br/>
+out the MD5 or SHA1 digest of files:
+</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>int</code> rc<code style='color:#806030; '>,</code> exists<code style='color:#806030; '>;</code>
-    apr_finfo_t finfo<code style='color:#806030; '>;</code>
-    apr_file_t<code style='color:#806030; '> *</code>file<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>filename<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>char</code> buffer<code style='color:#806030; '>[</code><code style='color:#c00000; '>256</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-    apr_size_t readBytes<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code> n<code style='color:#806030; '>;</code>
-    apr_table_t<code style='color:#806030; '> *</code>GET<code style='color:#806030; '>;</code>
-    apr_array_header_t<code style='color:#806030; '> *</code>POST<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>digestType<code style='color:#806030; '>;</code>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    int rc, exists;
+    apr_finfo_t finfo;
+    apr_file_t *file;
+    char *filename;
+    char buffer[256];
+    apr_size_t readBytes;
+    int n;
+    apr_table_t *GET;
+    apr_array_header_t *POST;
+    const char *digestType;
     
     
-    <code style='color:#c34e00; '>/* Check that the "example-handler" handler is being called. */</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    /* Check that the &quot;example-handler&quot; handler is being called. */
+    if (!r-&gt;handler || strcmp(r-&gt;handler, &quot;example-handler&quot;)) return (DECLINED);
     
-    <code style='color:#c34e00; '>/* Figure out which file is being requested by removing the .sum from it */</code>
-    filename <code style='color:#806030; '>=</code> apr_pstrdup<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>pool</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>filename</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    filename<code style='color:#806030; '>[</code><code style='color:#800040; '>strlen</code><code style='color:#806030; '>(</code>filename<code style='color:#806030; '>)</code><code style='color:#806030; '>-</code><code style='color:#c00000; '>4</code><code style='color:#806030; '>]</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* Cut off the last 4 characters. */</code>
+    /* Figure out which file is being requested by removing the .sum from it */
+    filename = apr_pstrdup(r-&gt;pool, r-&gt;filename);
+    filename[strlen(filename)-4] = 0; /* Cut off the last 4 characters. */
     
-    <code style='color:#c34e00; '>/* Figure out if the file we request a sum on exists and isn't a directory */</code>
-    rc <code style='color:#806030; '>=</code> apr_stat<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>finfo<code style='color:#806030; '>,</code> filename<code style='color:#806030; '>,</code> APR_FINFO_MIN<code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>pool</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code>rc <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> APR_SUCCESS<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        exists <code style='color:#806030; '>=</code>
-        <code style='color:#806030; '>(</code>
-            <code style='color:#806030; '>(</code>finfo<code style='color:#806030; '>.</code>filetype <code style='color:#806030; '>!</code><code style='color:#806030; '>=</code> APR_NOFILE<code style='color:#806030; '>)</code>
-        <code style='color:#806030; '>&amp;</code><code style='color:#806030; '>&amp;</code>  <code style='color:#806030; '>!</code><code style='color:#806030; '>(</code>finfo<code style='color:#806030; '>.</code>filetype <code style='color:#806030; '>&amp;</code> APR_DIR<code style='color:#806030; '>)</code>
-        <code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-        <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>exists<code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code> HTTP_NOT_FOUND<code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* Return a 404 if not found. */</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#c34e00; '>/* If apr_stat failed, we're probably not allowed to check this file. */</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> <code style='color:#400000; font-weight:bold; '>return</code> HTTP_FORBIDDEN<code style='color:#806030; '>;</code>
+    /* Figure out if the file we request a sum on exists and isn't a directory */
+    rc = apr_stat(&amp;finfo, filename, APR_FINFO_MIN, r-&gt;pool);
+    if (rc == APR_SUCCESS) {
+        exists =
+        (
+            (finfo.filetype != APR_NOFILE)
+        &amp;&amp;  !(finfo.filetype &amp; APR_DIR)
+        );
+        if (!exists) return HTTP_NOT_FOUND; /* Return a 404 if not found. */
+    }
+    /* If apr_stat failed, we're probably not allowed to check this file. */
+    else return HTTP_FORBIDDEN;
     
-    <code style='color:#c34e00; '>/* Parse the GET and, optionally, the POST data sent to us */</code>
+    /* Parse the GET and, optionally, the POST data sent to us */
     
-    ap_args_to_table<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>GET<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_parse_form_data<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>POST<code style='color:#806030; '>,</code> <code style='color:#806030; '>-</code><code style='color:#c00000; '>1</code><code style='color:#806030; '>,</code> <code style='color:#c00000; '>8192</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    ap_args_to_table(r, &amp;GET);
+    ap_parse_form_data(r, NULL, &amp;POST, -1, 8192);
     
-    <code style='color:#c34e00; '>/* Set the appropriate content type */</code>
-    ap_set_content_type<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/html</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    /* Set the appropriate content type */
+    ap_set_content_type(r, &quot;text/html&quot;);
     
-    <code style='color:#c34e00; '>/* Print a title and some general information */</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;h2>Information on </code><code style='color:#0f6900; '>%s</code><code style='color:#e60000; '>:&lt;/h2></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> filename<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;b>Size:&lt;/b> </code><code style='color:#0f6900; '>%u</code><code style='color:#e60000; '> bytes&lt;br/></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> finfo<code style='color:#806030; '>.</code>size<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    /* Print a title and some general information */
+    ap_rprintf(r, &quot;&lt;h2&gt;Information on %s:&lt;/h2&gt;&quot;, filename);
+    ap_rprintf(r, &quot;&lt;b&gt;Size:&lt;/b&gt; %u bytes&lt;br/&gt;&quot;, finfo.size);
     
-    <code style='color:#c34e00; '>/* Get the digest type the client wants to see */</code>
-    digestType <code style='color:#806030; '>=</code> apr_table_get<code style='color:#806030; '>(</code>GET<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>digest</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>digestType<code style='color:#806030; '>)</code> digestType <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>MD5</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
+    /* Get the digest type the client wants to see */
+    digestType = apr_table_get(GET, &quot;digest&quot;);
+    if (!digestType) digestType = &quot;MD5&quot;;
     
     
-    rc <code style='color:#806030; '>=</code> apr_file_open<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>file<code style='color:#806030; '>,</code> filename<code style='color:#806030; '>,</code> APR_READ<code style='color:#806030; '>,</code> APR_OS_DEFAULT<code style='color:#806030; '>,</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>pool</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code>rc <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> APR_SUCCESS<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
+    rc = apr_file_open(&amp;file, filename, APR_READ, APR_OS_DEFAULT, r-&gt;pool);
+    if (rc == APR_SUCCESS) {
         
-        <code style='color:#c34e00; '>/* Are we trying to calculate the MD5 or the SHA1 digest? */</code>
-        <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>digestType<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>md5</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-            <code style='color:#c34e00; '>/* Calculate the MD5 sum of the file */</code>
-            <code style='color:#400000; font-weight:bold; '>union</code> <code style='color:#806030; '>{</code>
-                <code style='color:#400000; font-weight:bold; '>char</code>      chr<code style='color:#806030; '>[</code><code style='color:#c00000; '>16</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-                uint32_t  num<code style='color:#806030; '>[</code><code style='color:#c00000; '>4</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code> digest<code style='color:#806030; '>;</code>
-            apr_md5_ctx_t md5<code style='color:#806030; '>;</code>
-            apr_md5_init<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>md5<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            readBytes <code style='color:#806030; '>=</code> <code style='color:#c00000; '>256</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>while</code> <code style='color:#806030; '>(</code> apr_file_read<code style='color:#806030; '>(</code>file<code style='color:#806030; '>,</code> buffer<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>readBytes<code style='color:#806030; '>)</code> <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> APR_SUCCESS <code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-                apr_md5_update<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>md5<code style='color:#806030; '>,</code> buffer<code style='color:#806030; '>,</code> readBytes<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-            apr_md5_final<code style='color:#806030; '>(</code>digest<code style='color:#806030; '>.</code>chr<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>md5<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+        /* Are we trying to calculate the MD5 or the SHA1 digest? */
+        if (!strcasecmp(digestType, &quot;md5&quot;)) {
+            /* Calculate the MD5 sum of the file */
+            union {
+                char      chr[16];
+                uint32_t  num[4];
+            } digest;
+            apr_md5_ctx_t md5;
+            apr_md5_init(&amp;md5);
+            readBytes = 256;
+            while ( apr_file_read(file, buffer, &amp;readBytes) == APR_SUCCESS ) {
+                apr_md5_update(&amp;md5, buffer, readBytes);
+            }
+            apr_md5_final(digest.chr, &amp;md5);
             
-            <code style='color:#c34e00; '>/* Print out the MD5 digest */</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;b>MD5: &lt;/b>&lt;code></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>for</code> <code style='color:#806030; '>(</code>n <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code> n <code style='color:#806030; '>&lt;</code> APR_MD5_DIGESTSIZE<code style='color:#806030; '>/</code><code style='color:#c00000; '>4</code><code style='color:#806030; '>;</code> n<code style='color:#806030; '>+</code><code style='color:#806030; '>+</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-                ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#0f6900; '>%08x</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> digest<code style='color:#806030; '>.</code>num<code style='color:#806030; '>[</code>n<code style='color:#806030; '>]</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;/code></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#c34e00; '>/* Print a link to the SHA1 version */</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;br/>&lt;a href='?digest=sha1'>View the SHA1 hash instead&lt;/a></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>}</code>
-        <code style='color:#400000; font-weight:bold; '>else</code> <code style='color:#806030; '>{</code>
-            <code style='color:#c34e00; '>/* Calculate the SHA1 sum of the file */</code>
-            <code style='color:#400000; font-weight:bold; '>union</code> <code style='color:#806030; '>{</code>
-                <code style='color:#400000; font-weight:bold; '>char</code>      chr<code style='color:#806030; '>[</code><code style='color:#c00000; '>20</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-                uint32_t  num<code style='color:#806030; '>[</code><code style='color:#c00000; '>5</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code> digest<code style='color:#806030; '>;</code>
-            apr_sha1_ctx_t sha1<code style='color:#806030; '>;</code>
-            apr_sha1_init<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>sha1<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            readBytes <code style='color:#806030; '>=</code> <code style='color:#c00000; '>256</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>while</code> <code style='color:#806030; '>(</code> apr_file_read<code style='color:#806030; '>(</code>file<code style='color:#806030; '>,</code> buffer<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>readBytes<code style='color:#806030; '>)</code> <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> APR_SUCCESS <code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-                apr_sha1_update<code style='color:#806030; '>(</code><code style='color:#806030; '>&amp;</code>sha1<code style='color:#806030; '>,</code> buffer<code style='color:#806030; '>,</code> readBytes<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-            apr_sha1_final<code style='color:#806030; '>(</code>digest<code style='color:#806030; '>.</code>chr<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>sha1<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+            /* Print out the MD5 digest */
+            ap_rputs(&quot;&lt;b&gt;MD5: &lt;/b&gt;&lt;code&gt;&quot;, r);
+            for (n = 0; n &lt; APR_MD5_DIGESTSIZE/4; n++) {
+                ap_rprintf(r, &quot;%08x&quot;, digest.num[n]);
+            }
+            ap_rputs(&quot;&lt;/code&gt;&quot;, r);
+            /* Print a link to the SHA1 version */
+            ap_rputs(&quot;&lt;br/&gt;&lt;a href='?digest=sha1'&gt;View the SHA1 hash instead&lt;/a&gt;&quot;, r);
+        }
+        else {
+            /* Calculate the SHA1 sum of the file */
+            union {
+                char      chr[20];
+                uint32_t  num[5];
+            } digest;
+            apr_sha1_ctx_t sha1;
+            apr_sha1_init(&amp;sha1);
+            readBytes = 256;
+            while ( apr_file_read(file, buffer, &amp;readBytes) == APR_SUCCESS ) {
+                apr_sha1_update(&amp;sha1, buffer, readBytes);
+            }
+            apr_sha1_final(digest.chr, &amp;sha1);
             
-            <code style='color:#c34e00; '>/* Print out the SHA1 digest */</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;b>SHA1: &lt;/b>&lt;code></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>for</code> <code style='color:#806030; '>(</code>n <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code> n <code style='color:#806030; '>&lt;</code> APR_SHA1_DIGESTSIZE<code style='color:#806030; '>/</code><code style='color:#c00000; '>4</code><code style='color:#806030; '>;</code> n<code style='color:#806030; '>+</code><code style='color:#806030; '>+</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-                ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#0f6900; '>%08x</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> digest<code style='color:#806030; '>.</code>num<code style='color:#806030; '>[</code>n<code style='color:#806030; '>]</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;/code></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+            /* Print out the SHA1 digest */
+            ap_rputs(&quot;&lt;b&gt;SHA1: &lt;/b&gt;&lt;code&gt;&quot;, r);
+            for (n = 0; n &lt; APR_SHA1_DIGESTSIZE/4; n++) {
+                ap_rprintf(r, &quot;%08x&quot;, digest.num[n]);
+            }
+            ap_rputs(&quot;&lt;/code&gt;&quot;, r);
             
-            <code style='color:#c34e00; '>/* Print a link to the MD5 version */</code>
-            ap_rputs<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;br/>&lt;a href='?digest=md5'>View the MD5 hash instead&lt;/a></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>}</code>
-        apr_file_close<code style='color:#806030; '>(</code>file<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+            /* Print a link to the MD5 version */
+            ap_rputs(&quot;&lt;br/&gt;&lt;a href='?digest=md5'&gt;View the MD5 hash instead&lt;/a&gt;&quot;, r);
+        }
+        apr_file_close(file);
         
-    <code style='color:#806030; '>}</code>
-    
-    
-    
-    <code style='color:#c34e00; '>/* Let the server know that we responded to this request. */</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    }    
+    /* Let the server know that we responded to this request. */
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 This version in its entirity can be found here: 
 <a href="http://people.apache.org/~humbedooh/mods/examples/mod_example_2.c">mod_example_2.c</a>.
+</p>
 </section>
 
 </section>
@@ -693,141 +726,150 @@ advanced configurations
 for your modules.
 </p>
 <section id="config_intro"><title>An introduction to configuration 
-directives</title> If you are reading this, then you probably already know 
+directives</title>
+<p>
+If you are reading this, then you probably already know 
 what a configuration directive is. Simply put, a directive is a way of 
 telling an individual module (or a set of modules) how to behave, such as 
 these directives control how <code>mod_rewrite</code> works:
-<example><pre>
+</p>
+<highlight language="config">
 RewriteEngine On
 RewriteCond %{REQUEST_URI} ^/foo/bar
 RewriteRule ^/foo/bar/(.*)$ /foobar?page=$1
-</pre></example>
+</highlight>
+<p>
 Each of these configuration directives are handled by a separate function, 
 that parses the parameters given and sets up a configuration accordingly.
+</p>
 </section>
 <section id="config_simple"><title>Making an example configuration</title>
-To begin with, we'll create a basic configuration in C-space:
+<p>To begin with, we'll create a basic configuration in C-space:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>typedef</code> <code style='color:#400000; font-weight:bold; '>struct</code> <code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         enabled<code style='color:#806030; '>;</code>      <code style='color:#c34e00; '>/* Enable or disable our module */</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>path<code style='color:#806030; '>;</code>         <code style='color:#c34e00; '>/* Some path to...something */</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         typeOfAction<code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* 1 means action A, 2 means action B and so on */</code>
-<code style='color:#806030; '>}</code> example_config<code style='color:#806030; '>;</code>
-</pre>
+<highlight language="c">
+typedef struct {
+    int         enabled;      /* Enable or disable our module */
+    const char *path;         /* Some path to...something */
+    int         typeOfAction; /* 1 means action A, 2 means action B and so on */
+} example_config;
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 Now, let's put this into perspective by creating a very small module that 
 just prints out a hard-coded configuration. You'll notice that we use the 
 <code>register_hooks</code> function for initializing the configuration 
 values to their defaults:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>typedef</code> <code style='color:#400000; font-weight:bold; '>struct</code> <code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         enabled<code style='color:#806030; '>;</code>      <code style='color:#c34e00; '>/* Enable or disable our module */</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>path<code style='color:#806030; '>;</code>         <code style='color:#c34e00; '>/* Some path to...something */</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         typeOfAction<code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* 1 means action A, 2 means action B and so on */</code>
-<code style='color:#806030; '>}</code> example_config<code style='color:#806030; '>;</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> example_config config<code style='color:#806030; '>;</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_set_content_type<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/plain</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(r, </code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Enabled: </code><code style='color:#0f6900; '>%u</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>enabled<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(r, </code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Path: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>path<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(r, </code><code style='color:#800000; '>"</code><code style='color:#e60000; '>TypeOfAction: </code><code style='color:#0f6900; '>%x</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>typeOfAction<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code> register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>;</code>
-    config<code style='color:#806030; '>.</code>path <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>/foo/bar</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-    config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x00</code><code style='color:#806030; '>;</code>
-    ap_hook_handler<code style='color:#806030; '>(</code>example_handler<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> APR_HOOK_LAST<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/* Define our module as an entity and assign a function for registering hooks  */</code>
-
-module AP_MODULE_DECLARE_DATA   example_module <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    STANDARD20_MODULE_STUFF<code style='color:#806030; '>,</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks   <code style='color:#c34e00; '>/* Our hook registering function */</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-</pre>
-<!-- END EXAMPLE CODE -->
+<highlight language="c">
+typedef struct {
+    int         enabled;      /* Enable or disable our module */
+    const char *path;         /* Some path to...something */
+    int         typeOfAction; /* 1 means action A, 2 means action B and so on */
+} example_config;
+
+static example_config config;
+
+static int example_handler(request_rec *r)
+{
+    if (!r-&gt;handler || strcmp(r-&gt;handler, &quot;example-handler&quot;)) return(DECLINED);
+    ap_set_content_type(r, &quot;text/plain&quot;);
+    ap_rprintf(r, &quot;Enabled: %u\n&quot;, config.enabled);
+    ap_rprintf(r, &quot;Path: %s\n&quot;, config.path);
+    ap_rprintf(r, &quot;TypeOfAction: %x\n&quot;, config.typeOfAction);
+    return OK;
+}
+
+static void register_hooks(apr_pool_t *pool) 
+{
+    config.enabled = 1;
+    config.path = &quot;/foo/bar&quot;;
+    config.typeOfAction = 0x00;
+    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
+}
 
+/* Define our module as an entity and assign a function for registering hooks  */
 
+module AP_MODULE_DECLARE_DATA   example_module =
+{
+    STANDARD20_MODULE_STUFF,
+    NULL,            /* Per-directory configuration handler */
+    NULL,            /* Merge handler for per-directory configurations */
+    NULL,            /* Per-server configuration handler */
+    NULL,            /* Merge handler for per-server configurations */
+    NULL,            /* Any directives we may have for httpd */
+    register_hooks   /* Our hook registering function */
+};
+</highlight>
+<!-- END EXAMPLE CODE -->
+
+<p>
 So far so good. To access our new handler, we could add the following to 
 our configuration:
-<example><pre>
+</p>
+<highlight language="config">
 &lt;Location /example&gt;
     SetHandler example-handler
 &lt;/Location&gt;
-</pre></example>
+</highlight>
+<p>
 When we visit, we'll see our current configuration being spit out by our 
 module. 
+</p>
 </section>
 
 <section id="register_directive"><title>Registering directives with the server</title>
+<p>
 What if we want to change our configuration, not by hard-coding new values 
 into the module, but by using either the httpd.conf file or possibly a 
 .htaccess file? It's time to let the server know that we want this to be 
 possible. To do so, we must first change our <em>name tag</em> to include a 
 reference to the configuration directives we want to register with the server:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
+<highlight language="c">
 module AP_MODULE_DECLARE_DATA   example_module =
 {
     STANDARD20_MODULE_STUFF,
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,               <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,               <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,               <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    <code style='color:#7f0055; font-weight:bold; '>NULL</code>,               <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    example_directives, <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks      <code style='color:#c34e00; '>/* Our hook registering function */</code>
+    NULL,               /* Per-directory configuration handler */
+    NULL,               /* Merge handler for per-directory configurations */
+    NULL,               /* Per-server configuration handler */
+    NULL,               /* Merge handler for per-server configurations */
+    example_directives, /* Any directives we may have for httpd */
+    register_hooks      /* Our hook registering function */
 };
-</pre>
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
+<p>
 This will tell the server that we are now accepting directives from the 
 configuration files, and that the structure called <code>example_directives
 </code> holds information on what our directives are and how they work. 
 Since we have three different variables in our module configuration, we 
 will add a structure with three directives and a NULL at the end:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
+<highlight language="c">
 static const command_rec        example_directives[] =
 {
-    <code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a></code>("exampleEnabled", example_set_enabled, <code style='color:#7f0055; font-weight:bold; '>NULL</code>, RSRC_CONF, "Enable or disable mod_example"),
-    <code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a></code>("examplePath", example_set_path, <code style='color:#7f0055; font-weight:bold; '>NULL</code>, RSRC_CONF, "The path to whatever"),
-    <code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a></code>("exampleAction", example_set_action, <code style='color:#7f0055; font-weight:bold; '>NULL</code>, RSRC_CONF, "Special action value!"),
-    { <code style='color:#7f0055; font-weight:bold; '>NULL</code> }
+    AP_INIT_TAKE1("exampleEnabled", example_set_enabled, NULL, RSRC_CONF, "Enable or disable mod_example"),
+    AP_INIT_TAKE1("examplePath", example_set_path, NULL, RSRC_CONF, "The path to whatever"),
+    AP_INIT_TAKE2("exampleAction", example_set_action, NULL, RSRC_CONF, "Special action value!"),
+    { NULL }
 };
-</pre>
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-<img src="../images/build_a_mod_4.png" border="1"/><br/>
 <p>
+<img src="../images/build_a_mod_4.png" alt="Directives structure"/><br />
 As you can see, each directive needs at least 5 parameters set:
+</p>
 <ol>
 <li><code><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a></code>: This is a macro that tells the server that this directive takes one and only one argument. 
 If we required two arguments, we could use the macro <code><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a></code> and so on (refer to httpd_conf.h 
@@ -836,10 +878,11 @@ for more macros).</li>
 configuration in order to invoke a configuration change in our module.</li>
 <li><code>example_set_enabled</code>: This is a reference to a C function that parses the directive and sets the configuration 
 accordingly. We will discuss how to make this in the following paragraph.</li>
-<li><code>RSRC_CONF</code>: This tells the server where the directive is permissable. We'll go into details on this value in the 
+<li><code>RSRC_CONF</code>: This tells the server where the directive is permitted. We'll go into details on this value in the 
 later chapters, but for now, <code>RSRC_CONF</code> means that the server will only accept these directives in a server context.</li>
 <li><code>"Enable or disable...."</code>: This is simply a brief description of what the directive does.</li>
 </ol>
+<p>
 (<em>The "missing" parameter in our definition, which is usually set to 
 <code>NULL</code>, is an optional function that can be run after the 
 initial function to parse the arguments have been run. This is usually 
@@ -855,176 +898,176 @@ configuration file(s) is text, and so naturally, what it passes along to
 our directive handler is one or more strings, that we ourselves need to 
 recognize and act upon. You'll notice, that since we set our <code>
 exampleAction</code> directive to accept two arguments, its C function also 
-has an additional parameter defined:<br/
+has an additional parameter defined:</p
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#c34e00; '>/* Handler for the "exambleEnabled" directive */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_enabled<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>on</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/* Handler for the "examplePath" directive */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_path<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    config<code style='color:#806030; '>.</code>path <code style='color:#806030; '>=</code> arg<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/* Handler for the "exampleAction" directive */</code>
-<code style='color:#c34e00; '>/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */</code>
-<code style='color:#c34e00; '>/* and we store it in a bit-wise manner. */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_action<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg1<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '>*</code> arg2<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg1<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>file</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x01</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x02</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+/* Handler for the "exambleEnabled" directive */
+const char *example_set_enabled(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    if(!strcasecmp(arg, "on")) config.enabled = 1;
+    else config.enabled = 0;
+    return NULL;
+}
+
+/* Handler for the "examplePath" directive */
+const char *example_set_path(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    config.path = arg;
+    return NULL;
+}
+
+/* Handler for the "exampleAction" directive */
+/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
+/* and we store it in a bit-wise manner. */
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+{
+    if(!strcasecmp(arg1, "file")) config.typeOfAction = 0x01;
+    else config.typeOfAction = 0x02;
     
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg2<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>deny</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x10</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x20</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    if(!strcasecmp(arg2, "deny")) config.typeOfAction += 0x10;
+    else config.typeOfAction += 0x20;
+    return NULL;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-</p>
 </section>
 <section id="directive_complete"><title>Putting it all together</title>
 <p>
 Now that we have our directives set up, and handlers configured for them, 
 we can assemble our module into one big file:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#c34e00; '>/* mod_example_config_simple.c: */</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>&lt;</code><code style='color:#40015a; '>stdio.h</code><code style='color:#800000; '>></code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>apr_hash.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>ap_config.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>ap_provider.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>httpd.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_core.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_config.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_log.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_protocol.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_request.h</code><code style='color:#800000; '>"</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;Our configuration prototype and declaration:</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>typedef</code> <code style='color:#400000; font-weight:bold; '>struct</code> <code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         enabled<code style='color:#806030; '>;</code>      <code style='color:#c34e00; '>/* Enable or disable our module */</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>path<code style='color:#806030; '>;</code>         <code style='color:#c34e00; '>/* Some path to...something */</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         typeOfAction<code style='color:#806030; '>;</code> <code style='color:#c34e00; '>/* 1 means action A, 2 means action B and so on */</code>
-<code style='color:#806030; '>}</code> example_config<code style='color:#806030; '>;</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> example_config config<code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;Our directive handlers:</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#c34e00; '>/* Handler for the "exambleEnabled" directive */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_enabled<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>on</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/* Handler for the "examplePath" directive */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_path<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    config<code style='color:#806030; '>.</code>path <code style='color:#806030; '>=</code> arg<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/* Handler for the "exampleAction" directive */</code>
-<code style='color:#c34e00; '>/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */</code>
-<code style='color:#c34e00; '>/* and we store it in a bit-wise manner. */</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '> *</code>example_set_action<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg1<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '>*</code> arg2<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg1<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>file</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x01</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x02</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+/* mod_example_config_simple.c: */
+#include &lt;stdio.h&gt;
+#include "apr_hash.h"
+#include "ap_config.h"
+#include "ap_provider.h"
+#include "httpd.h"
+#include "http_core.h"
+#include "http_config.h"
+#include "http_log.h"
+#include "http_protocol.h"
+#include "http_request.h"
+
+/*
+ ==============================================================================
+ Our configuration prototype and declaration:
+ ==============================================================================
+ */
+typedef struct {
+    int         enabled;      /* Enable or disable our module */
+    const char *path;         /* Some path to...something */
+    int         typeOfAction; /* 1 means action A, 2 means action B and so on */
+} example_config;
+
+static example_config config;
+
+/*
+ ==============================================================================
+ Our directive handlers:
+ ==============================================================================
+ */
+/* Handler for the &quot;exambleEnabled&quot; directive */
+const char *example_set_enabled(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    if(!strcasecmp(arg, &quot;on&quot;)) config.enabled = 1;
+    else config.enabled = 0;
+    return NULL;
+}
+
+/* Handler for the &quot;examplePath&quot; directive */
+const char *example_set_path(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    config.path = arg;
+    return NULL;
+}
+
+/* Handler for the &quot;exampleAction&quot; directive */
+/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
+/* and we store it in a bit-wise manner. */
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+{
+    if(!strcasecmp(arg1, &quot;file&quot;)) config.typeOfAction = 0x01;
+    else config.typeOfAction = 0x02;
     
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg2<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>deny</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x10</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>else</code> config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x20</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;The directive structure for our name tag:</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>const</code> command_rec        example_directives<code style='color:#806030; '>[</code><code style='color:#806030; '>]</code> <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>exampleEnabled</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_enabled<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> RSRC_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Enable or disable mod_example</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>examplePath</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_path<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> RSRC_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>The path to whatever</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>exampleAction</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_action<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> RSRC_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Special action value!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <code style='color:#806030; '>{</code> <code style='color:#007d45; '>NULL</code> <code style='color:#806030; '>}</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;Our module handler:</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_set_content_type<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/plain</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Enabled: </code><code style='color:#0f6900; '>%u</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>enabled<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Path: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>path<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>TypeOfAction: </code><code style='color:#0f6900; '>%x</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>.</code>typeOfAction<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;The hook registration function (also initializes the default config values):</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code> register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    config<code style='color:#806030; '>.</code>enabled <code style='color:#806030; '>=</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>;</code>
-    config<code style='color:#806030; '>.</code>path <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>/foo/bar</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-    config<code style='color:#806030; '>.</code>typeOfAction <code style='color:#806030; '>=</code> <code style='color:#c00000; '>3</code><code style='color:#806030; '>;</code>
-    ap_hook_handler<code style='color:#806030; '>(</code>example_handler<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> APR_HOOK_LAST<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;Our module name tag:</code>
-<code style='color:#c34e00; '>&#xa0;==============================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-module AP_MODULE_DECLARE_DATA   example_module <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    STANDARD20_MODULE_STUFF<code style='color:#806030; '>,</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    example_directives<code style='color:#806030; '>,</code> <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks      <code style='color:#c34e00; '>/* Our hook registering function */</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-</pre>
+    if(!strcasecmp(arg2, &quot;deny&quot;)) config.typeOfAction += 0x10;
+    else config.typeOfAction += 0x20;
+    return NULL;
+}
+
+/*
+ ==============================================================================
+ The directive structure for our name tag:
+ ==============================================================================
+ */
+static const command_rec        example_directives[] =
+{
+    AP_INIT_TAKE1(&quot;exampleEnabled&quot;, example_set_enabled, NULL, RSRC_CONF, &quot;Enable or disable mod_example&quot;),
+    AP_INIT_TAKE1(&quot;examplePath&quot;, example_set_path, NULL, RSRC_CONF, &quot;The path to whatever&quot;),
+    AP_INIT_TAKE2(&quot;exampleAction&quot;, example_set_action, NULL, RSRC_CONF, &quot;Special action value!&quot;),
+    { NULL }
+};
+/*
+ ==============================================================================
+ Our module handler:
+ ==============================================================================
+ */
+static int example_handler(request_rec *r)
+{
+    if(!r-&gt;handler || strcmp(r-&gt;handler, &quot;example-handler&quot;)) return(DECLINED);
+    ap_set_content_type(r, &quot;text/plain&quot;);
+    ap_rprintf(r, &quot;Enabled: %u\n&quot;, config.enabled);
+    ap_rprintf(r, &quot;Path: %s\n&quot;, config.path);
+    ap_rprintf(r, &quot;TypeOfAction: %x\n&quot;, config.typeOfAction);
+    return OK;
+}
+
+/*
+ ==============================================================================
+ The hook registration function (also initializes the default config values):
+ ==============================================================================
+ */
+static void register_hooks(apr_pool_t *pool) 
+{
+    config.enabled = 1;
+    config.path = &quot;/foo/bar&quot;;
+    config.typeOfAction = 3;
+    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
+}
+/*
+ ==============================================================================
+ Our module name tag:
+ ==============================================================================
+ */
+module AP_MODULE_DECLARE_DATA   example_module =
+{
+    STANDARD20_MODULE_STUFF,
+    NULL,               /* Per-directory configuration handler */
+    NULL,               /* Merge handler for per-directory configurations */
+    NULL,               /* Per-server configuration handler */
+    NULL,               /* Merge handler for per-server configurations */
+    example_directives, /* Any directives we may have for httpd */
+    register_hooks      /* Our hook registering function */
+};
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-</p>
 <p>
 In our httpd.conf file, we can now change the hard-coded configuration by 
 adding a few lines:
-<example><pre>
+</p>
+<highlight language="config">
 ExampleEnabled On
 ExamplePath "/usr/bin/foo"
 ExampleAction file allow
-</pre></example>
+</highlight>
+<p>
 And thus we apply the configuration, visit <code>/example</code> on our 
 web site, and we see the configuration has adapted to what we wrote in our 
 configuration file.
@@ -1041,7 +1084,8 @@ In Apache HTTP Server 2.4, different URLs, virtual hosts, directories etc can ha
 different meanings to the user of the server, and thus different contexts 
 within which modules must operate. For example, let's assume you have this 
 configuration set up for mod_rewrite:
-<example><pre>
+</p>
+<highlight language="config">
 &lt;Directory &quot;/var/www&quot;&gt;
     RewriteCond %{HTTP_HOST} ^example.com$
     RewriteRule (.*) http://www.example.com/$1
@@ -1049,13 +1093,15 @@ configuration set up for mod_rewrite:
 &lt;Directory &quot;/var/www/sub&quot;&gt;
     RewriteRule ^foobar$ index.php?foobar=true
 &lt;/Directory&gt;
-</pre></example>
+</highlight>
+<p>
 In this example, you will have set up two different contexts for 
-mod_rewrite:
+mod_rewrite:</p>
 <ol>
 <li>Inside <code>/var/www</code>, all requests for <code>http://example.com</code> must go to <code>http://www.example.com</code></li>
 <li>Inside <code>/var/www/sub</code>, all requests for <code>foobar</code> must go to <code>index.php?foobar=true</code></li>
 </ol>
+<p>
 If mod_rewrite (or the entire server for that matter) wasn't context aware, then 
 these rewrite rules would just apply to every and any request made, 
 regardless of where and how they were made, but since the module can pull 
@@ -1066,15 +1112,15 @@ the server takes care of this.</p>
 <p>
 So how does a module get the specific configuration for the server, 
 directory or location in question? It does so by making one simple call:
-
+</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
+<highlight language="c">
+example_config *config = (example_config*) <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga1093a5908a384eacc929b028c79f2a02">ap_get_module_config</a>(r-&gt;per_dir_config, &amp;example_module);
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-example_config *config = (example_config*) <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga1093a5908a384eacc929b028c79f2a02">ap_get_module_config</a>(<code style='color:#008833'>r-&gt;per_dir_config</code>, &amp;example_module);
-</pre>
+<p>
 That's it! Of course, a whole lot goes on behind the scenes, which we will 
 discuss in this chapter, starting with how the server came to know what our 
 configuration looks like, and how it came to be set up as it is in the 
@@ -1087,61 +1133,54 @@ specific context.
 our previous context structure. We will set a <code>context</code> 
 variable that we can use to track which context configuration is being 
 used by the server in various places:
-
-
+</p>
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>typedef</code> <code style='color:#400000; font-weight:bold; '>struct</code> <code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>char</code>        context<code style='color:#806030; '>[</code><code style='color:#c00000; '>256</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>char</code>        path<code style='color:#806030; '>[</code><code style='color:#c00000; '>256</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         typeOfAction<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>         enabled<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code> example_config<code style='color:#806030; '>;</code>
-</pre>
+<highlight language="c">
+typedef struct {
+    char        context[256];
+    char        path[256];
+    int         typeOfAction;
+    int         enabled;
+} example_config;
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-</p>
-
-<p>Our handler for requests will also be modified, yet still very simple:
+<p>Our handler for requests will also be modified, yet still very simple:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    example_config<code style='color:#806030; '> *</code>config <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config<code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> ap_get_module_config<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>per_dir_config</code><code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>example_module<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_set_content_type<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/plain</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Enabled: </code><code style='color:#0f6900; '>%u</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Path: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>TypeOfAction: </code><code style='color:#0f6900; '>%x</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>Context: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>context</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+static int example_handler(request_rec *r)
+{
+    if(!r->handler || strcmp(r->handler, "example-handler")) return(DECLINED);
+    example_config *config = (example_config*) ap_get_module_config(r->per_dir_config, &amp;example_module);
+    ap_set_content_type(r, "text/plain");
+    ap_rprintf("Enabled: %u\n", config->enabled);
+    ap_rprintf("Path: %s\n", config->path);
+    ap_rprintf("TypeOfAction: %x\n", config->typeOfAction);
+    ap_rprintf("Context: %s\n", config->context);
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-
-</p>
-
 </section>
 
 <section id="context_which"><title>Choosing a context</title>
 <p>
 Before we can start making our module context aware, we must first define, 
 which contexts we will accept. As we saw in the previous chapter, defining 
-a directive required five elements be set:
+a directive required five elements be set:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#2e8800; '><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a></code>(&quot;exampleEnabled&quot;, example_set_enabled, <code style='color:#7f0055; font-weight:bold; '>NULL</code>, RSRC_CONF, &quot;Enable or disable mod_example&quot;),
-</pre>
+<highlight language="c">
+AP_INIT_TAKE1("exampleEnabled", example_set_enabled, NULL, RSRC_CONF, "Enable or disable mod_example"),
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-The <code>RSRC_CONF</code> definition told the server that we would only allow 
+<p>The <code>RSRC_CONF</code> definition told the server that we would only allow 
 this directive in a global server context, but since we are now trying out 
 a context aware version of our module, we should set this to something 
 more lenient, namely the value <code>ACCESS_CONF</code>, which lets us use 
@@ -1155,63 +1194,60 @@ help you create them. To do so, we must first start off by changing our
 <em>name tag</em> to let the server know, that it should assist us in creating 
 and managing our configurations. Since we have chosen the per-directory 
 (or per-location) context for our module configurations, we'll add a 
-per-directory creator and merger function reference in our tag:
+per-directory creator and merger function reference in our tag:</p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-module AP_MODULE_DECLARE_DATA   example_module <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    STANDARD20_MODULE_STUFF<code style='color:#806030; '>,</code>
-    create_dir_conf<code style='color:#806030; '>,</code> <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    merge_dir_conf<code style='color:#806030; '>,</code>  <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>            <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    directives<code style='color:#806030; '>,</code>      <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks   <code style='color:#c34e00; '>/* Our hook registering function */</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-</pre>
+<highlight language="c">
+module AP_MODULE_DECLARE_DATA   example_module =
+{
+    STANDARD20_MODULE_STUFF,
+    create_dir_conf, /* Per-directory configuration handler */
+    merge_dir_conf,  /* Merge handler for per-directory configurations */
+    NULL,            /* Per-server configuration handler */
+    NULL,            /* Merge handler for per-server configurations */
+    directives,      /* Any directives we may have for httpd */
+    register_hooks   /* Our hook registering function */
+};
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-</p>
-
-
 
 </section>
 
-<section id="context_which"><title>Creating new context configurations</title>
+<section id="context_new"><title>Creating new context configurations</title>
 <p>
 Now that we have told the server to help us create and manage configurations, 
 our first step is to make a function for creating new, blank 
 configurations. We do so by creating the function we just referenced in 
-our name tag as the Per-directory configuration handler:
+our name tag as the Per-directory configuration handler:</p>
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>void</code><code style='color:#806030; '>*</code> example_create_dir_conf<code style='color:#806030; '>(</code>apr_pool_t<code style='color:#806030; '>*</code> pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>char</code><code style='color:#806030; '>*</code> context<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-    context <code style='color:#806030; '>=</code> context <code style='color:#806030; '>?</code> context <code style='color:#806030; '>:</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>(undefined context)</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-    example_config<code style='color:#806030; '> *</code>cfg <code style='color:#806030; '>=</code> apr_pcalloc<code style='color:#806030; '>(</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>sizeof</code><code style='color:#806030; '>(</code>example_config<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>cfg<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        <code style='color:#c34e00; '>/* Set some default values */</code>
-        <code style='color:#800040; '>strcpy</code><code style='color:#806030; '>(</code>cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>context</code><code style='color:#806030; '>,</code> x<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-        cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-        cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code> <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>/foo/bar</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-        cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x11</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> cfg<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+void* example_create_dir_conf(apr_pool_t* pool, char* context) {
+    context = context ? context : "(undefined context)";
+    example_config *cfg = apr_pcalloc(pool, sizeof(example_config));
+    if(cfg) {
+        /* Set some default values */
+        strcpy(cfg->context, x);
+        cfg->enabled = 0;
+        cfg->path = "/foo/bar";
+        cfg->typeOfAction = 0x11;
+    }
+    return cfg;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
-</p>
 </section>
 
-<section id="context_which"><title>Merging configurations</title>
+<section id="context_merge"><title>Merging configurations</title>
 <p>
 Our next step in creating a context aware configuration is merging 
 configurations. This part of the process particularly apply to scenarios 
 where you have a parent configuration and a child, such as the following: 
-<example><pre>
+</p>
+<highlight language="config">
 &lt;Directory &quot;/var/www&quot;&gt;
     ExampleEnable On
     ExamplePath /foo/bar
@@ -1220,12 +1256,14 @@ where you have a parent configuration and a child, such as the following:
 &lt;Directory &quot;/var/www/subdir&quot;&gt;
     ExampleAction file deny
 &lt;/Directory&gt;
-</pre></example>
+</highlight>
+<p>
 In this example, it is natural to assume that the directory <code>
 /var/www/subdir</code> should inherit the value set for the <code>/var/www
 </code> directory, as we did not specify a <code>ExampleEnable</code> nor 
 an <code>ExamplePath</code> for this directory. The server does not presume to 
 know if this is true, but cleverly does the following:
+</p>
 <ol>
 <li>Creates a new configuration for <code>/var/www</code></li>
 <li>Sets the configuration values according to the directives given for <code>/var/www</code></li>
@@ -1233,36 +1271,39 @@ know if this is true, but cleverly does the following:
 <li>Sets the configuration values according to the directives given for <code>/var/www/subdir</code></li>
 <li><strong>Proposes a merge</strong> of the two configurations into a new configuration for <code>/var/www/subdir</code></li>
 </ol>
+<p>
 This proposal is handled by the <code>merge_dir_conf</code> function we 
 referenced in our name tag. The purpose of this function is to assess the 
-two configurations and decide how they are to be merged:
+two configurations and decide how they are to be merged:</p>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>void</code><code style='color:#806030; '>*</code> merge_dir_conf<code style='color:#806030; '>(</code>apr_pool_t<code style='color:#806030; '>*</code> pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code><code style='color:#806030; '>*</code> BASE<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code><code style='color:#806030; '>*</code> ADD<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-    example_config<code style='color:#806030; '>*</code> base <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> BASE <code style='color:#806030; '>;</code>
-    example_config<code style='color:#806030; '>*</code> add <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> ADD <code style='color:#806030; '>;</code>
-    example_config<code style='color:#806030; '>*</code> conf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> create_dir_conf<code style='color:#806030; '>(</code>pool<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Merged configuration</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+void* merge_dir_conf(apr_pool_t* pool, void* BASE, void* ADD) {
+    example_config* base = (example_config *) BASE ; /* This is what was set in the parent context */
+    example_config* add = (example_config *) ADD ;   /* This is what is set in the new context */
+    example_config* conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
     
-    conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code> <code style='color:#806030; '>)</code> <code style='color:#806030; '>?</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>:</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>;</code>
-    conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>?</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>:</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code><code style='color:#806030; '>;</code>
-    <code style='color:#800040; '>strcpy</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>,</code> <code style='color:#800040; '>strlen</code><code style='color:#806030; '>(</code>add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>?</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code> <code style='color:#806030; '>:</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+    /* Merge configurations */
+    conf->enabled = ( add->enabled == 0 ) ? base->enabled : add->enabled ;
+    conf->typeOfAction = add->typeOfAction ? add->typeOfAction : base->typeOfAction;
+    strcpy(conf->path, strlen(add->path) ? add->path : base->path);
     
-    <code style='color:#400000; font-weight:bold; '>return</code> conf <code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+    return conf ;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
-</p>
+
 </section>
 
-<section id="context_which"><title>Trying out our new context aware configurations</title>
+<section id="context_example"><title>Trying out our new context aware configurations</title>
 <p>
 Now, let's try putting it all together to create a new module that is 
 context aware. First off, we'll create a configuration that lets us test 
 how the module works:
-<example><pre>
+</p>
+<highlight language="config">
 &lt;Location &quot;/a&quot;&gt;
     SetHandler example-handler
     ExampleEnabled on
@@ -1280,239 +1321,240 @@ how the module works:
     ExamplePath &quot;/foo/bar/baz&quot;
     ExampleEnabled on
 &lt;/Location&gt;
-</pre></example>
+</highlight>
+<p>
 Then we'll assemble our module code. Note, that since we are now using our 
 name tag as reference when fetching configurations in our handler, I have 
 added some prototypes to keep the compiler happy:
 </p>
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#c34e00; '>/*$6</code>
-<code style='color:#c34e00; '>&#xa0;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
-<code style='color:#c34e00; '>&#xa0;* mod_example_config.c</code>
-<code style='color:#c34e00; '>&#xa0;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-
-
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>&lt;</code><code style='color:#40015a; '>stdio.h</code><code style='color:#800000; '>></code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>apr_hash.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>ap_config.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>ap_provider.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>httpd.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_core.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_config.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_log.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_protocol.h</code><code style='color:#800000; '>"</code>
-<code style='color:#004a43; '>#</code><code style='color:#004a43; '>include </code><code style='color:#800000; '>"</code><code style='color:#40015a; '>http_request.h</code><code style='color:#800000; '>"</code>
-
-<code style='color:#c34e00; '>/*$1</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Configuration structure</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-
-<code style='color:#400000; font-weight:bold; '>typedef</code> <code style='color:#400000; font-weight:bold; '>struct</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>char</code>    context<code style='color:#806030; '>[</code><code style='color:#c00000; '>256</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>char</code>    path<code style='color:#806030; '>[</code><code style='color:#c00000; '>256</code><code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>     typeOfAction<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>     enabled<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code> example_config<code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/*$1</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Prototypes</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code>    example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code>    <code style='color:#806030; '>*</code>example_set_enabled<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code>    <code style='color:#806030; '>*</code>example_set_path<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code>    <code style='color:#806030; '>*</code>example_set_action<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg1<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg2<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>void</code>          <code style='color:#806030; '>*</code>create_dir_conf<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>context<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>void</code>          <code style='color:#806030; '>*</code>merge_dir_conf<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>BASE<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>ADD<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code>   register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/*$1</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Configuration directives</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>const</code> command_rec    directives<code style='color:#806030; '>[</code><code style='color:#806030; '>]</code> <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>exampleEnabled</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_enabled<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> ACCESS_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Enable or disable mod_example</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>examplePath</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_path<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> ACCESS_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>The path to whatever</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a><code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>exampleAction</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> example_set_action<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> ACCESS_CONF<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Special action value!</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>,</code>
-    <code style='color:#806030; '>{</code> <code style='color:#007d45; '>NULL</code> <code style='color:#806030; '>}</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/*$1</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Our name tag</code>
-<code style='color:#c34e00; '>&#xa0;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-
-module AP_MODULE_DECLARE_DATA    example_module <code style='color:#806030; '>=</code>
-<code style='color:#806030; '>{</code>
-    STANDARD20_MODULE_STUFF<code style='color:#806030; '>,</code>
-    create_dir_conf<code style='color:#806030; '>,</code>    <code style='color:#c34e00; '>/* Per-directory configuration handler */</code>
-    merge_dir_conf<code style='color:#806030; '>,</code>     <code style='color:#c34e00; '>/* Merge handler for per-directory configurations */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Per-server configuration handler */</code>
-    <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code>               <code style='color:#c34e00; '>/* Merge handler for per-server configurations */</code>
-    directives<code style='color:#806030; '>,</code>         <code style='color:#c34e00; '>/* Any directives we may have for httpd */</code>
-    register_hooks      <code style='color:#c34e00; '>/* Our hook registering function */</code>
-<code style='color:#806030; '>}</code><code style='color:#806030; '>;</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Hook registration function</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>void</code> register_hooks<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    ap_hook_handler<code style='color:#806030; '>(</code>example_handler<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> APR_HOOK_LAST<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Our example web service handler</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code> <code style='color:#806030; '>|</code><code style='color:#806030; '>|</code> <code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>handler</code><code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>example-handler</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>DECLINED<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>config <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> ap_get_module_config<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>per_dir_config</code><code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>example_module<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    ap_set_content_type<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>text/plain</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Enabled: </code><code style='color:#0f6900; '>%u</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Path: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>TypeOfAction: </code><code style='color:#0f6900; '>%x</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Context: </code><code style='color:#0f6900; '>%s</code><code style='color:#0f6900; '>\n</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> config<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>context</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Handler for the "exambleEnabled" directive</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>example_set_enabled<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>conf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> cfg<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>)</code>
-    <code style='color:#806030; '>{</code>
-        <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>on</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code>
-            conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>;</code>
-        <code style='color:#400000; font-weight:bold; '>else</code>
-            conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Handler for the "examplePath" directive</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>example_set_path<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>conf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> cfg<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>)</code>
-    <code style='color:#806030; '>{</code>
-        <code style='color:#800040; '>strcpy</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>,</code> arg<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Handler for the "exampleAction" directive ;</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Let's pretend this one takes one argument (file or db), and a second (deny or allow), ;</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;and we store it in a bit-wise manner.</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>example_set_action<code style='color:#806030; '>(</code>cmd_parms <code style='color:#806030; '>*</code>cmd<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>cfg<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg1<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>arg2<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>conf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> cfg<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>)</code>
-    <code style='color:#806030; '>{</code>
-        <code style='color:#806030; '>{</code>
-            <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg1<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>file</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code>
-                conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x01</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>else</code>
-                conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x02</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>strcasecmp<code style='color:#806030; '>(</code>arg2<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>deny</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code>
-                conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x10</code><code style='color:#806030; '>;</code>
-            <code style='color:#400000; font-weight:bold; '>else</code>
-                conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x20</code><code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>}</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Function for creating new configurations for per-directory contexts</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>create_dir_conf<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>context<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    context <code style='color:#806030; '>=</code> context <code style='color:#806030; '>?</code> context <code style='color:#806030; '>:</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Newly created configuration</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>cfg <code style='color:#806030; '>=</code> apr_pcalloc<code style='color:#806030; '>(</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>sizeof</code><code style='color:#806030; '>(</code>example_config<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>cfg<code style='color:#806030; '>)</code>
-    <code style='color:#806030; '>{</code>
-        <code style='color:#806030; '>{</code>
-            <code style='color:#c34e00; '>/* Set some default values */</code>
-            <code style='color:#800040; '>strcpy</code><code style='color:#806030; '>(</code>cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>context</code><code style='color:#806030; '>,</code> context<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-            <code style='color:#800040; '>memset</code><code style='color:#806030; '>(</code>cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>,</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>,</code> <code style='color:#c00000; '>256</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            cfg<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0x00</code><code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>}</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#400000; font-weight:bold; '>return</code> cfg<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#c34e00; '>/*</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;&#xa0;&#xa0;&#xa0;Merging function for configurations</code>
-<code style='color:#c34e00; '>&#xa0;=======================================================================================================================</code>
-<code style='color:#c34e00; '>&#xa0;*/</code>
-<code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>merge_dir_conf<code style='color:#806030; '>(</code>apr_pool_t <code style='color:#806030; '>*</code>pool<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>BASE<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>void</code> <code style='color:#806030; '>*</code>ADD<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    example_config    <code style='color:#806030; '>*</code>base <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> BASE<code style='color:#806030; '>;</code>
-    example_config    <code style='color:#806030; '>*</code>add <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> ADD<code style='color:#806030; '>;</code>
-    example_config    <code style='color:#806030; '>*</code>conf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>example_config <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> create_dir_conf<code style='color:#806030; '>(</code>pool<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>Merged configuration</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>?</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code> <code style='color:#806030; '>:</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>enabled</code><code style='color:#806030; '>;</code>
-    conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>=</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>?</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code> <code style='color:#806030; '>:</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>typeOfAction</code><code style='color:#806030; '>;</code>
-    <code style='color:#800040; '>strcpy</code><code style='color:#806030; '>(</code>conf<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>,</code> <code style='color:#800040; '>strlen</code><code style='color:#806030; '>(</code>add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>?</code> add<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code> <code style='color:#806030; '>:</code> base<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>path</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> conf<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-</pre>
+<highlight language="c">
+/*$6
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * mod_example_config.c
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ */
+
+
+#include &lt;stdio.h&gt;
+#include "apr_hash.h"
+#include "ap_config.h"
+#include "ap_provider.h"
+#include "httpd.h"
+#include "http_core.h"
+#include "http_config.h"
+#include "http_log.h"
+#include "http_protocol.h"
+#include "http_request.h"
+
+/*$1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    Configuration structure
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+typedef struct
+{
+    char    context[256];
+    char    path[256];
+    int     typeOfAction;
+    int     enabled;
+} example_config;
+
+/*$1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    Prototypes
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+static int    example_handler(request_rec *r);
+const char    *example_set_enabled(cmd_parms *cmd, void *cfg, const char *arg);
+const char    *example_set_path(cmd_parms *cmd, void *cfg, const char *arg);
+const char    *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2);
+void          *create_dir_conf(apr_pool_t *pool, char *context);
+void          *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD);
+static void   register_hooks(apr_pool_t *pool);
+
+/*$1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    Configuration directives
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+static const command_rec    directives[] =
+{
+    AP_INIT_TAKE1(&quot;exampleEnabled&quot;, example_set_enabled, NULL, ACCESS_CONF, &quot;Enable or disable mod_example&quot;),
+    AP_INIT_TAKE1(&quot;examplePath&quot;, example_set_path, NULL, ACCESS_CONF, &quot;The path to whatever&quot;),
+    AP_INIT_TAKE2(&quot;exampleAction&quot;, example_set_action, NULL, ACCESS_CONF, &quot;Special action value!&quot;),
+    { NULL }
+};
+
+/*$1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    Our name tag
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+module AP_MODULE_DECLARE_DATA    example_module =
+{
+    STANDARD20_MODULE_STUFF,
+    create_dir_conf,    /* Per-directory configuration handler */
+    merge_dir_conf,     /* Merge handler for per-directory configurations */
+    NULL,               /* Per-server configuration handler */
+    NULL,               /* Merge handler for per-server configurations */
+    directives,         /* Any directives we may have for httpd */
+    register_hooks      /* Our hook registering function */
+};
+
+/*
+ =======================================================================================================================
+    Hook registration function
+ =======================================================================================================================
+ */
+static void register_hooks(apr_pool_t *pool)
+{
+    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
+}
+
+/*
+ =======================================================================================================================
+    Our example web service handler
+ =======================================================================================================================
+ */
+static int example_handler(request_rec *r)
+{
+    if(!r-&gt;handler || strcmp(r-&gt;handler, &quot;example-handler&quot;)) return(DECLINED);
+
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *config = (example_config *) ap_get_module_config(r-&gt;per_dir_config, &amp;example_module);
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    ap_set_content_type(r, &quot;text/plain&quot;);
+    ap_rprintf(r, &quot;Enabled: %u\n&quot;, config-&gt;enabled);
+    ap_rprintf(r, &quot;Path: %s\n&quot;, config-&gt;path);
+    ap_rprintf(r, &quot;TypeOfAction: %x\n&quot;, config-&gt;typeOfAction);
+    ap_rprintf(r, &quot;Context: %s\n&quot;, config-&gt;context);
+    return OK;
+}
+
+/*
+ =======================================================================================================================
+    Handler for the &quot;exambleEnabled&quot; directive
+ =======================================================================================================================
+ */
+const char *example_set_enabled(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *conf = (example_config *) cfg;
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    if(conf)
+    {
+        if(!strcasecmp(arg, &quot;on&quot;))
+            conf-&gt;enabled = 1;
+        else
+            conf-&gt;enabled = 0;
+    }
+
+    return NULL;
+}
+
+/*
+ =======================================================================================================================
+    Handler for the &quot;examplePath&quot; directive
+ =======================================================================================================================
+ */
+const char *example_set_path(cmd_parms *cmd, void *cfg, const char *arg)
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *conf = (example_config *) cfg;
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    if(conf)
+    {
+        strcpy(conf-&gt;path, arg);
+    }
+
+    return NULL;
+}
+
+/*
+ =======================================================================================================================
+    Handler for the &quot;exampleAction&quot; directive ;
+    Let's pretend this one takes one argument (file or db), and a second (deny or allow), ;
+    and we store it in a bit-wise manner.
+ =======================================================================================================================
+ */
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2)
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *conf = (example_config *) cfg;
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    if(conf)
+    {
+        {
+            if(!strcasecmp(arg1, &quot;file&quot;))
+                conf-&gt;typeOfAction = 0x01;
+            else
+                conf-&gt;typeOfAction = 0x02;
+            if(!strcasecmp(arg2, &quot;deny&quot;))
+                conf-&gt;typeOfAction += 0x10;
+            else
+                conf-&gt;typeOfAction += 0x20;
+        }
+    }
+
+    return NULL;
+}
+
+/*
+ =======================================================================================================================
+    Function for creating new configurations for per-directory contexts
+ =======================================================================================================================
+ */
+void *create_dir_conf(apr_pool_t *pool, char *context)
+{
+    context = context ? context : &quot;Newly created configuration&quot;;
+
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *cfg = apr_pcalloc(pool, sizeof(example_config));
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    if(cfg)
+    {
+        {
+            /* Set some default values */
+            strcpy(cfg-&gt;context, context);
+            cfg-&gt;enabled = 0;
+            memset(cfg-&gt;path, 0, 256);
+            cfg-&gt;typeOfAction = 0x00;
+        }
+    }
+
+    return cfg;
+}
+
+/*
+ =======================================================================================================================
+    Merging function for configurations
+ =======================================================================================================================
+ */
+void *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD)
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    example_config    *base = (example_config *) BASE;
+    example_config    *add = (example_config *) ADD;
+    example_config    *conf = (example_config *) create_dir_conf(pool, &quot;Merged configuration&quot;);
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    conf-&gt;enabled = (add-&gt;enabled == 0) ? base-&gt;enabled : add-&gt;enabled;
+    conf-&gt;typeOfAction = add-&gt;typeOfAction ? add-&gt;typeOfAction : base-&gt;typeOfAction;
+    strcpy(conf-&gt;path, strlen(add-&gt;path) ? add-&gt;path : base-&gt;path);
+    return conf;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
@@ -1534,37 +1576,59 @@ or check out the rest of our documentation for further tips.
 
 <section id="snippets"><title>Some useful snippets of code</title>
 
-<section id="get_post"><title>Retrieve a variable from POST form data</title>
+<section id="get_post"><title>Retrieve variables from POST form data</title>
 
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>read_post_value<code style='color:#806030; '>(</code><code style='color:#400000; font-weight:bold; '>const</code> apr_array_header_t <code style='color:#806030; '>*</code>fields<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code>key<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>                         i<code style='color:#806030; '>;</code>
-    apr_table_entry_t           <code style='color:#806030; '>*</code>e <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    e <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>apr_table_entry_t <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> fields<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>elts<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>for</code><code style='color:#806030; '>(</code>i <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code> i <code style='color:#806030; '>&lt;</code> fields<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>nelts<code style='color:#806030; '>;</code> i<code style='color:#806030; '>+</code><code style='color:#806030; '>+</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>!</code><code style='color:#800040; '>strcmp</code><code style='color:#806030; '>(</code>e<code style='color:#806030; '>[</code>i<code style='color:#806030; '>]</code><code style='color:#806030; '>.</code>key<code style='color:#806030; '>,</code> key<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#400000; font-weight:bold; '>return</code> e<code style='color:#806030; '>[</code>i<code style='color:#806030; '>]</code><code style='color:#806030; '>.</code>val<code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_req <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    apr_array_header_t <code style='color:#806030; '>*</code>POST<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code>         <code style='color:#806030; '>*</code>value<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    ap_parse_form_data<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#007d45; '>NULL</code><code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>POST<code style='color:#806030; '>,</code> <code style='color:#806030; '>-</code><code style='color:#c00000; '>1</code><code style='color:#806030; '>,</code> <code style='color:#c00000; '>8192</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
+<highlight language="c">
+typedef struct {
+    const char* key;
+    const char* value;
+} keyValuePair;
+
+keyValuePair* readPost(request_req* r) {
+    apr_array_header_t *pairs = NULL;
+    apr_off_t len;
+    apr_size_t size;
+    int res;
+    int i = 0;
+    char *buffer;
+    keyValuePair* kvp;
+
+    res = ap_parse_form_data(r, NULL, &amp;pairs, -1, HUGE_STRING_LEN);
+    if (res != OK || !pairs) return NULL; /* Return NULL if we failed or if there are is no POST data */
+    kvp = apr_pcalloc(r->pool, sizeof(keyValuePair) * (pairs->nelts + 1));
+    while (pairs &amp;&amp; !apr_is_empty_array(pairs)) {
+        i++;
+        ap_form_pair_t *pair = (ap_form_pair_t *) apr_array_pop(pairs);
+        apr_brigade_length(pair->value, 1, &amp;len);
+        size = (apr_size_t) len;
+        buffer = apr_palloc(r->pool, size + 1);
+        apr_brigade_flatten(pair->value, buffer, &amp;size);
+        buffer[len] = 0;
+        kvp[i]->key = apr_pstrdup(r->pool, pair->name);
+        kvp[i]->value = buffer;
+    }
+    return kvp;    
+}
+
+static int example_handler(request_req *r) 
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~*/
     
-    value <code style='color:#806030; '>=</code> read_post_value<code style='color:#806030; '>(</code>POST<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>valueA</code><code style='color:#800000; '>"</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>if</code> <code style='color:#806030; '>(</code><code style='color:#806030; '>!</code>value<code style='color:#806030; '>)</code> value <code style='color:#806030; '>=</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>(undefined)</code><code style='color:#800000; '>"</code><code style='color:#806030; '>;</code>
-    ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>The value of valueA is: </code><code style='color:#0f6900; '>%s</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> value<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-    </pre>
+    keyValuePair* formData;
+    /*~~~~~~~~~~~~~~~~~~~~~~*/
+
+    formData = readPost();
+    if (formData) {
+        int i;
+        for (i = 0; formData[i]; i++) {
+            ap_rprintf(r, &quot;%s = %s\n&quot;, formData[i]->key, formData[i]->value);
+        }
+    }
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
@@ -1574,23 +1638,23 @@ or check out the rest of our documentation for further tips.
     
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_req <code style='color:#806030; '>*</code>r<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> apr_array_header_t    <code style='color:#806030; '>*</code>fields<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>int</code>                         i<code style='color:#806030; '>;</code>
-    apr_table_entry_t           <code style='color:#806030; '>*</code>e <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-    fields <code style='color:#806030; '>=</code> <a href="http://apr.apache.org/docs/apr/1.4/group__apr__tables.html#gaea3005541cce67481f48ab201b5c0cf3">apr_table_elts</a><code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>headers_in<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    e <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code>apr_table_entry_t <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> fields<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>elts<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>for</code><code style='color:#806030; '>(</code>i <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code> i <code style='color:#806030; '>&lt;</code> fields<code style='color:#806030; '>-</code><code style='color:#806030; '>></code>nelts<code style='color:#806030; '>;</code> i<code style='color:#806030; '>+</code><code style='color:#806030; '>+</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        ap_rprintf<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#800000; '>"</code><code style='color:#e60000; '>&lt;b></code><code style='color:#0f6900; '>%s</code><code style='color:#e60000; '>&lt;/b>: </code><code style='color:#0f6900; '>%s</code><code style='color:#e60000; '>&lt;br/></code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> e<code style='color:#806030; '>[</code>i<code style='color:#806030; '>]</code><code style='color:#806030; '>.</code>key<code style='color:#806030; '>,</code> e<code style='color:#806030; '>[</code>i<code style='color:#806030; '>]</code><code style='color:#806030; '>.</code>val<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-    </pre>
+<highlight language="c">
+static int example_handler(request_req *r) 
+{
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+    const apr_array_header_t    *fields;
+    int                         i;
+    apr_table_entry_t           *e = 0;
+    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+    fields = apr_table_elts(r-&gt;headers_in);
+    e = (apr_table_entry_t *) fields-&gt;elts;
+    for(i = 0; i &lt; fields-&gt;nelts; i++) {
+        ap_rprintf(r, &quot;&lt;b&gt;%s&lt;/b&gt;: %s&lt;br/&gt;&quot;, e[i].key, e[i].val);
+    }
+    return OK;
+}
+</highlight>
 <!-- END EXAMPLE CODE -->
 
 
@@ -1600,55 +1664,56 @@ or check out the rest of our documentation for further tips.
     
 
 <!-- BEGIN EXAMPLE CODE -->
-<pre style='color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;'>
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> util_read<code style='color:#806030; '>(</code>request_rec <code style='color:#806030; '>*</code>r<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code><code style='color:#806030; '>*</code>rbuf<code style='color:#806030; '>,</code> apr_off_t <code style='color:#806030; '>*</code>size<code style='color:#806030; '>)</code>
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~*/</code>
-    <code style='color:#400000; font-weight:bold; '>int</code> rc <code style='color:#806030; '>=</code> OK<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>(</code>rc <code style='color:#806030; '>=</code> ap_setup_client_block<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> REQUEST_CHUNKED_ERROR<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>rc<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>ap_should_client_block<code style='color:#806030; '>(</code>r<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-
-        <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-        <code style='color:#400000; font-weight:bold; '>char</code>         argsbuffer<code style='color:#806030; '>[</code>HUGE_STRING_LEN<code style='color:#806030; '>]</code><code style='color:#806030; '>;</code>
-        apr_off_t    rsize<code style='color:#806030; '>,</code> len_read<code style='color:#806030; '>,</code> rpos <code style='color:#806030; '>=</code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>;</code>
-        apr_off_t length <code style='color:#806030; '>=</code> r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>remaining</code><code style='color:#806030; '>;</code>
-        <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
-
-        <code style='color:#806030; '>*</code>rbuf <code style='color:#806030; '>=</code> <code style='color:#806030; '>(</code><code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> apr_pcalloc<code style='color:#806030; '>(</code>r<code style='color:#806030; '>-</code><code style='color:#806030; '>></code><code style='color:#008833'>pool</code><code style='color:#806030; '>,</code> <code style='color:#806030; '>(</code>apr_size_t<code style='color:#806030; '>)</code> <code style='color:#806030; '>(</code>length <code style='color:#806030; '>+</code> <code style='color:#c00000; '>1</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>*</code>size <code style='color:#806030; '>=</code> length<code style='color:#806030; '>;</code>
-        <code style='color:#400000; font-weight:bold; '>while</code><code style='color:#806030; '>(</code><code style='color:#806030; '>(</code>len_read <code style='color:#806030; '>=</code> ap_get_client_block<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> argsbuffer<code style='color:#806030; '>,</code> <code style='color:#400000; font-weight:bold; '>sizeof</code><code style='color:#806030; '>(</code>argsbuffer<code style='color:#806030; '>)</code><code style='color:#806030; '>)</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>></code> <code style='color:#c00000; '>0</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-            <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code><code style='color:#806030; '>(</code>rpos <code style='color:#806030; '>+</code> len_read<code style='color:#806030; '>)</code> <code style='color:#806030; '>></code> length<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-                rsize <code style='color:#806030; '>=</code> length <code style='color:#806030; '>-</code> rpos<code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-            <code style='color:#400000; font-weight:bold; '>else</code> <code style='color:#806030; '>{</code>
-                rsize <code style='color:#806030; '>=</code> len_read<code style='color:#806030; '>;</code>
-            <code style='color:#806030; '>}</code>
-
-            <code style='color:#800040; '>memcpy</code><code style='color:#806030; '>(</code><code style='color:#806030; '>(</code><code style='color:#400000; font-weight:bold; '>char</code> <code style='color:#806030; '>*</code><code style='color:#806030; '>)</code> <code style='color:#806030; '>*</code>rbuf <code style='color:#806030; '>+</code> rpos<code style='color:#806030; '>,</code> argsbuffer<code style='color:#806030; '>,</code> <code style='color:#806030; '>(</code><code style='color:#800040; '>size_t</code><code style='color:#806030; '>)</code> rsize<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-            rpos <code style='color:#806030; '>+</code><code style='color:#806030; '>=</code> rsize<code style='color:#806030; '>;</code>
-        <code style='color:#806030; '>}</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code><code style='color:#806030; '>(</code>rc<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-
-<code style='color:#400000; font-weight:bold; '>static</code> <code style='color:#400000; font-weight:bold; '>int</code> example_handler<code style='color:#806030; '>(</code>request_req<code style='color:#806030; '>*</code> r<code style='color:#806030; '>)</code> 
-<code style='color:#806030; '>{</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~*/</code>
-    apr_off_t   size<code style='color:#806030; '>;</code>
-    <code style='color:#400000; font-weight:bold; '>const</code> <code style='color:#400000; font-weight:bold; '>char</code>  <code style='color:#806030; '>*</code>buffer<code style='color:#806030; '>;</code>
-    <code style='color:#c34e00; '>/*~~~~~~~~~~~~~~~~*/</code>
-
-    <code style='color:#400000; font-weight:bold; '>if</code><code style='color:#806030; '>(</code>util_read<code style='color:#806030; '>(</code>r<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>data<code style='color:#806030; '>,</code> <code style='color:#806030; '>&amp;</code>size<code style='color:#806030; '>)</code> <code style='color:#806030; '>=</code><code style='color:#806030; '>=</code> OK<code style='color:#806030; '>)</code> <code style='color:#806030; '>{</code>
-        ap_rprintf<code style='color:#806030; '>(</code><code style='color:#800000; '>"</code><code style='color:#e60000; '>We read a request body that was </code><code style='color:#0f6900; '>%u</code><code style='color:#e60000; '> bytes long</code><code style='color:#800000; '>"</code><code style='color:#806030; '>,</code> size<code style='color:#806030; '>)</code><code style='color:#806030; '>;</code>
-    <code style='color:#806030; '>}</code>
-    <code style='color:#400000; font-weight:bold; '>return</code> OK<code style='color:#806030; '>;</code>
-<code style='color:#806030; '>}</code>
-    </pre>
+<highlight language="c">
+static int util_read(request_rec *r, const char **rbuf, apr_off_t *size)
+{
+    /*~~~~~~~~*/
+    int rc = OK;
+    /*~~~~~~~~*/
+
+    if((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
+        return(rc);
+    }
+
+    if(ap_should_client_block(r)) {
+
+        /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+        char         argsbuffer[HUGE_STRING_LEN];
+        apr_off_t    rsize, len_read, rpos = 0;
+        apr_off_t length = r-&gt;remaining;
+        /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+        *rbuf = (const char *) apr_pcalloc(r-&gt;pool, (apr_size_t) (length + 1));
+        *size = length;
+        while((len_read = ap_get_client_block(r, argsbuffer, sizeof(argsbuffer))) &gt; 0) {
+            if((rpos + len_read) &gt; length) {
+                rsize = length - rpos;
+            }
+            else {
+                rsize = len_read;
+            }
+
+            memcpy((char *) *rbuf + rpos, argsbuffer, (size_t) rsize);
+            rpos += rsize;
+        }
+    }
+    return(rc);
+}
+
+static int example_handler(request_req* r) 
+{
+    /*~~~~~~~~~~~~~~~~*/
+    apr_off_t   size;
+    const char  *buffer;
+    /*~~~~~~~~~~~~~~~~*/
+
+    if(util_read(r, &amp;data, &amp;size) == OK) {
+        ap_rprintf(&quot;We read a request body that was %u bytes long&quot;, size);
+    }
+    return OK;
+}
+    </highlight>
+
 <!-- END EXAMPLE CODE -->
 
 
@@ -1656,4 +1721,4 @@ or check out the rest of our documentation for further tips.
 
 </section>
 
-</manualpage>
\ No newline at end of file
+</manualpage>