summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/manual/custom-error.html.tr.utf81
-rw-r--r--docs/manual/custom-error.xml.meta2
-rw-r--r--docs/manual/developer/modguide.html.en1799
-rw-r--r--docs/manual/handler.html.fr4
-rw-r--r--docs/manual/handler.xml.meta2
-rw-r--r--docs/manual/howto/auth.html.fr6
-rw-r--r--docs/manual/howto/auth.xml.meta2
-rw-r--r--docs/manual/howto/htaccess.html.fr16
-rw-r--r--docs/manual/howto/htaccess.xml.meta2
-rw-r--r--docs/manual/index.html.fr2
-rw-r--r--docs/manual/index.xml.da2
-rw-r--r--docs/manual/index.xml.de2
-rw-r--r--docs/manual/index.xml.es2
-rw-r--r--docs/manual/index.xml.fr2
-rw-r--r--docs/manual/index.xml.ja2
-rw-r--r--docs/manual/index.xml.ko2
-rw-r--r--docs/manual/index.xml.meta2
-rw-r--r--docs/manual/index.xml.pt-br2
-rw-r--r--docs/manual/index.xml.tr2
-rw-r--r--docs/manual/index.xml.zh-cn2
-rw-r--r--docs/manual/install.html.tr.utf81
-rw-r--r--docs/manual/install.xml.meta2
-rw-r--r--docs/manual/misc/perf-tuning.html.fr2
-rw-r--r--docs/manual/misc/perf-tuning.xml.meta2
-rw-r--r--docs/manual/mod/event.xml.fr2
-rw-r--r--docs/manual/mod/mod_alias.html.fr2
-rw-r--r--docs/manual/mod/mod_alias.xml.meta2
-rw-r--r--docs/manual/mod/mod_dir.html.fr2
-rw-r--r--docs/manual/mod/mod_dir.xml.meta2
-rw-r--r--docs/manual/mod/mod_remoteip.html.fr2
-rw-r--r--docs/manual/mod/mod_remoteip.xml.meta2
-rw-r--r--docs/manual/mod/mod_rewrite.html.fr15
-rw-r--r--docs/manual/mod/mod_rewrite.xml.meta2
-rw-r--r--docs/manual/platform/index.xml.ko2
-rw-r--r--docs/manual/platform/index.xml.zh-cn2
-rw-r--r--docs/manual/rewrite/index.html.fr2
-rw-r--r--docs/manual/rewrite/index.xml.meta2
-rw-r--r--docs/manual/rewrite/intro.html.fr22
-rw-r--r--docs/manual/rewrite/intro.xml.meta2
-rw-r--r--docs/manual/ssl/index.html.fr5
-rw-r--r--docs/manual/ssl/index.xml.meta2
-rw-r--r--docs/manual/ssl/ssl_faq.xml.meta2
-rw-r--r--docs/manual/ssl/ssl_howto.html.fr2
-rw-r--r--docs/manual/ssl/ssl_howto.xml.meta2
-rw-r--r--docs/manual/ssl/ssl_intro.html.fr38
-rw-r--r--docs/manual/ssl/ssl_intro.xml.meta2
-rw-r--r--docs/manual/suexec.html.tr.utf81
-rw-r--r--docs/manual/suexec.xml.meta2
48 files changed, 1012 insertions, 970 deletions
diff --git a/docs/manual/custom-error.html.tr.utf8 b/docs/manual/custom-error.html.tr.utf8
index 7de6fc529f..2b4fbeb630 100644
--- a/docs/manual/custom-error.html.tr.utf8
+++ b/docs/manual/custom-error.html.tr.utf8
@@ -25,6 +25,7 @@
<a href="./ko/custom-error.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="./tr/custom-error.html" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
+<div class="outofdate">Bu çeviri güncel olmayabilir. Son değişiklikler için İngilizce sürüm geçerlidir.</div>
<p>Apache HTTP Sunucusu 4xx veya 5xx HTTP durum kodları ile ilgili
diff --git a/docs/manual/custom-error.xml.meta b/docs/manual/custom-error.xml.meta
index 5900a59241..38c922cb47 100644
--- a/docs/manual/custom-error.xml.meta
+++ b/docs/manual/custom-error.xml.meta
@@ -9,7 +9,7 @@
<variants>
<variant>en</variant>
<variant outdated="yes">es</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/developer/modguide.html.en b/docs/manual/developer/modguide.html.en
index 520868311a..442e83f686 100644
--- a/docs/manual/developer/modguide.html.en
+++ b/docs/manual/developer/modguide.html.en
@@ -48,12 +48,14 @@ 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>
+
<h3><a name="prerequisites" id="prerequisites">Prerequisites</a></h3>
<p>
First and foremost, you are expected to have a basic knowledge of how the C
@@ -76,45 +78,51 @@ 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>
<div class="example"><pre>
apxs -i -a -c mod_example.c
</pre></div>
-</p>
+
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="basics" id="basics">Defining a module</a></h2>
-<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>:
-
-
-
-<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>
-
+<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>
+
+
+
+<p class="source">
+module AP_MODULE_DECLARE_DATA example_module <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ STANDARD20_MODULE_STUFF<code class="sh_misc">,</code>
+ create_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Per-directory configuration handler */</code>
+ merge_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ create_svr_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Per-server configuration handler */</code>
+ merge_svr_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ directives<code class="sh_misc">,</code> <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+</p>
+<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 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 />
+which comes into play when we need to load the module:
+</p>
<div class="example"><pre><a href="../mod/mod_so.html#LoadModule">LoadModule</a> example_module modules/mod_example.so</pre></div>
+<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>
@@ -145,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
@@ -155,9 +163,11 @@ an example using <code class="directive"><a href="../mod/mod_mime.html#addhandle
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:
+</p>
<div class="example"><pre>
AddHandler example-handler .sum
</pre></div>
+<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 "example-handler" </em>.
@@ -173,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>
-<pre style="color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;">
+<p class="source">
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>
+ <code class="sh_constant">NULL</code>,
+ <code class="sh_constant">NULL</code>,
+ <code class="sh_constant">NULL</code>,
+ <code class="sh_constant">NULL</code>,
+ <code class="sh_constant">NULL</code>,
+ <code class="sh_function">register_hooks</code> <code class="sh_comment"><code class="sh_comment">/* Our hook registering function */</code></code>
};
-</pre>
+</p>
-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>
-
-<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>
-
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/* Create a hook in the request handler, so we get called when a request arrives */</code>
+ <code class="sh_function">ap_hook_handler</code><code class="sh_misc">(</code>example_handler<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> APR_HOOK_LAST<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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>
@@ -221,13 +232,14 @@ 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>
</ul>
-</p>
+
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -240,103 +252,110 @@ 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>
<h3><a name="simple_handler" id="simple_handler">A simple "Hello, world!"
-handler</a></h3> Let's start off by making a very simple request handler
-that does the following: <br />
+handler</a></h3>
+<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 "example-handler"</li>
<li>Set the content type of our output to <code>text/html</code></li>
<li>Write "Hello, world!" 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>
-<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; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* If it is, we accept it and do our things, if not, we simply return DECLINED,</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* and the server will try somewhere else.</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</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; ">&gt;</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; ">&gt;</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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/* First off, we need to check if this is a call for the "example-handler" handler.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* If it is, we accept it and do our things, if not, we simply return DECLINED,</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* and the server will try somewhere else.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code> <code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* To do so, we must first set the appropriate content type, followed by our output.</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</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>
+ <code class="sh_comment">/* Now that we are handling this request, we'll write out "Hello, world!" to the client.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* To do so, we must first set the appropriate content type, followed by our output.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#gaa2f8412c400197338ec509f4a45e4579">ap_set_content_type</a><code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/html</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a><code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Hello, world!</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* We do so by simply returning the value OK to the server.</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</code>
- <code style="color:#400000; font-weight:bold; ">return</code> OK<code style="color:#806030; ">;</code>
-<code style="color:#806030; ">}</code>
-</pre>
-
+ <code class="sh_comment">/* Lastly, we must tell the server that we took care of this request and everything went fine.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* We do so by simply returning the value OK to the server.</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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">"Some useful functions you should know"</a>
-. <h3><a name="request_rec" id="request_rec">The request_rec structure
-</a></h3> <p>The most essential part of any request is the <em>request record
+<a href="#functions">"Some useful functions you should know"</a>.
+</p>
+
+<h3><a name="request_rec" id="request_rec">The request_rec structure</a></h3>
+<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 "
+<li><code><code class="sh_subobject">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 class="sh_subobject">r-&gt;method</code> (char*)</code>: Contains the HTTP method being used, f.x. GET or POST</li>
+<li><code><code class="sh_subobject">r-&gt;filename</code> (char*)</code>: Contains the translated filename the client is requesting</li>
+<li><code><code class="sh_subobject">r-&gt;args</code> (char*)</code>: Contains the query string of the request, if any</li>
+<li><code><code class="sh_subobject">r-&gt;headers_in</code> (apr_table_t*)</code>: Contains all the headers sent by the client</li>
+<li><code><code class="sh_subobject">r-&gt;connection</code> (conn_rec*)</code>: A record containing information about the current connection</li>
+<li><code><code class="sh_subobject">r-&gt;useragent_ip</code> (char*)</code>: The IP address of the client connecting to us</li>
+<li><code><code class="sh_subobject">r-&gt;pool</code> (apr_pool_t*)</code>: The memory pool of this request. We'll discuss this in the "
<a href="#memory">Memory management</a>" 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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/* 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 class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/html</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</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&gt;Hello, </code><code style="color:#0f6900; ">%s</code><code style="color:#e60000; ">!&lt;/h2&gt;</code><code style="color:#800000; ">"</code><code style="color:#806030; ">,</code> r<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">useragent_ip</code><code style="color:#806030; ">)</code><code style="color:#806030; ">;</code>
+ <code class="sh_comment">/* 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 class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">&lt;h2&gt;Hello, </code><code class="sh_reference">%s</code><code class="sh_value">!&lt;/h2&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">useragent_ip</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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; ">&gt;</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; ">&gt;</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&gt;</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&gt;</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; ">&gt;</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; ">&gt;</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>
-
+ <code class="sh_comment">/* If we were reached through a GET or a POST request, be happy, else sad. */</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code> <code class="sh_misc">!</code><code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">method</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">POST</code><code class="sh_character">"</code><code class="sh_misc">)</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_misc">!</code><code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">method</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">GET</code><code class="sh_character">"</code><code class="sh_misc">)</code> <code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">You used a GET or a POST method, that makes us happy!&lt;br&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">else</code> <code class="sh_misc">{</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">You did not use POST or GET, that makes us sad :(&lt;br&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_comment">/* Lastly, if there was a query string, let's print that too! */</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">args</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a><code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Your query string was: </code><code class="sh_reference">%s</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">args</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
-</p>
<h3><a name="return_value" id="return_value">Return values</a></h3>
@@ -347,19 +366,19 @@ 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>
-
-<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>
-
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/* Return 404: Not found */</code>
+ <code class="sh_declare">return</code> HTTP_NOT_FOUND<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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
@@ -370,12 +389,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>
@@ -384,7 +406,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>
<h3><a name="functions" id="functions">Some useful functions you should know</a></h3>
@@ -397,7 +418,7 @@ the next, without informing other handlers.
-<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>
+<p class="source">ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">Hello, world!</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code></p>
@@ -409,7 +430,7 @@ the next, without informing other handlers.
-<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; ">&gt;</code><code style="color:#008833">useragent_ip</code><code style="color:#806030; ">)</code><code style="color:#806030; ">;</code></pre>
+<p class="source"><code class="sh_declare"><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#ga5e91eb6ca777c9a427b2e82bf1eeb81d">ap_rprintf</a></code><code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Hello, </code><code class="sh_reference">%s</code><code class="sh_value">!</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">useragent_ip</code><code class="sh_misc">)</code><code class="sh_misc">;</code></p>
</li>
@@ -420,7 +441,7 @@ the next, without informing other handlers.
-<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>
+<p class="source"><code class="sh_declare"><a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__PROTO.html#gaa2f8412c400197338ec509f4a45e4579">ap_set_content_type</a></code><code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/plain</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code> <code class="sh_comment">/* force a raw text output */</code></p>
</li>
@@ -441,9 +462,10 @@ clean up after yourself - pretty neat, huh?
<p>
In our module, we will primarily be allocating memory for each request, so
-it's appropriate to use the <code style="color:#008833">r-&gt;pool</code>
+it's appropriate to use the <code class="sh_subobject">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>
@@ -453,52 +475,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>
-<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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc">*</code> original <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">You can't edit this!</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ <code class="sh_declare">char</code><code class="sh_misc">*</code> copy<code class="sh_misc">;</code>
+ <code class="sh_declare">int</code><code class="sh_misc">*</code> integers<code class="sh_misc">;</code>
- <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; ">&gt;</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>
+ <code class="sh_comment">/* Allocate space for 10 integer values and set them all to zero. */</code>
+ integers <code class="sh_misc">=</code> apr_pcalloc<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>pool<code class="sh_misc">,</code> <code class="sh_declare">sizeof</code><code class="sh_misc">(</code><code class="sh_declare">int</code><code class="sh_misc">)</code><code class="sh_misc">*</code><code class="sh_reference">10</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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; ">&gt;</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>
+ <code class="sh_comment">/* Create a copy of the 'original' variable that we can edit. */</code>
+ copy <code class="sh_misc">=</code> apr_pstrdup<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>pool<code class="sh_misc">,</code> original<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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>
-<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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/* Call a function that initializes some stuff */</code>
+ <code class="sh_function">example_init_function</code><code class="sh_misc">(</code>pool<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/* Create a hook in the request handler, so we get called when a request arrives */</code>
+ <code class="sh_function">ap_hook_handler</code><code class="sh_misc">(</code>example_handler<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> APR_HOOK_LAST<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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>
@@ -517,38 +541,39 @@ 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>
-<pre style="color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;">
+<p class="source">
<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>
-
+<a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__DAEMON.html#ga9d426b6382b49754d4f87c55f65af202">ap_parse_form_data</a>(r, <code class="sh_constant">NULL</code>, &amp;POST, -1, 8192);
+</p>
+<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>
-<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>
+<p class="source">
+<code class="sh_comment">/* Get the "digest" key from the query string, if any. */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>digestType <code class="sh_misc">=</code> <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__apr__tables.html#ga4db13e3915c6b9a3142b175d4c15d915">apr_table_get</a><code class="sh_misc">(</code>GET<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">digest</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
-</pre>
+<code class="sh_comment">/* If no key was returned, we will set a default value instead. */</code>
+<code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>digestType<code class="sh_misc">)</code> digestType <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">sha1</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+</p>
+<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">this example</a> in the last chapter of this document.
@@ -556,130 +581,133 @@ would have to resort to a few more lines, as outlined in <a href="#get_post">thi
<h3><a name="advanced_handler" id="advanced_handler">Making an advanced handler</a></h3>
+<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 />
-
-
-
-<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>
+out the MD5 or SHA1 digest of files:
+</p>
+
+
+
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">int</code> rc<code class="sh_misc">,</code> exists<code class="sh_misc">;</code>
+ apr_finfo_t finfo<code class="sh_misc">;</code>
+ apr_file_t<code class="sh_misc"> *</code>file<code class="sh_misc">;</code>
+ <code class="sh_declare">char</code> <code class="sh_misc">*</code>filename<code class="sh_misc">;</code>
+ <code class="sh_declare">char</code> buffer<code class="sh_misc">[</code><code class="sh_reference">256</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ apr_size_t readBytes<code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> n<code class="sh_misc">;</code>
+ apr_table_t<code class="sh_misc"> *</code>GET<code class="sh_misc">;</code>
+ apr_array_header_t<code class="sh_misc"> *</code>POST<code class="sh_misc">;</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>digestType<code class="sh_misc">;</code>
- <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; ">&gt;</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; ">&gt;</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 class="sh_comment">/* Check that the "example-handler" handler is being called. */</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code> <code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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; ">&gt;</code><code style="color:#008833">pool</code><code style="color:#806030; ">,</code> r<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</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>
+ <code class="sh_comment">/* Figure out which file is being requested by removing the .sum from it */</code>
+ filename <code class="sh_misc">=</code> apr_pstrdup<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">pool</code><code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">filename</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ filename<code class="sh_misc">[</code><code class="sh_function">strlen</code><code class="sh_misc">(</code>filename<code class="sh_misc">)</code><code class="sh_misc">-</code><code class="sh_reference">4</code><code class="sh_misc">]</code> <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code> <code class="sh_comment">/* Cut off the last 4 characters. */</code>
- <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; ">&gt;</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>
+ <code class="sh_comment">/* Figure out if the file we request a sum on exists and isn't a directory */</code>
+ rc <code class="sh_misc">=</code> apr_stat<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>finfo<code class="sh_misc">,</code> filename<code class="sh_misc">,</code> APR_FINFO_MIN<code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">pool</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code>rc <code class="sh_misc">=</code><code class="sh_misc">=</code> APR_SUCCESS<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ exists <code class="sh_misc">=</code>
+ <code class="sh_misc">(</code>
+ <code class="sh_misc">(</code>finfo<code class="sh_misc">.</code>filetype <code class="sh_misc">!</code><code class="sh_misc">=</code> APR_NOFILE<code class="sh_misc">)</code>
+ <code class="sh_misc">&amp;</code><code class="sh_misc">&amp;</code> <code class="sh_misc">!</code><code class="sh_misc">(</code>finfo<code class="sh_misc">.</code>filetype <code class="sh_misc">&amp;</code> APR_DIR<code class="sh_misc">)</code>
+ <code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>exists<code class="sh_misc">)</code> <code class="sh_declare">return</code> HTTP_NOT_FOUND<code class="sh_misc">;</code> <code class="sh_comment">/* Return a 404 if not found. */</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_comment">/* If apr_stat failed, we're probably not allowed to check this file. */</code>
+ <code class="sh_declare">else</code> <code class="sh_declare">return</code> HTTP_FORBIDDEN<code class="sh_misc">;</code>
- <code style="color:#c34e00; ">/* Parse the GET and, optionally, the POST data sent to us */</code>
+ <code class="sh_comment">/* Parse the GET and, optionally, the POST data sent to us */</code>
- 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<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>GET<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_parse_form_data<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>POST<code class="sh_misc">,</code> <code class="sh_misc">-</code><code class="sh_reference">1</code><code class="sh_misc">,</code> <code class="sh_reference">8192</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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>
+ <code class="sh_comment">/* Set the appropriate content type */</code>
+ ap_set_content_type<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/html</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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&gt;Information on </code><code style="color:#0f6900; ">%s</code><code style="color:#e60000; ">:&lt;/h2&gt;</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&gt;Size:&lt;/b&gt; </code><code style="color:#0f6900; ">%u</code><code style="color:#e60000; "> bytes&lt;br/&gt;</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>
+ <code class="sh_comment">/* Print a title and some general information */</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">&lt;h2&gt;Information on </code><code class="sh_reference">%s</code><code class="sh_value">:&lt;/h2&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> filename<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">&lt;b&gt;Size:&lt;/b&gt; </code><code class="sh_reference">%u</code><code class="sh_value"> bytes&lt;br/&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> finfo<code class="sh_misc">.</code>size<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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>
+ <code class="sh_comment">/* Get the digest type the client wants to see */</code>
+ digestType <code class="sh_misc">=</code> apr_table_get<code class="sh_misc">(</code>GET<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">digest</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>digestType<code class="sh_misc">)</code> digestType <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">MD5</code><code class="sh_character">"</code><code class="sh_misc">;</code>
- 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; ">&gt;</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 <code class="sh_misc">=</code> apr_file_open<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>file<code class="sh_misc">,</code> filename<code class="sh_misc">,</code> APR_READ<code class="sh_misc">,</code> APR_OS_DEFAULT<code class="sh_misc">,</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">pool</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code>rc <code class="sh_misc">=</code><code class="sh_misc">=</code> APR_SUCCESS<code class="sh_misc">)</code> <code class="sh_misc">{</code>
- <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>
+ <code class="sh_comment">/* Are we trying to calculate the MD5 or the SHA1 digest? */</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>digestType<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">md5</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <code class="sh_comment">/* Calculate the MD5 sum of the file */</code>
+ <code class="sh_declare">union</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">char</code> chr<code class="sh_misc">[</code><code class="sh_reference">16</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ uint32_t num<code class="sh_misc">[</code><code class="sh_reference">4</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code> digest<code class="sh_misc">;</code>
+ apr_md5_ctx_t md5<code class="sh_misc">;</code>
+ apr_md5_init<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>md5<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ readBytes <code class="sh_misc">=</code> <code class="sh_reference">256</code><code class="sh_misc">;</code>
+ <code class="sh_declare">while</code> <code class="sh_misc">(</code> apr_file_read<code class="sh_misc">(</code>file<code class="sh_misc">,</code> buffer<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>readBytes<code class="sh_misc">)</code> <code class="sh_misc">=</code><code class="sh_misc">=</code> APR_SUCCESS <code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ apr_md5_update<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>md5<code class="sh_misc">,</code> buffer<code class="sh_misc">,</code> readBytes<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ apr_md5_final<code class="sh_misc">(</code>digest<code class="sh_misc">.</code>chr<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>md5<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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&gt;MD5: &lt;/b&gt;&lt;code&gt;</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&gt;</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/&gt;&lt;a href='?digest=sha1'&gt;View the SHA1 hash instead&lt;/a&gt;</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>
+ <code class="sh_comment">/* Print out the MD5 digest */</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;b&gt;MD5: &lt;/b&gt;&lt;code&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">for</code> <code class="sh_misc">(</code>n <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code> n <code class="sh_misc">&lt;</code> APR_MD5_DIGESTSIZE<code class="sh_misc">/</code><code class="sh_reference">4</code><code class="sh_misc">;</code> n<code class="sh_misc">+</code><code class="sh_misc">+</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_reference">%08x</code><code class="sh_character">"</code><code class="sh_misc">,</code> digest<code class="sh_misc">.</code>num<code class="sh_misc">[</code>n<code class="sh_misc">]</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;/code&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/* Print a link to the SHA1 version */</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;br/&gt;&lt;a href='?digest=sha1'&gt;View the SHA1 hash instead&lt;/a&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">else</code> <code class="sh_misc">{</code>
+ <code class="sh_comment">/* Calculate the SHA1 sum of the file */</code>
+ <code class="sh_declare">union</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">char</code> chr<code class="sh_misc">[</code><code class="sh_reference">20</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ uint32_t num<code class="sh_misc">[</code><code class="sh_reference">5</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code> digest<code class="sh_misc">;</code>
+ apr_sha1_ctx_t sha1<code class="sh_misc">;</code>
+ apr_sha1_init<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>sha1<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ readBytes <code class="sh_misc">=</code> <code class="sh_reference">256</code><code class="sh_misc">;</code>
+ <code class="sh_declare">while</code> <code class="sh_misc">(</code> apr_file_read<code class="sh_misc">(</code>file<code class="sh_misc">,</code> buffer<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>readBytes<code class="sh_misc">)</code> <code class="sh_misc">=</code><code class="sh_misc">=</code> APR_SUCCESS <code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ apr_sha1_update<code class="sh_misc">(</code><code class="sh_misc">&amp;</code>sha1<code class="sh_misc">,</code> buffer<code class="sh_misc">,</code> readBytes<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ apr_sha1_final<code class="sh_misc">(</code>digest<code class="sh_misc">.</code>chr<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>sha1<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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&gt;SHA1: &lt;/b&gt;&lt;code&gt;</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&gt;</code><code style="color:#800000; ">"</code><code style="color:#806030; ">,</code> r<code style="color:#806030; ">)</code><code style="color:#806030; ">;</code>
+ <code class="sh_comment">/* Print out the SHA1 digest */</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;b&gt;SHA1: &lt;/b&gt;&lt;code&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">for</code> <code class="sh_misc">(</code>n <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code> n <code class="sh_misc">&lt;</code> APR_SHA1_DIGESTSIZE<code class="sh_misc">/</code><code class="sh_reference">4</code><code class="sh_misc">;</code> n<code class="sh_misc">+</code><code class="sh_misc">+</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_reference">%08x</code><code class="sh_character">"</code><code class="sh_misc">,</code> digest<code class="sh_misc">.</code>num<code class="sh_misc">[</code>n<code class="sh_misc">]</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;/code&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <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/&gt;&lt;a href='?digest=md5'&gt;View the MD5 hash instead&lt;/a&gt;</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>
+ <code class="sh_comment">/* Print a link to the MD5 version */</code>
+ ap_rputs<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">&lt;br/&gt;&lt;a href='?digest=md5'&gt;View the MD5 hash instead&lt;/a&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ apr_file_close<code class="sh_misc">(</code>file<code class="sh_misc">)</code><code class="sh_misc">;</code>
- <code style="color:#806030; ">}</code>
+ <code class="sh_misc">}</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>
-
+ <code class="sh_comment">/* Let the server know that we responded to this request. */</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
+<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>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -694,141 +722,150 @@ advanced configurations
for your modules.
</p>
<h3><a name="config_intro" id="config_intro">An introduction to configuration
-directives</a></h3> If you are reading this, then you probably already know
+directives</a></h3>
+<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:
+</p>
<div class="example"><pre>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/foo/bar
RewriteRule ^/foo/bar/(.*)$ /foobar?page=$1
</pre></div>
+<p>
Each of these configuration directives are handled by a separate function,
that parses the parameters given and sets up a configuration accordingly.
+</p>
<h3><a name="config_simple" id="config_simple">Making an example configuration</a></h3>
-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>
-<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>
+<p class="source">
+<code class="sh_declare">typedef</code> <code class="sh_declare">struct</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">int</code> enabled<code class="sh_misc">;</code> <code class="sh_comment">/* Enable or disable our module */</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>path<code class="sh_misc">;</code> <code class="sh_comment">/* Some path to...something */</code>
+ <code class="sh_declare">int</code> typeOfAction<code class="sh_misc">;</code> <code class="sh_comment">/* 1 means action A, 2 means action B and so on */</code>
+<code class="sh_misc">}</code> example_config<code class="sh_misc">;</code>
+</p>
+<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>
-
-<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; ">&gt;</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; ">&gt;</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>
-
+<p class="source">
+<code class="sh_declare">typedef</code> <code class="sh_declare">struct</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">int</code> enabled<code class="sh_misc">;</code> <code class="sh_comment">/* Enable or disable our module */</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>path<code class="sh_misc">;</code> <code class="sh_comment">/* Some path to...something */</code>
+ <code class="sh_declare">int</code> typeOfAction<code class="sh_misc">;</code> <code class="sh_comment">/* 1 means action A, 2 means action B and so on */</code>
+<code class="sh_misc">}</code> example_config<code class="sh_misc">;</code>
+
+<code class="sh_declare">static</code> example_config config<code class="sh_misc">;</code>
+
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code><code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_set_content_type<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/plain</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(r, </code><code class="sh_character">"</code><code class="sh_value">Enabled: </code><code class="sh_reference">%u</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>enabled<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(r, </code><code class="sh_character">"</code><code class="sh_value">Path: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>path<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(r, </code><code class="sh_character">"</code><code class="sh_value">TypeOfAction: </code><code class="sh_reference">%x</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>typeOfAction<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">1</code><code class="sh_misc">;</code>
+ config<code class="sh_misc">.</code>path <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">/foo/bar</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">0x00</code><code class="sh_misc">;</code>
+ ap_hook_handler<code class="sh_misc">(</code>example_handler<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> APR_HOOK_LAST<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/* Define our module as an entity and assign a function for registering hooks */</code>
+
+module AP_MODULE_DECLARE_DATA example_module <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ STANDARD20_MODULE_STUFF<code class="sh_misc">,</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-directory configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-server configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+</p>
+<p>
So far so good. To access our new handler, we could add the following to
our configuration:
+</p>
<div class="example"><pre>
&lt;Location /example&gt;
SetHandler example-handler
&lt;/Location&gt;
</pre></div>
+<p>
When we visit, we'll see our current configuration being spit out by our
module.
+</p>
<h3><a name="register_directive" id="register_directive">Registering directives with the server</a></h3>
+<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>
-
-<pre style="color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;">
+<p class="source">
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>
+ <code class="sh_constant">NULL</code>, <code class="sh_comment">/* Per-directory configuration handler */</code>
+ <code class="sh_constant">NULL</code>, <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ <code class="sh_constant">NULL</code>, <code class="sh_comment">/* Per-server configuration handler */</code>
+ <code class="sh_constant">NULL</code>, <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ example_directives, <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
};
-</pre>
-
+</p>
+<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>
-
-<pre style="color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;">
+<p class="source">
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> }
+ <code class="sh_declare"><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 class="sh_constant">NULL</code>, RSRC_CONF, "Enable or disable mod_example"),
+ <code class="sh_declare"><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 class="sh_constant">NULL</code>, RSRC_CONF, "The path to whatever"),
+ <code class="sh_declare"><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 class="sh_constant">NULL</code>, RSRC_CONF, "Special action value!"),
+ { <code class="sh_constant">NULL</code> }
};
-</pre>
-
+</p>
-<img src="../images/build_a_mod_4.png" border="1" /><br />
<p>
+<img src="../images/build_a_mod_4.png" border="1" 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
@@ -841,6 +878,7 @@ accordingly. We will discuss how to make this in the following paragraph.</li>
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
@@ -856,176 +894,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 />
-
-
-<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>
+has an additional parameter defined:</p>
+
+
+<p class="source">
+<code class="sh_comment">/* Handler for the "exambleEnabled" directive */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_enabled<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">on</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">1</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/* Handler for the "examplePath" directive */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_path<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ config<code class="sh_misc">.</code>path <code class="sh_misc">=</code> arg<code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/* Handler for the "exampleAction" directive */</code>
+<code class="sh_comment">/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */</code>
+<code class="sh_comment">/* and we store it in a bit-wise manner. */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_action<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg1<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc">*</code> arg2<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg1<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">file</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">0x01</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">0x02</code><code class="sh_misc">;</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> 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>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg2<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">deny</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x10</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x20</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
-</p>
<h3><a name="directive_complete" id="directive_complete">Putting it all together</a></h3>
<p>
Now that we have our directives set up, and handlers configured for them,
we can assemble our module into one big file:
+</p>
-
-<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; ">&gt;</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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;Our configuration prototype and declaration:</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;Our directive handlers:</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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>
+<p class="source">
+<code class="sh_comment">/* mod_example_config_simple.c: */</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">&lt;</code><code class="sh_reference">stdio.h</code><code class="sh_character">&gt;</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">apr_hash.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">ap_config.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">ap_provider.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">httpd.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_core.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_config.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_log.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_protocol.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_request.h</code><code class="sh_character">"</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;Our configuration prototype and declaration:</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">typedef</code> <code class="sh_declare">struct</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">int</code> enabled<code class="sh_misc">;</code> <code class="sh_comment">/* Enable or disable our module */</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>path<code class="sh_misc">;</code> <code class="sh_comment">/* Some path to...something */</code>
+ <code class="sh_declare">int</code> typeOfAction<code class="sh_misc">;</code> <code class="sh_comment">/* 1 means action A, 2 means action B and so on */</code>
+<code class="sh_misc">}</code> example_config<code class="sh_misc">;</code>
+
+<code class="sh_declare">static</code> example_config config<code class="sh_misc">;</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;Our directive handlers:</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_comment">/* Handler for the "exambleEnabled" directive */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_enabled<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">on</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">1</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/* Handler for the "examplePath" directive */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_path<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ config<code class="sh_misc">.</code>path <code class="sh_misc">=</code> arg<code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/* Handler for the "exampleAction" directive */</code>
+<code class="sh_comment">/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */</code>
+<code class="sh_comment">/* and we store it in a bit-wise manner. */</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc"> *</code>example_set_action<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg1<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code><code class="sh_misc">*</code> arg2<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg1<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">file</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">0x01</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">0x02</code><code class="sh_misc">;</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> 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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;The directive structure for our name tag:</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;Our module handler:</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;The hook registration function (also initializes the default config values):</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;Our module name tag:</code>
-<code style="color:#c34e00; ">&nbsp;==============================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg2<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">deny</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x10</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code> config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x20</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;The directive structure for our name tag:</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">static</code> <code class="sh_declare">const</code> command_rec example_directives<code class="sh_misc">[</code><code class="sh_misc">]</code> <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">exampleEnabled</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_enabled<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> RSRC_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Enable or disable mod_example</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">examplePath</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_path<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> RSRC_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">The path to whatever</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">exampleAction</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_action<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> RSRC_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Special action value!</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <code class="sh_misc">{</code> <code class="sh_constant">NULL</code> <code class="sh_misc">}</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;Our module handler:</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code><code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_set_content_type<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/plain</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Enabled: </code><code class="sh_reference">%u</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>enabled<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Path: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>path<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">TypeOfAction: </code><code class="sh_reference">%x</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">.</code>typeOfAction<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;The hook registration function (also initializes the default config values):</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ config<code class="sh_misc">.</code>enabled <code class="sh_misc">=</code> <code class="sh_reference">1</code><code class="sh_misc">;</code>
+ config<code class="sh_misc">.</code>path <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">/foo/bar</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ config<code class="sh_misc">.</code>typeOfAction <code class="sh_misc">=</code> <code class="sh_reference">3</code><code class="sh_misc">;</code>
+ ap_hook_handler<code class="sh_misc">(</code>example_handler<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> APR_HOOK_LAST<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;Our module name tag:</code>
+<code class="sh_comment">&nbsp;==============================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+module AP_MODULE_DECLARE_DATA example_module <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ STANDARD20_MODULE_STUFF<code class="sh_misc">,</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-directory configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-server configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ example_directives<code class="sh_misc">,</code> <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+</p>
-</p>
<p>
In our httpd.conf file, we can now change the hard-coded configuration by
adding a few lines:
+</p>
<div class="example"><pre>
ExampleEnabled On
ExamplePath "/usr/bin/foo"
ExampleAction file allow
</pre></div>
+<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.
@@ -1042,6 +1080,7 @@ 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:
+</p>
<div class="example"><pre>
&lt;Directory "/var/www"&gt;
RewriteCond %{HTTP_HOST} ^example.com$
@@ -1051,12 +1090,14 @@ configuration set up for mod_rewrite:
RewriteRule ^foobar$ index.php?foobar=true
&lt;/Directory&gt;
</pre></div>
+<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
@@ -1067,15 +1108,14 @@ 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>
+<p class="source">
-<pre style="color:#000000;background:#ffffef;border: 1px dashed #333; padding: 0.5em; margin: 1em 2em 1em 1em;">
-
-
-
-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>
+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 class="sh_subobject">r-&gt;per_dir_config</code>, &amp;example_module);
+</p>
+<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
@@ -1088,61 +1128,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:
-
-
-
-<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>
-
-
-
</p>
-<p>Our handler for requests will also be modified, yet still very simple:
-
+<p class="source">
+<code class="sh_declare">typedef</code> <code class="sh_declare">struct</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">char</code> context<code class="sh_misc">[</code><code class="sh_reference">256</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_declare">char</code> path<code class="sh_misc">[</code><code class="sh_reference">256</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> typeOfAction<code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> enabled<code class="sh_misc">;</code>
+<code class="sh_misc">}</code> example_config<code class="sh_misc">;</code>
+</p>
-<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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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>
+<p>Our handler for requests will also be modified, yet still very simple:</p>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code><code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ example_config<code class="sh_misc"> *</code>config <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config<code class="sh_misc">*</code><code class="sh_misc">)</code> ap_get_module_config<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">per_dir_config</code><code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>example_module<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_set_content_type<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/plain</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">Enabled: </code><code class="sh_reference">%u</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">Path: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">TypeOfAction: </code><code class="sh_reference">%x</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">Context: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">context</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
</p>
+
<h3><a name="context_which" id="context_which">Choosing a context</a></h3>
<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>
-<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>("exampleEnabled", example_set_enabled, <code style="color:#7f0055; font-weight:bold; ">NULL</code>, RSRC_CONF, "Enable or disable mod_example"),
-</pre>
+<p class="source">
+<code class="sh_declare"><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 class="sh_constant">NULL</code>, RSRC_CONF, "Enable or disable mod_example"),
+</p>
-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
@@ -1156,62 +1189,59 @@ 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:
-
-
-<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>
-
-
-
+per-directory creator and merger function reference in our tag:</p>
+
+
+<p class="source">
+module AP_MODULE_DECLARE_DATA example_module <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ STANDARD20_MODULE_STUFF<code class="sh_misc">,</code>
+ create_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Per-directory configuration handler */</code>
+ merge_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-server configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ directives<code class="sh_misc">,</code> <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
</p>
-<h3><a name="context_which" id="context_which">Creating new context configurations</a></h3>
+
+<h3><a name="context_new" id="context_new">Creating new context configurations</a></h3>
<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:
-
-<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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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>
+our name tag as the Per-directory configuration handler:</p>
+
+<p class="source">
+<code class="sh_declare">void</code><code class="sh_misc">*</code> example_create_dir_conf<code class="sh_misc">(</code>apr_pool_t<code class="sh_misc">*</code> pool<code class="sh_misc">,</code> <code class="sh_declare">char</code><code class="sh_misc">*</code> context<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ context <code class="sh_misc">=</code> context <code class="sh_misc">?</code> context <code class="sh_misc">:</code> <code class="sh_character">"</code><code class="sh_value">(undefined context)</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ example_config<code class="sh_misc"> *</code>cfg <code class="sh_misc">=</code> apr_pcalloc<code class="sh_misc">(</code>pool<code class="sh_misc">,</code> <code class="sh_declare">sizeof</code><code class="sh_misc">(</code>example_config<code class="sh_misc">)</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>cfg<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <code class="sh_comment">/* Set some default values */</code>
+ <code class="sh_function">strcpy</code><code class="sh_misc">(</code>cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">context</code><code class="sh_misc">,</code> x<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code> <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">/foo/bar</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> <code class="sh_reference">0x11</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code> cfg<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
-</p>
-<h3><a name="context_which" id="context_which">Merging configurations</a></h3>
+<h3><a name="context_merge" id="context_merge">Merging configurations</a></h3>
<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:
+</p>
<div class="example"><pre>
&lt;Directory "/var/www"&gt;
ExampleEnable On
@@ -1222,11 +1252,13 @@ where you have a parent configuration and a child, such as the following:
ExampleAction file deny
&lt;/Directory&gt;
</pre></div>
+<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>
@@ -1234,35 +1266,37 @@ 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>
-<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>
+<p class="source">
+<code class="sh_declare">void</code><code class="sh_misc">*</code> merge_dir_conf<code class="sh_misc">(</code>apr_pool_t<code class="sh_misc">*</code> pool<code class="sh_misc">,</code> <code class="sh_declare">void</code><code class="sh_misc">*</code> BASE<code class="sh_misc">,</code> <code class="sh_declare">void</code><code class="sh_misc">*</code> ADD<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ example_config<code class="sh_misc">*</code> base <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> BASE <code class="sh_misc">;</code>
+ example_config<code class="sh_misc">*</code> add <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> ADD <code class="sh_misc">;</code>
+ example_config<code class="sh_misc">*</code> conf <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> create_dir_conf<code class="sh_misc">(</code>pool<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Merged configuration</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- conf<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</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; ">&gt;</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; ">&gt;</code><code style="color:#008833">enabled</code> <code style="color:#806030; ">:</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">enabled</code> <code style="color:#806030; ">;</code>
- conf<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">=</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">?</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">:</code> base<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</code><code style="color:#008833">path</code> <code style="color:#806030; ">:</code> base<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">path</code><code style="color:#806030; ">)</code><code style="color:#806030; ">;</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_misc">(</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code><code class="sh_misc">=</code> <code class="sh_reference">0</code> <code class="sh_misc">)</code> <code class="sh_misc">?</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">:</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">;</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">?</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">:</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code><code class="sh_misc">;</code>
+ <code class="sh_function">strcpy</code><code class="sh_misc">(</code>conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">,</code> <code class="sh_function">strlen</code><code class="sh_misc">(</code>add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code> <code class="sh_misc">?</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code> <code class="sh_misc">:</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- <code style="color:#400000; font-weight:bold; ">return</code> conf <code style="color:#806030; ">;</code>
-<code style="color:#806030; ">}</code>
-</pre>
+ <code class="sh_declare">return</code> conf <code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
-</p>
-<h3><a name="context_which" id="context_which">Trying out our new context aware configurations</a></h3>
+
+<h3><a name="context_example" id="context_example">Trying out our new context aware configurations</a></h3>
<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:
+</p>
<div class="example"><pre>
&lt;Location "/a"&gt;
SetHandler example-handler
@@ -1282,238 +1316,239 @@ how the module works:
ExampleEnabled on
&lt;/Location&gt;
</pre></div>
+<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>
-<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; ">&nbsp;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
-<code style="color:#c34e00; ">&nbsp;* mod_example_config.c</code>
-<code style="color:#c34e00; ">&nbsp;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Configuration structure</code>
-<code style="color:#c34e00; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Prototypes</code>
-<code style="color:#c34e00; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Configuration directives</code>
-<code style="color:#c34e00; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Our name tag</code>
-<code style="color:#c34e00; ">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Hook registration function</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Our example web service handler</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "exambleEnabled" directive</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "examplePath" directive</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "exampleAction" directive ;</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Let's pretend this one takes one argument (file or db), and a second (deny or allow), ;</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;and we store it in a bit-wise manner.</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Function for creating new configurations for per-directory contexts</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;&nbsp;&nbsp;&nbsp;Merging function for configurations</code>
-<code style="color:#c34e00; ">&nbsp;=======================================================================================================================</code>
-<code style="color:#c34e00; ">&nbsp;*/</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; ">&gt;</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; ">&gt;</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; ">&gt;</code><code style="color:#008833">enabled</code> <code style="color:#806030; ">:</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">enabled</code><code style="color:#806030; ">;</code>
- conf<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">=</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">?</code> add<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</code><code style="color:#008833">typeOfAction</code> <code style="color:#806030; ">:</code> base<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</code><code style="color:#008833">path</code> <code style="color:#806030; ">:</code> base<code style="color:#806030; ">-</code><code style="color:#806030; ">&gt;</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>
+<p class="source">
+<code class="sh_comment">/*$6</code>
+<code class="sh_comment">&nbsp;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
+<code class="sh_comment">&nbsp;* mod_example_config.c</code>
+<code class="sh_comment">&nbsp;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</code>
+<code class="sh_comment">&nbsp;*/</code>
+
+
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">&lt;</code><code class="sh_reference">stdio.h</code><code class="sh_character">&gt;</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">apr_hash.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">ap_config.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">ap_provider.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">httpd.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_core.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_config.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_log.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_protocol.h</code><code class="sh_character">"</code>
+<code class="sh_function">#</code><code class="sh_function">include </code><code class="sh_character">"</code><code class="sh_reference">http_request.h</code><code class="sh_character">"</code>
+
+<code class="sh_comment">/*$1</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Configuration structure</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;*/</code>
+
+<code class="sh_declare">typedef</code> <code class="sh_declare">struct</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">char</code> context<code class="sh_misc">[</code><code class="sh_reference">256</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_declare">char</code> path<code class="sh_misc">[</code><code class="sh_reference">256</code><code class="sh_misc">]</code><code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> typeOfAction<code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> enabled<code class="sh_misc">;</code>
+<code class="sh_misc">}</code> example_config<code class="sh_misc">;</code>
+
+<code class="sh_comment">/*$1</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Prototypes</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;*/</code>
+
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_enabled<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_path<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_action<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg1<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg2<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">void</code> <code class="sh_misc">*</code>create_dir_conf<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">,</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>context<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">void</code> <code class="sh_misc">*</code>merge_dir_conf<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>BASE<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>ADD<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code><code class="sh_misc">;</code>
+
+<code class="sh_comment">/*$1</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Configuration directives</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;*/</code>
+
+<code class="sh_declare">static</code> <code class="sh_declare">const</code> command_rec directives<code class="sh_misc">[</code><code class="sh_misc">]</code> <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">exampleEnabled</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_enabled<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> ACCESS_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Enable or disable mod_example</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#ga07c7d22ae17805e61204463326cf9c34">AP_INIT_TAKE1</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">examplePath</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_path<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> ACCESS_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">The path to whatever</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <a href="http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__CONFIG.html#gafaec43534fcf200f37d9fecbf9247c21">AP_INIT_TAKE2</a><code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">exampleAction</code><code class="sh_character">"</code><code class="sh_misc">,</code> example_set_action<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> ACCESS_CONF<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Special action value!</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">,</code>
+ <code class="sh_misc">{</code> <code class="sh_constant">NULL</code> <code class="sh_misc">}</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+
+<code class="sh_comment">/*$1</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Our name tag</code>
+<code class="sh_comment">&nbsp;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>
+<code class="sh_comment">&nbsp;*/</code>
+
+module AP_MODULE_DECLARE_DATA example_module <code class="sh_misc">=</code>
+<code class="sh_misc">{</code>
+ STANDARD20_MODULE_STUFF<code class="sh_misc">,</code>
+ create_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Per-directory configuration handler */</code>
+ merge_dir_conf<code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-directory configurations */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Per-server configuration handler */</code>
+ <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_comment">/* Merge handler for per-server configurations */</code>
+ directives<code class="sh_misc">,</code> <code class="sh_comment">/* Any directives we may have for httpd */</code>
+ register_hooks <code class="sh_comment">/* Our hook registering function */</code>
+<code class="sh_misc">}</code><code class="sh_misc">;</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Hook registration function</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">static</code> <code class="sh_declare">void</code> register_hooks<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ ap_hook_handler<code class="sh_misc">(</code>example_handler<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> APR_HOOK_LAST<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Our example web service handler</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code> <code class="sh_misc">|</code><code class="sh_misc">|</code> <code class="sh_function">strcmp</code><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">handler</code><code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">example-handler</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code><code class="sh_misc">(</code>DECLINED<code class="sh_misc">)</code><code class="sh_misc">;</code>
+
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>config <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> ap_get_module_config<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">per_dir_config</code><code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>example_module<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ ap_set_content_type<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">text/plain</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Enabled: </code><code class="sh_reference">%u</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Path: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">TypeOfAction: </code><code class="sh_reference">%x</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Context: </code><code class="sh_reference">%s</code><code class="sh_reference">\n</code><code class="sh_character">"</code><code class="sh_misc">,</code> config<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">context</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "exambleEnabled" directive</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_enabled<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>conf <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> cfg<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>conf<code class="sh_misc">)</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">on</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_reference">1</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "examplePath" directive</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_path<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>conf <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> cfg<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>conf<code class="sh_misc">)</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_function">strcpy</code><code class="sh_misc">(</code>conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">,</code> arg<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Handler for the "exampleAction" directive ;</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Let's pretend this one takes one argument (file or db), and a second (deny or allow), ;</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;and we store it in a bit-wise manner.</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>example_set_action<code class="sh_misc">(</code>cmd_parms <code class="sh_misc">*</code>cmd<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>cfg<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg1<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>arg2<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>conf <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> cfg<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>conf<code class="sh_misc">)</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg1<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">file</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> <code class="sh_reference">0x01</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> <code class="sh_reference">0x02</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code>strcasecmp<code class="sh_misc">(</code>arg2<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">deny</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">)</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x10</code><code class="sh_misc">;</code>
+ <code class="sh_declare">else</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">+</code><code class="sh_misc">=</code> <code class="sh_reference">0x20</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_declare">return</code> <code class="sh_constant">NULL</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Function for creating new configurations for per-directory contexts</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">void</code> <code class="sh_misc">*</code>create_dir_conf<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">,</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>context<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ context <code class="sh_misc">=</code> context <code class="sh_misc">?</code> context <code class="sh_misc">:</code> <code class="sh_character">"</code><code class="sh_value">Newly created configuration</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>cfg <code class="sh_misc">=</code> apr_pcalloc<code class="sh_misc">(</code>pool<code class="sh_misc">,</code> <code class="sh_declare">sizeof</code><code class="sh_misc">(</code>example_config<code class="sh_misc">)</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>cfg<code class="sh_misc">)</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_misc">{</code>
+ <code class="sh_comment">/* Set some default values */</code>
+ <code class="sh_function">strcpy</code><code class="sh_misc">(</code>cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">context</code><code class="sh_misc">,</code> context<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_function">memset</code><code class="sh_misc">(</code>cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">,</code> <code class="sh_reference">0</code><code class="sh_misc">,</code> <code class="sh_reference">256</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ cfg<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> <code class="sh_reference">0x00</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_declare">return</code> cfg<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_comment">/*</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;&nbsp;&nbsp;&nbsp;Merging function for configurations</code>
+<code class="sh_comment">&nbsp;=======================================================================================================================</code>
+<code class="sh_comment">&nbsp;*/</code>
+<code class="sh_declare">void</code> <code class="sh_misc">*</code>merge_dir_conf<code class="sh_misc">(</code>apr_pool_t <code class="sh_misc">*</code>pool<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>BASE<code class="sh_misc">,</code> <code class="sh_declare">void</code> <code class="sh_misc">*</code>ADD<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ example_config <code class="sh_misc">*</code>base <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> BASE<code class="sh_misc">;</code>
+ example_config <code class="sh_misc">*</code>add <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> ADD<code class="sh_misc">;</code>
+ example_config <code class="sh_misc">*</code>conf <code class="sh_misc">=</code> <code class="sh_misc">(</code>example_config <code class="sh_misc">*</code><code class="sh_misc">)</code> create_dir_conf<code class="sh_misc">(</code>pool<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">Merged configuration</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code> <code class="sh_misc">(</code>add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">=</code><code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">)</code> <code class="sh_misc">?</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code> <code class="sh_misc">:</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">enabled</code><code class="sh_misc">;</code>
+ conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">=</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">?</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code> <code class="sh_misc">:</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">typeOfAction</code><code class="sh_misc">;</code>
+ <code class="sh_function">strcpy</code><code class="sh_misc">(</code>conf<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">,</code> <code class="sh_function">strlen</code><code class="sh_misc">(</code>add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code> <code class="sh_misc">?</code> add<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code> <code class="sh_misc">:</code> base<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">path</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> conf<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
@@ -1539,33 +1574,33 @@ or check out the rest of our documentation for further tips.
-<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; ">&gt;</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; ">&gt;</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>
+<p class="source">
+<code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>read_post_value<code class="sh_misc">(</code><code class="sh_declare">const</code> apr_array_header_t <code class="sh_misc">*</code>fields<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>key<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ <code class="sh_declare">int</code> i<code class="sh_misc">;</code>
+ apr_table_entry_t <code class="sh_misc">*</code>e <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ e <code class="sh_misc">=</code> <code class="sh_misc">(</code>apr_table_entry_t <code class="sh_misc">*</code><code class="sh_misc">)</code> fields<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>elts<code class="sh_misc">;</code>
+ <code class="sh_declare">for</code><code class="sh_misc">(</code>i <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code> i <code class="sh_misc">&lt;</code> fields<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>nelts<code class="sh_misc">;</code> i<code class="sh_misc">+</code><code class="sh_misc">+</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">!</code><code class="sh_function">strcmp</code><code class="sh_misc">(</code>e<code class="sh_misc">[</code>i<code class="sh_misc">]</code><code class="sh_misc">.</code>key<code class="sh_misc">,</code> key<code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_declare">return</code> e<code class="sh_misc">[</code>i<code class="sh_misc">]</code><code class="sh_misc">.</code>val<code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_req <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ apr_array_header_t <code class="sh_misc">*</code>POST<code class="sh_misc">;</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>value<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ ap_parse_form_data<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_constant">NULL</code><code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>POST<code class="sh_misc">,</code> <code class="sh_misc">-</code><code class="sh_reference">1</code><code class="sh_misc">,</code> <code class="sh_reference">8192</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
- 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>
+ value <code class="sh_misc">=</code> read_post_value<code class="sh_misc">(</code>POST<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">valueA</code><code class="sh_character">"</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">if</code> <code class="sh_misc">(</code><code class="sh_misc">!</code>value<code class="sh_misc">)</code> value <code class="sh_misc">=</code> <code class="sh_character">"</code><code class="sh_value">(undefined)</code><code class="sh_character">"</code><code class="sh_misc">;</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">The value of valueA is: </code><code class="sh_reference">%s</code><code class="sh_character">"</code><code class="sh_misc">,</code> value<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
@@ -1575,23 +1610,23 @@ or check out the rest of our documentation for further tips.
-<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; ">&gt;</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; ">&gt;</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; ">&gt;</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&gt;</code><code style="color:#0f6900; ">%s</code><code style="color:#e60000; ">&lt;/b&gt;: </code><code style="color:#0f6900; ">%s</code><code style="color:#e60000; ">&lt;br/&gt;</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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_req <code class="sh_misc">*</code>r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ <code class="sh_declare">const</code> apr_array_header_t <code class="sh_misc">*</code>fields<code class="sh_misc">;</code>
+ <code class="sh_declare">int</code> i<code class="sh_misc">;</code>
+ apr_table_entry_t <code class="sh_misc">*</code>e <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ fields <code class="sh_misc">=</code> <a href="http://apr.apache.org/docs/apr/1.4/group__apr__tables.html#gaea3005541cce67481f48ab201b5c0cf3">apr_table_elts</a><code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>headers_in<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ e <code class="sh_misc">=</code> <code class="sh_misc">(</code>apr_table_entry_t <code class="sh_misc">*</code><code class="sh_misc">)</code> fields<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>elts<code class="sh_misc">;</code>
+ <code class="sh_declare">for</code><code class="sh_misc">(</code>i <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code> i <code class="sh_misc">&lt;</code> fields<code class="sh_misc">-</code><code class="sh_misc">&gt;</code>nelts<code class="sh_misc">;</code> i<code class="sh_misc">+</code><code class="sh_misc">+</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ ap_rprintf<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_character">"</code><code class="sh_value">&lt;b&gt;</code><code class="sh_reference">%s</code><code class="sh_value">&lt;/b&gt;: </code><code class="sh_reference">%s</code><code class="sh_value">&lt;br/&gt;</code><code class="sh_character">"</code><code class="sh_misc">,</code> e<code class="sh_misc">[</code>i<code class="sh_misc">]</code><code class="sh_misc">.</code>key<code class="sh_misc">,</code> e<code class="sh_misc">[</code>i<code class="sh_misc">]</code><code class="sh_misc">.</code>val<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+</p>
@@ -1601,55 +1636,55 @@ or check out the rest of our documentation for further tips.
-<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; ">&gt;</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; ">&gt;</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; ">&gt;</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; ">&gt;</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>
+<p class="source">
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> util_read<code class="sh_misc">(</code>request_rec <code class="sh_misc">*</code>r<code class="sh_misc">,</code> <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code><code class="sh_misc">*</code>rbuf<code class="sh_misc">,</code> apr_off_t <code class="sh_misc">*</code>size<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~*/</code>
+ <code class="sh_declare">int</code> rc <code class="sh_misc">=</code> OK<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">(</code>rc <code class="sh_misc">=</code> ap_setup_client_block<code class="sh_misc">(</code>r<code class="sh_misc">,</code> REQUEST_CHUNKED_ERROR<code class="sh_misc">)</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">return</code><code class="sh_misc">(</code>rc<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>ap_should_client_block<code class="sh_misc">(</code>r<code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+ <code class="sh_declare">char</code> argsbuffer<code class="sh_misc">[</code>HUGE_STRING_LEN<code class="sh_misc">]</code><code class="sh_misc">;</code>
+ apr_off_t rsize<code class="sh_misc">,</code> len_read<code class="sh_misc">,</code> rpos <code class="sh_misc">=</code> <code class="sh_reference">0</code><code class="sh_misc">;</code>
+ apr_off_t length <code class="sh_misc">=</code> r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">remaining</code><code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_misc">*</code>rbuf <code class="sh_misc">=</code> <code class="sh_misc">(</code><code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code><code class="sh_misc">)</code> apr_pcalloc<code class="sh_misc">(</code>r<code class="sh_misc">-</code><code class="sh_misc">&gt;</code><code class="sh_subobject">pool</code><code class="sh_misc">,</code> <code class="sh_misc">(</code>apr_size_t<code class="sh_misc">)</code> <code class="sh_misc">(</code>length <code class="sh_misc">+</code> <code class="sh_reference">1</code><code class="sh_misc">)</code><code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">*</code>size <code class="sh_misc">=</code> length<code class="sh_misc">;</code>
+ <code class="sh_declare">while</code><code class="sh_misc">(</code><code class="sh_misc">(</code>len_read <code class="sh_misc">=</code> ap_get_client_block<code class="sh_misc">(</code>r<code class="sh_misc">,</code> argsbuffer<code class="sh_misc">,</code> <code class="sh_declare">sizeof</code><code class="sh_misc">(</code>argsbuffer<code class="sh_misc">)</code><code class="sh_misc">)</code><code class="sh_misc">)</code> <code class="sh_misc">&gt;</code> <code class="sh_reference">0</code><code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ <code class="sh_declare">if</code><code class="sh_misc">(</code><code class="sh_misc">(</code>rpos <code class="sh_misc">+</code> len_read<code class="sh_misc">)</code> <code class="sh_misc">&gt;</code> length<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ rsize <code class="sh_misc">=</code> length <code class="sh_misc">-</code> rpos<code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">else</code> <code class="sh_misc">{</code>
+ rsize <code class="sh_misc">=</code> len_read<code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+
+ <code class="sh_function">memcpy</code><code class="sh_misc">(</code><code class="sh_misc">(</code><code class="sh_declare">char</code> <code class="sh_misc">*</code><code class="sh_misc">)</code> <code class="sh_misc">*</code>rbuf <code class="sh_misc">+</code> rpos<code class="sh_misc">,</code> argsbuffer<code class="sh_misc">,</code> <code class="sh_misc">(</code><code class="sh_function">size_t</code><code class="sh_misc">)</code> rsize<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ rpos <code class="sh_misc">+</code><code class="sh_misc">=</code> rsize<code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code><code class="sh_misc">(</code>rc<code class="sh_misc">)</code><code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+
+<code class="sh_declare">static</code> <code class="sh_declare">int</code> example_handler<code class="sh_misc">(</code>request_req<code class="sh_misc">*</code> r<code class="sh_misc">)</code>
+<code class="sh_misc">{</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~*/</code>
+ apr_off_t size<code class="sh_misc">;</code>
+ <code class="sh_declare">const</code> <code class="sh_declare">char</code> <code class="sh_misc">*</code>buffer<code class="sh_misc">;</code>
+ <code class="sh_comment">/*~~~~~~~~~~~~~~~~*/</code>
+
+ <code class="sh_declare">if</code><code class="sh_misc">(</code>util_read<code class="sh_misc">(</code>r<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>data<code class="sh_misc">,</code> <code class="sh_misc">&amp;</code>size<code class="sh_misc">)</code> <code class="sh_misc">=</code><code class="sh_misc">=</code> OK<code class="sh_misc">)</code> <code class="sh_misc">{</code>
+ ap_rprintf<code class="sh_misc">(</code><code class="sh_character">"</code><code class="sh_value">We read a request body that was </code><code class="sh_reference">%u</code><code class="sh_value"> bytes long</code><code class="sh_character">"</code><code class="sh_misc">,</code> size<code class="sh_misc">)</code><code class="sh_misc">;</code>
+ <code class="sh_misc">}</code>
+ <code class="sh_declare">return</code> OK<code class="sh_misc">;</code>
+<code class="sh_misc">}</code>
+ </p>
diff --git a/docs/manual/handler.html.fr b/docs/manual/handler.html.fr
index a0c6343610..962f6d1bdf 100644
--- a/docs/manual/handler.html.fr
+++ b/docs/manual/handler.html.fr
@@ -26,8 +26,6 @@
<a href="./tr/handler.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a> |
<a href="./zh-cn/handler.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Ce document décrit l'utilisation des gestionnaires d'Apache (handlers).</p>
</div>
@@ -121,7 +119,7 @@
<div class="example"><p><code>
&lt;Directory /web/htdocs/asis&gt;<br />
- SetHandler send-as-is<br />
+ <span class="indent">SetHandler send-as-is<br /></span>
&lt;/Directory&gt;
</code></p></div>
diff --git a/docs/manual/handler.xml.meta b/docs/manual/handler.xml.meta
index 275bdba5dd..8bb7830e1a 100644
--- a/docs/manual/handler.xml.meta
+++ b/docs/manual/handler.xml.meta
@@ -9,7 +9,7 @@
<variants>
<variant>en</variant>
<variant outdated="yes">es</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/howto/auth.html.fr b/docs/manual/howto/auth.html.fr
index ce82f65194..b9ac36b449 100644
--- a/docs/manual/howto/auth.html.fr
+++ b/docs/manual/howto/auth.html.fr
@@ -5,7 +5,7 @@
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
-<title>Authentification, autorisation et contrôle d'accès - Serveur Apache HTTP</title>
+<title>Authentification et autorisation - Serveur Apache HTTP</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
@@ -16,7 +16,7 @@
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">Serveur HTTP</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Recettes / Tutoriels</a></div><div id="page-content"><div id="preamble"><h1>Authentification, autorisation et contrôle d'accès</h1>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">Serveur HTTP</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Recettes / Tutoriels</a></div><div id="page-content"><div id="preamble"><h1>Authentification et autorisation</h1>
<div class="toplang">
<p><span>Langues Disponibles: </span><a href="../en/howto/auth.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/howto/auth.html" title="Français">&nbsp;fr&nbsp;</a> |
@@ -24,8 +24,6 @@
<a href="../ko/howto/auth.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/howto/auth.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>L'authentification est un processus qui vous permet de vérifier
qu'une personne est bien celle qu'elle prétend être. L'autorisation
diff --git a/docs/manual/howto/auth.xml.meta b/docs/manual/howto/auth.xml.meta
index 641334dcd6..b0b2e95d63 100644
--- a/docs/manual/howto/auth.xml.meta
+++ b/docs/manual/howto/auth.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/howto/htaccess.html.fr b/docs/manual/howto/htaccess.html.fr
index 738ad757d6..d0ab08dcda 100644
--- a/docs/manual/howto/htaccess.html.fr
+++ b/docs/manual/howto/htaccess.html.fr
@@ -5,7 +5,7 @@
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
-<title>Tutoriel Apache : fichiers .htaccess - Serveur Apache HTTP</title>
+<title>Tutoriel du serveur HTTP Apache : fichiers .htaccess - Serveur Apache HTTP</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
@@ -16,7 +16,7 @@
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">Serveur HTTP</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Recettes / Tutoriels</a></div><div id="page-content"><div id="preamble"><h1>Tutoriel Apache : fichiers .htaccess</h1>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">Serveur HTTP</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Recettes / Tutoriels</a></div><div id="page-content"><div id="preamble"><h1>Tutoriel du serveur HTTP Apache : fichiers .htaccess</h1>
<div class="toplang">
<p><span>Langues Disponibles: </span><a href="../en/howto/htaccess.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/howto/htaccess.html" title="Français">&nbsp;fr&nbsp;</a> |
@@ -24,8 +24,6 @@
<a href="../ko/howto/htaccess.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../pt-br/howto/htaccess.html" hreflang="pt-br" rel="alternate" title="Português (Brasil)">&nbsp;pt-br&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Les fichiers <code>.htaccess</code> fournissent une méthode pour
modifier la configuration du serveur au niveau de chaque répertoire.</p>
@@ -49,7 +47,7 @@ Includes - SSI)</a></li>
<div class="note">Les fichiers <code>.htaccess</code> ne doivent être utilisés
que si vous n'avez pas accès au fichier de configuration du serveur
principal. L'utilisation des fichiers <code>.htaccess</code>
- ralentit le fonctionnement de votre serveur Apache. Il est toujours
+ ralentit le fonctionnement de votre serveur HTTP Apache. Il est toujours
préférable de définir les directives que vous pouvez inclure dans un
fichier <code>.htaccess</code> dans une section <code class="directive"><a href="../mod/core.html#directory">Directory</a></code>, car elles produiront le
même effet avec de meilleures performances.</div>
@@ -161,20 +159,20 @@ Includes - SSI)</a></li>
<p>La première est liée aux performances. Lorsque la directive
<code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> est définie de
façon à autoriser l'utilisation des fichiers <code>.htaccess</code>,
- Apache va rechercher leur présence dans chaque répertoire. Ainsi,
+ httpd va rechercher leur présence dans chaque répertoire. Ainsi,
permettre l'utilisation des fichiers <code>.htaccess</code> est déjà
en soi une cause de dégradation des performances, que vous utilisiez
effectivement ces fichiers ou non ! De plus, le fichier
<code>.htaccess</code> est chargé en mémoire chaque fois qu'un
document fait l'objet d'une requête.</p>
- <p>Notez aussi qu'Apache doit rechercher les fichiers
+ <p>Notez aussi que httpd doit rechercher les fichiers
<code>.htaccess</code> dans tous les répertoires de niveau
supérieur, afin de rassembler toutes les directives qui s'appliquent
au répertoire courant (Voir la section <a href="#how">comment sont
appliquées les directives</a>). Ainsi, si un fichier fait l'objet
d'une requête à partir d'un répertoire
- <code>/www/htdocs/exemple</code>, Apache doit rechercher les
+ <code>/www/htdocs/exemple</code>, httpd doit rechercher les
fichiers suivants :</p>
<div class="example"><p><code>
@@ -433,7 +431,7 @@ Includes - SSI)</a></h2>
<p>Par contre, si vous obtenez des erreurs de serveur lorsque vous
tentez d'accéder à des documents, consultez votre journal des
- erreurs d'Apache. Il vous indiquera probablement que la directive
+ erreurs de httpd. Il vous indiquera probablement que la directive
utilisée dans votre fichier <code>.htaccess</code> n'est pas
permise.</p>
diff --git a/docs/manual/howto/htaccess.xml.meta b/docs/manual/howto/htaccess.xml.meta
index aba40c04ac..a962e7243c 100644
--- a/docs/manual/howto/htaccess.xml.meta
+++ b/docs/manual/howto/htaccess.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">pt-br</variant>
diff --git a/docs/manual/index.html.fr b/docs/manual/index.html.fr
index 5aee35ef93..e7023f6491 100644
--- a/docs/manual/index.html.fr
+++ b/docs/manual/index.html.fr
@@ -33,6 +33,8 @@
<a href="./tr/" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a> |
<a href="./zh-cn/" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div>
+<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
+ anglaise pour les changements récents.</div>
<form method="get" action="http://www.google.com/search"><p><input name="as_q" value="" type="text" /> <input value="Recherche Google" type="submit" /><input value="10" name="num" type="hidden" /><input value="fr" name="hl" type="hidden" /><input value="ISO-8859-1" name="ie" type="hidden" /><input value="Google Search" name="btnG" type="hidden" /><input name="as_epq" value="Version 2.5" type="hidden" /><input name="as_oq" value="" type="hidden" /><input name="as_eq" value="&quot;List-Post&quot;" type="hidden" /><input value="" name="lr" type="hidden" /><input value="i" name="as_ft" type="hidden" /><input value="" name="as_filetype" type="hidden" /><input value="all" name="as_qdr" type="hidden" /><input value="any" name="as_occt" type="hidden" /><input value="i" name="as_dt" type="hidden" /><input value="httpd.apache.org" name="as_sitesearch" type="hidden" /><input value="off" name="safe" type="hidden" /></p></form>
<table id="indextable"><tr><td class="col1"><div class="category"><h2><a name="release" id="release">Notes de version</a></h2>
<ul><li><a href="new_features_2_4.html">Nouvelles fonctionnalités dApache 2.3/2.4</a></li>
diff --git a/docs/manual/index.xml.da b/docs/manual/index.xml.da
index 0ca26cbe78..12079c6f74 100644
--- a/docs/manual/index.xml.da
+++ b/docs/manual/index.xml.da
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
-<!-- English Revision: 1221670:1328365 (outdated) -->
+<!-- English Revision: 1221670:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.de b/docs/manual/index.xml.de
index cba40b28e0..c746cd8f53 100644
--- a/docs/manual/index.xml.de
+++ b/docs/manual/index.xml.de
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.de.xsl"?>
-<!-- English Revision: 1050960:1328365 (outdated) -->
+<!-- English Revision: 1050960:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.es b/docs/manual/index.xml.es
index 73ca94ea91..9cde0fcdd5 100644
--- a/docs/manual/index.xml.es
+++ b/docs/manual/index.xml.es
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.es.xsl"?>
-<!-- English Revision: 105989:1328365 (outdated) -->
+<!-- English Revision: 105989:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.fr b/docs/manual/index.xml.fr
index 2a45c8e26a..a139b93cd4 100644
--- a/docs/manual/index.xml.fr
+++ b/docs/manual/index.xml.fr
@@ -3,7 +3,7 @@
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
-<!-- English Revision : 1328365 -->
+<!-- English Revision: 1328365:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.ja b/docs/manual/index.xml.ja
index 2f86d89c96..9f1e9f79c1 100644
--- a/docs/manual/index.xml.ja
+++ b/docs/manual/index.xml.ja
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.ja.xsl"?>
-<!-- English Revision: 636028:1328365 (outdated) -->
+<!-- English Revision: 636028:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.ko b/docs/manual/index.xml.ko
index 55b9fb9a9b..37495dcfc7 100644
--- a/docs/manual/index.xml.ko
+++ b/docs/manual/index.xml.ko
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.ko.xsl"?>
-<!-- English Revision: 105989:1328365 (outdated) -->
+<!-- English Revision: 105989:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.meta b/docs/manual/index.xml.meta
index 4e2ec6f7e3..b95c36601f 100644
--- a/docs/manual/index.xml.meta
+++ b/docs/manual/index.xml.meta
@@ -11,7 +11,7 @@
<variant outdated="yes">de</variant>
<variant>en</variant>
<variant outdated="yes">es</variant>
- <variant>fr</variant>
+ <variant outdated="yes">fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">pt-br</variant>
diff --git a/docs/manual/index.xml.pt-br b/docs/manual/index.xml.pt-br
index 4246bd1be3..f241f4196c 100644
--- a/docs/manual/index.xml.pt-br
+++ b/docs/manual/index.xml.pt-br
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.pt-br.xsl"?>
-<!-- English Revision: 420993:1328365 (outdated) -->
+<!-- English Revision: 420993:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.tr b/docs/manual/index.xml.tr
index b22b33a426..8c87228a4d 100644
--- a/docs/manual/index.xml.tr
+++ b/docs/manual/index.xml.tr
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.tr.xsl"?>
-<!-- English Revision: 1221670:1328365 (outdated) -->
+<!-- English Revision: 1221670:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/index.xml.zh-cn b/docs/manual/index.xml.zh-cn
index 99774c2a07..5c09484679 100644
--- a/docs/manual/index.xml.zh-cn
+++ b/docs/manual/index.xml.zh-cn
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE indexpage SYSTEM "./style/sitemap.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.zh-cn.xsl"?>
-<!-- English Revision: 1050960:1328365 (outdated) -->
+<!-- English Revision: 1050960:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/install.html.tr.utf8 b/docs/manual/install.html.tr.utf8
index eb216a3b99..a55b6052f5 100644
--- a/docs/manual/install.html.tr.utf8
+++ b/docs/manual/install.html.tr.utf8
@@ -26,6 +26,7 @@
<a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="./tr/install.html" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
+<div class="outofdate">Bu çeviri güncel olmayabilir. Son değişiklikler için İngilizce sürüm geçerlidir.</div>
<p>Bu belge Apache HTTP Sunucusunun sadece Unix ve Unix benzeri
diff --git a/docs/manual/install.xml.meta b/docs/manual/install.xml.meta
index de3fcaf615..6a8403bc30 100644
--- a/docs/manual/install.xml.meta
+++ b/docs/manual/install.xml.meta
@@ -10,7 +10,7 @@
<variant outdated="yes">de</variant>
<variant>en</variant>
<variant outdated="yes">es</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/misc/perf-tuning.html.fr b/docs/manual/misc/perf-tuning.html.fr
index ee4c06ac38..7fd66786d5 100644
--- a/docs/manual/misc/perf-tuning.html.fr
+++ b/docs/manual/misc/perf-tuning.html.fr
@@ -23,8 +23,6 @@
<a href="../ko/misc/perf-tuning.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/misc/perf-tuning.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Apache 2.x est un serveur web à usage général, conçu dans un but
diff --git a/docs/manual/misc/perf-tuning.xml.meta b/docs/manual/misc/perf-tuning.xml.meta
index ebbf5c2492..a4ba1984eb 100644
--- a/docs/manual/misc/perf-tuning.xml.meta
+++ b/docs/manual/misc/perf-tuning.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
</variants>
diff --git a/docs/manual/mod/event.xml.fr b/docs/manual/mod/event.xml.fr
index 856bf8903f..38f1dbda6d 100644
--- a/docs/manual/mod/event.xml.fr
+++ b/docs/manual/mod/event.xml.fr
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision : 1228296 -->
+<!-- English Revision: 1228296:1328296 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
diff --git a/docs/manual/mod/mod_alias.html.fr b/docs/manual/mod/mod_alias.html.fr
index c9fe4cc77a..830a21a0b1 100644
--- a/docs/manual/mod/mod_alias.html.fr
+++ b/docs/manual/mod/mod_alias.html.fr
@@ -27,8 +27,6 @@
<a href="../ko/mod/mod_alias.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/mod/mod_alias.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Permet d'atteindre différentes parties du système de
fichiers depuis l'arborescence des documents du site web, ainsi que la
redirection d'URL</td></tr>
diff --git a/docs/manual/mod/mod_alias.xml.meta b/docs/manual/mod/mod_alias.xml.meta
index d83657f9fa..547a2db773 100644
--- a/docs/manual/mod/mod_alias.xml.meta
+++ b/docs/manual/mod/mod_alias.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/mod/mod_dir.html.fr b/docs/manual/mod/mod_dir.html.fr
index 28c544beca..fe3240d212 100644
--- a/docs/manual/mod/mod_dir.html.fr
+++ b/docs/manual/mod/mod_dir.html.fr
@@ -27,8 +27,6 @@
<a href="../ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Permet la redirection des adresses se terminant par un
répertoire sans slash de fin et la mise à disposition des fichiers index
de répertoire</td></tr>
diff --git a/docs/manual/mod/mod_dir.xml.meta b/docs/manual/mod/mod_dir.xml.meta
index 0fa52ec5c8..e8a3ce0549 100644
--- a/docs/manual/mod/mod_dir.xml.meta
+++ b/docs/manual/mod/mod_dir.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
diff --git a/docs/manual/mod/mod_remoteip.html.fr b/docs/manual/mod/mod_remoteip.html.fr
index fd768c15ae..96d2d22e52 100644
--- a/docs/manual/mod/mod_remoteip.html.fr
+++ b/docs/manual/mod/mod_remoteip.html.fr
@@ -24,8 +24,6 @@
<p><span>Langues Disponibles: </span><a href="../en/mod/mod_remoteip.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_remoteip.html" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Remplace l'adresse IP et le nom d'hôte apparents du client
pour la requête par l'adresse IP présentée par un mandataire ou un
répartiteur de charge via les en-têtes de la requête.
diff --git a/docs/manual/mod/mod_remoteip.xml.meta b/docs/manual/mod/mod_remoteip.xml.meta
index 771852e80c..1a7c78a9f1 100644
--- a/docs/manual/mod/mod_remoteip.xml.meta
+++ b/docs/manual/mod/mod_remoteip.xml.meta
@@ -8,6 +8,6 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
</variants>
</metafile>
diff --git a/docs/manual/mod/mod_rewrite.html.fr b/docs/manual/mod/mod_rewrite.html.fr
index fff6803057..20b3016ad2 100644
--- a/docs/manual/mod/mod_rewrite.html.fr
+++ b/docs/manual/mod/mod_rewrite.html.fr
@@ -24,8 +24,6 @@
<p><span>Langues Disponibles: </span><a href="../en/mod/mod_rewrite.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_rewrite.html" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Ce module fournit un moteur de réécriture à base de
règles permettant de réécrire les URLs des requêtes
à la volée</td></tr>
@@ -979,9 +977,12 @@ la version version 2.1</td></tr>
<a id="regexp" name="regexp">expression rationnelle</a>
compatible perl. Dans la première règle de réécriture,
l'expression est comparée au (%-decoded)
- <a href="./directive-dict.html#Syntax">chemin de l'URL</a> de la
- requête ; les expressions suivantes sont comparées à la sortie de
- la dernière règle de réécriture qui a été appliquée.</p>
+ <a href="./directive-dict.html#Syntax">chemin de l'URL</a> (ou au
+ <a href="./directive-dict.html#Syntax">chemin fichier</a>, en
+ fonction du contexte) de la
+ requête. Les expressions suivantes sont comparées à la sortie de
+ la dernière règle de réécriture qui
+ correspondait.</p>
<div class="note"><h3><a id="what_is_matched" name="what_is_matched">Qu'est-ce qui est comparé ?</a></h3>
@@ -993,7 +994,7 @@ la version version 2.1</td></tr>
<p>Dans les contextes de répertoire <code class="directive"><a href="../mod/core.html#directory">Directory</a></code> et htaccess, le
<em>modèle</em> est tout d'abord comparé au chemin du <em>système
de fichiers</em>, après suppression du préfixe ou chemin de base
- ayant conduit à la règle <code class="directive">RewriteRule</code> (par
+ ayant conduit le serveur vers la règle <code class="directive">RewriteRule</code> (par
exemple "app1/index.html" ou
"index.html" selon l'endroit où les directives sont définies).</p>
@@ -1157,7 +1158,7 @@ substitution !
<p>Chaque règle de réécriture s'applique au résultat de la règle
précédente, selon l'ordre dans lequel elles ont été définies dans
- le fichier de configuration. L'URI du chemin du fichier (voir
+ le fichier de configuration. Le chemin de l'URL ou du système de fichier (voir
ci-dessus <a href="#what_is_matched">Qu'est-ce qui est
comparé ?</a>) est <strong>intégralement
remplacée</strong> par la chaîne de <em>Substitution</em> et le
diff --git a/docs/manual/mod/mod_rewrite.xml.meta b/docs/manual/mod/mod_rewrite.xml.meta
index 0be21e86f4..decc0a7b1e 100644
--- a/docs/manual/mod/mod_rewrite.xml.meta
+++ b/docs/manual/mod/mod_rewrite.xml.meta
@@ -8,6 +8,6 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
</variants>
</metafile>
diff --git a/docs/manual/platform/index.xml.ko b/docs/manual/platform/index.xml.ko
index cc2739e916..a51feff7a3 100644
--- a/docs/manual/platform/index.xml.ko
+++ b/docs/manual/platform/index.xml.ko
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
-<!-- English Revision: 420990:1220524 (outdated) -->
+<!-- English Revision: 420990:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/platform/index.xml.zh-cn b/docs/manual/platform/index.xml.zh-cn
index c5009ac8b6..10242c11a8 100644
--- a/docs/manual/platform/index.xml.zh-cn
+++ b/docs/manual/platform/index.xml.zh-cn
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.zh-cn.xsl"?>
-<!-- English Revision: 420990:1220524 (outdated) -->
+<!-- English Revision: 420990:1329361 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/docs/manual/rewrite/index.html.fr b/docs/manual/rewrite/index.html.fr
index d11164a59d..f75a1edf59 100644
--- a/docs/manual/rewrite/index.html.fr
+++ b/docs/manual/rewrite/index.html.fr
@@ -23,8 +23,6 @@
<a href="../tr/rewrite/" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a> |
<a href="../zh-cn/rewrite/" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> permet de modifier les requêtes
diff --git a/docs/manual/rewrite/index.xml.meta b/docs/manual/rewrite/index.xml.meta
index 96567025f0..25046eafe9 100644
--- a/docs/manual/rewrite/index.xml.meta
+++ b/docs/manual/rewrite/index.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">tr</variant>
<variant outdated="yes">zh-cn</variant>
</variants>
diff --git a/docs/manual/rewrite/intro.html.fr b/docs/manual/rewrite/intro.html.fr
index 0090504d23..ae011c702f 100644
--- a/docs/manual/rewrite/intro.html.fr
+++ b/docs/manual/rewrite/intro.html.fr
@@ -21,8 +21,6 @@
<p><span>Langues Disponibles: </span><a href="../en/rewrite/intro.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/rewrite/intro.html" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Ce document est un complément à la <a href="../mod/mod_rewrite.html">documentation de référence</a> du module
<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. Il décrit les concepts de base dont la
@@ -157,16 +155,22 @@ arrières dans les expressions rationnelles</a></h3>
sont créées en interne et peuvent être rappelées via les chaînes
<code>$N</code> et <code>%N</code> (voir ci-dessous). Ces
références sont disponibles lors de la création des chaînes de
- <em>Substitution</em> et des <em>Chaînes de test</em>. La
- figure 1
+ <em>Substitution</em> et des <em>Chaînes de test</em> comme
+ précisé dans les chapitres suivants. La figure 1
montre à quels endroits les références arrières sont suceptibles
d'être développées, et illustre le flux des comparaisons
- effectuées par les règles RewriteRule et RewriteCond.</p>
+ effectuées par les règles RewriteRule et
+ RewriteCond. Dans les chapitres suivants, nous examinerons comment
+ utiliser ces références arrières, donc ne vous affolez pas si
+ elles vous paraissent un peu exotiques au premier abord.</p>
<p class="figure">
- <img src="../images/rewrite_rule_flow.png" alt="Flux des comparaisons effectuées par les règles RewriteRule et RewriteCond" /><br />
+ <img src="../images/rewrite_backreferences.png" alt="Flux des comparaisons effectuées par les règles RewriteRule et RewriteCond" /><br />
<dfn>Figure 1 :</dfn> Le cheminement d'une référence arrière à
- travers une règle.
+ travers une règle.<br />
+ Dans cet exemple, une requête pour <code>/test/1234</code> serait
+ transformée en
+ <code>/admin.foo?page=test&amp;id=1234&amp;host=admin.example.com</code>.
</p>
@@ -186,7 +190,9 @@ transformée;</li>
<p>Le <var>Modèle</var> est toujours une <a href="#regex">expression
rationnelle</a> comparée au chemin de l'URL de la requête entrante (la
partie située après le nom d'hôte mais avant tout point d'interrogation
-qui indique le début d'une chaîne de requête).</p>
+qui indique le début d'une chaîne de paramètres de
+requête) ou, dans un contexte de répertoire, au chemin de la
+requête relativement au répertoire pour lequel la règle est définie..</p>
<p class="figure">
<img src="../images/syntax_rewriterule.png" alt="Syntaxe de la directive RewriteRule" /><br />
diff --git a/docs/manual/rewrite/intro.xml.meta b/docs/manual/rewrite/intro.xml.meta
index ce245b2841..5aaac0fc86 100644
--- a/docs/manual/rewrite/intro.xml.meta
+++ b/docs/manual/rewrite/intro.xml.meta
@@ -8,6 +8,6 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
</variants>
</metafile>
diff --git a/docs/manual/ssl/index.html.fr b/docs/manual/ssl/index.html.fr
index 3f63cdb517..6a8bd882fc 100644
--- a/docs/manual/ssl/index.html.fr
+++ b/docs/manual/ssl/index.html.fr
@@ -24,15 +24,12 @@
<a href="../tr/ssl/" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a> |
<a href="../zh-cn/ssl/" hreflang="zh-cn" rel="alternate" title="Simplified Chinese">&nbsp;zh-cn&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Le module <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> du serveur HTTP Apache fournit une
interface avec la bibliothèque <a href="http://www.openssl.org/">OpenSSL</a>, qui permet d'effectuer un
chiffrement fort en s'appuyant sur les protocoles "Couche Points d'accès
Sécurisés" (Secure Sockets Layer - SSL) et "Sécurité de la Couche Transport"
-(Transport Layer Security - TLS). Le module et cette documentation sont basés
-sur le projet mod_ssl de Ralf S. Engelschall.</p>
+(Transport Layer Security - TLS).</p>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#documentation">Documentation</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#mod-ssl">mod_ssl</a></li>
diff --git a/docs/manual/ssl/index.xml.meta b/docs/manual/ssl/index.xml.meta
index 0068db9785..044b92b1da 100644
--- a/docs/manual/ssl/index.xml.meta
+++ b/docs/manual/ssl/index.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">tr</variant>
<variant outdated="yes">zh-cn</variant>
diff --git a/docs/manual/ssl/ssl_faq.xml.meta b/docs/manual/ssl/ssl_faq.xml.meta
index a5d5a97804..61db826966 100644
--- a/docs/manual/ssl/ssl_faq.xml.meta
+++ b/docs/manual/ssl/ssl_faq.xml.meta
@@ -8,6 +8,6 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
</variants>
</metafile>
diff --git a/docs/manual/ssl/ssl_howto.html.fr b/docs/manual/ssl/ssl_howto.html.fr
index e3e178251a..62e0213ce4 100644
--- a/docs/manual/ssl/ssl_howto.html.fr
+++ b/docs/manual/ssl/ssl_howto.html.fr
@@ -21,8 +21,6 @@
<p><span>Langues Disponibles: </span><a href="../en/ssl/ssl_howto.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/ssl/ssl_howto.html" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
<p>Ce document doit vous permettre de démarrer et de faire fonctionner
diff --git a/docs/manual/ssl/ssl_howto.xml.meta b/docs/manual/ssl/ssl_howto.xml.meta
index 8d9a5237f4..b7c021fd9a 100644
--- a/docs/manual/ssl/ssl_howto.xml.meta
+++ b/docs/manual/ssl/ssl_howto.xml.meta
@@ -8,6 +8,6 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
</variants>
</metafile>
diff --git a/docs/manual/ssl/ssl_intro.html.fr b/docs/manual/ssl/ssl_intro.html.fr
index 4899b8ed4b..471daa3413 100644
--- a/docs/manual/ssl/ssl_intro.html.fr
+++ b/docs/manual/ssl/ssl_intro.html.fr
@@ -22,8 +22,7 @@
<a href="../fr/ssl/ssl_intro.html" title="Français">&nbsp;fr&nbsp;</a> |
<a href="../ja/ssl/ssl_intro.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div>
-<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
- anglaise pour les changements récents.</div>
+
<p>Ce chapitre en guise d'introduction est destiné aux lecteurs pour lesquels
le Web, HTTP et Apache sont familiers, mais ne sont pas des experts en matière
@@ -34,6 +33,7 @@ brevets ou des restrictions d'importation ou d'exportation. Il se veut plutôt
une base de travail pour les utilisateurs de <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> en
rassemblant différents concepts, définitions et exemples comme point de départ
pour une exploration plus détaillée.</p>
+
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#cryptographictech">Techniques de chiffrement</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#certificates">Certificats</a></li>
@@ -257,7 +257,7 @@ on utilise les certificats à des fins d'authentification.</p>
<code>*.snakeoil.com</code>.</p>
<p>Le format binaire d'un certificat est défini en utilisant la
- notation ASN.1 [<a href="#X208">X208</a>] [<a href="#PKCS">PKCS</a>].
+ notation ASN.1 [<a href="#ASN1">ASN1</a>] [<a href="#PKCS">PKCS</a>].
Cette notation definit la manière de spécifier les contenus, et les règles
d'encodage définissent la manière dont ces information sont converties au
format binaire. L'encodage binaire du certificat est défini par les Règles
@@ -408,7 +408,7 @@ l'établissement de la session protocolaire.</p>
<th>Description</th>
<th>Navigateurs supportés</th></tr>
<tr><td>SSL v2.0</td>
- <td>Standard du fournisseur (de Netscape Corp.) [<a href="#SSL2">SSL2</a>]</td>
+ <td>Standard du fournisseur (de Netscape Corp.)</td>
<td>Premier protocole SSL pour lequel il existe des implémentations</td>
<td>- NS Navigator 1.x/2.x<br />
- MS IE 3.x<br />
@@ -427,6 +427,17 @@ l'établissement de la session protocolaire.</p>
ajout du bourrage de bloc pour le chiffrement de bloc, standardisation
de l'ordonnancement des messages et plus de messages d'alerte.</td>
<td>- Lynx/2.8+OpenSSL</td></tr>
+ <tr><td>TLS v1.1</td>
+ <td>Standard proposé pour l'Internet (de l'IETF) [<a href="#TLS11">TLS11</a>]</td>
+ <td>Mise à jour de TLS 1.0 pour la protection contre les
+ attaques de type Cipher block chaining (CBC).</td>
+ <td>-</td></tr>
+ <tr><td>TLS v1.2</td>
+ <td>Standard proposé pour l'Internet (de l'IETF) [<a href="#TLS12">TLS12</a>]</td>
+ <td>Mise à jour de TLS 1.2 rendant les condensés MD5 obsolètes,
+ et introduisant une incompatibilité avec SSL ce qui interdit toute
+ négociation en vue d'une utilisation de SSLv2.</td>
+ <td>-</td></tr>
</table>
@@ -648,14 +659,14 @@ l'Internet Engineering Task Force (IETF).</p>
1996. Voir <a href="http://www.counterpane.com/">http://www.counterpane.com/</a> pour diverses autres productions de Bruce
Schneier.</dd>
-<dt><a id="X208" name="X208">[X208]</a></dt>
+<dt><a id="ASN1" name="ASN1">[ASN1]</a></dt>
<dd>ITU-T Recommendation X.208, <q>Specification of Abstract Syntax Notation
-One (ASN.1)</q>, 1988. Voir par exemple <a href="http://www.itu.int/rec/recommendation.asp?type=items&amp;lang=e&amp;parent=T-REC-X.208-198811-I">http://www.itu.int/rec/recommendation.asp?type=items&amp;lang=e&amp;parent=T-REC-X.208-198811-I</a>.
+One (ASN.1)</q>, dernière mise à jour en 2008. Voir <a href="http://www.itu.int/ITU-T/asn1/">http://www.itu.int/ITU-T/asn1/</a>.
</dd>
<dt><a id="X509" name="X509">[X509]</a></dt>
<dd>ITU-T Recommendation X.509, <q>The Directory - Authentication
-Framework</q>. Voir par exemple <a href="http://www.itu.int/rec/recommendation.asp?type=folders&amp;lang=e&amp;parent=T-REC-X.509">http://www.itu.int/rec/recommendation.asp?type=folders&amp;lang=e&amp;parent=T-REC-X.509</a>.
+Framework</q>. A titre de référence, voir <a href="http://en.wikipedia.org/wiki/X.509">http://en.wikipedia.org/wiki/X.509</a>.
</dd>
<dt><a id="PKCS" name="PKCS">[PKCS]</a></dt>
@@ -665,10 +676,7 @@ RSA Laboratories Technical Notes, Voir <a href="http://www.rsasecurity.com/rsala
<dt><a id="MIME" name="MIME">[MIME]</a></dt>
<dd>N. Freed, N. Borenstein, <q>Multipurpose Internet Mail Extensions
(MIME) Part One: Format of Internet Message Bodies</q>, RFC2045.
-Voir par exemple <a href="http://ietf.org/rfc/rfc2045.txt">http://ietf.org/rfc/rfc2045.txt</a>.</dd>
-
-<dt><a id="SSL2" name="SSL2">[SSL2]</a></dt>
-<dd>Kipp E.B. Hickman, <q>The SSL Protocol</q>, 1995. See <a href="http://www.netscape.com/eng/security/SSL_2.html">http://www.netscape.com/eng/security/SSL_2.html</a>.</dd>
+Voir par exemple <a href="http://tools.ietf.org/html/rfc2045">http://tools.ietf.org/html/rfc2045</a>.</dd>
<dt><a id="SSL3" name="SSL3">[SSL3]</a></dt>
<dd>Alan O. Freier, Philip Karlton, Paul C. Kocher, <q>The SSL Protocol
@@ -677,6 +685,14 @@ Version 3.0</q>, 1996. Voir <a href="http://www.netscape.com/eng/ssl3/draft302.t
<dt><a id="TLS1" name="TLS1">[TLS1]</a></dt>
<dd>Tim Dierks, Christopher Allen, <q>The TLS Protocol Version 1.0</q>,
1999. Voir <a href="http://ietf.org/rfc/rfc2246.txt">http://ietf.org/rfc/rfc2246.txt</a>.</dd>
+
+<dt><a id="TLS11" name="TLS11">[TLS11]</a></dt>
+<dd><q>Le protocole TLS Version 1.1</q>,
+2006. Voir <a href="http://tools.ietf.org/html/rfc4346">http://tools.ietf.org/html/rfc4346</a>.</dd>
+
+<dt><a id="TLS12" name="TLS12">[TLS12]</a></dt>
+<dd><q>Le protocole TLS Version 1.2</q>,
+2008. Voir <a href="http://tools.ietf.org/html/rfc5246">http://tools.ietf.org/html/rfc5246</a>.</dd>
</dl>
</div></div>
<div class="bottomlang">
diff --git a/docs/manual/ssl/ssl_intro.xml.meta b/docs/manual/ssl/ssl_intro.xml.meta
index d48cebe39b..0b07b4b091 100644
--- a/docs/manual/ssl/ssl_intro.xml.meta
+++ b/docs/manual/ssl/ssl_intro.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
</variants>
</metafile>
diff --git a/docs/manual/suexec.html.tr.utf8 b/docs/manual/suexec.html.tr.utf8
index 6c0022d3d8..c76ea1f82e 100644
--- a/docs/manual/suexec.html.tr.utf8
+++ b/docs/manual/suexec.html.tr.utf8
@@ -24,6 +24,7 @@
<a href="./ko/suexec.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="./tr/suexec.html" title="Türkçe">&nbsp;tr&nbsp;</a></p>
</div>
+<div class="outofdate">Bu çeviri güncel olmayabilir. Son değişiklikler için İngilizce sürüm geçerlidir.</div>
<p><strong>SuEXEC</strong> özelliği, Apache HTTP Sunucusu kullanıcılarına
<strong>CGI</strong> ve <strong>SSI</strong> programlarını sunucunun
diff --git a/docs/manual/suexec.xml.meta b/docs/manual/suexec.xml.meta
index 57a8173940..3b7b1e8915 100644
--- a/docs/manual/suexec.xml.meta
+++ b/docs/manual/suexec.xml.meta
@@ -8,7 +8,7 @@
<variants>
<variant>en</variant>
- <variant outdated="yes">fr</variant>
+ <variant>fr</variant>
<variant outdated="yes">ja</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>