switch to a 60 bit hash
[httpd-crcsyncproxy.git] / docs / manual / mod / mod_version.xml
blob1e8ae427b2e7424595eb6abf640cea043f42904a
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
14      http://www.apache.org/licenses/LICENSE-2.0
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
23 <modulesynopsis metafile="mod_version.xml.meta">
24 <name>mod_version</name>
25 <description>Version dependent configuration</description>
26 <status>Extension</status>
27 <sourcefile>mod_version.c</sourcefile>
28 <identifier>version_module</identifier>
29 <compatibility>Available in version 2.0.56 and later</compatibility>
31 <summary>
32     <p>This module is designed for the use in test suites and large
33     networks which have to deal with different httpd versions and
34     different configurations. It provides a new container -- <directive
35     type="section" module="mod_version">IfVersion</directive>, which
36     allows a flexible version checking including numeric comparisons and
37     regular expressions.</p>
39     <example><title>Examples</title>
40       &lt;IfVersion 2.1.0&gt;<br />
41       <indent>
42         # current httpd version is exactly 2.1.0<br />
43       </indent>
44       &lt;/IfVersion&gt;<br />
45       <br />
46       &lt;IfVersion >= 2.2&gt;<br />
47       <indent>
48         # use really new features :-)<br />
49       </indent>
50       &lt;/IfVersion&gt;
51     </example>
53     <p>See below for further possibilities.</p>
54 </summary>
56 <directivesynopsis type="section">
57 <name>IfVersion</name>
58 <description>contains version dependent configuration</description>
59 <syntax>&lt;IfVersion [[!]<var>operator</var>] <var>version</var>&gt; ...
60 &lt;/IfVersion&gt;</syntax>
61 <contextlist><context>server config</context><context>virtual host</context>
62 <context>directory</context><context>.htaccess</context></contextlist>
63 <override>All</override>
65 <usage>
66     <p>The <directive type="section">IfVersion</directive> section encloses
67     configuration directives which are executed only if the
68     <program>httpd</program> version
69     matches the desired criteria. For normal (numeric) comparisons the
70     <var>version</var> argument has the format
71     <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
72     <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
73     <var>patch</var> are optional. If these numbers are omitted, they are
74     assumed to be zero. The following numerical <var>operator</var>s are
75     possible:</p>
77     <table style="zebra" border="1">
78     <tr><th><var>operator</var></th><th>description</th></tr>
79     <tr><td><code>=</code> or <code>==</code></td>
80         <td>httpd version is equal</td></tr>
81     <tr><td><code>&gt;</code></td>
82         <td>httpd version is greater than</td></tr>
83     <tr><td><code>&gt;=</code></td>
84         <td>httpd version is greater or equal</td></tr>
85     <tr><td><code>&lt;</code></td>
86         <td>httpd version is less than</td></tr>
87     <tr><td><code>&lt;=</code></td>
88         <td>httpd version is less or equal</td></tr>
89     </table>
91     <example><title>Example</title>
92       &lt;IfVersion >= 2.1&gt;<br />
93       <indent>
94         # this happens only in versions greater or<br />
95         # equal 2.1.0.<br />
96       </indent>
97       &lt;/IfVersion&gt;
98     </example>
100     <p>Besides the numerical comparison it is possible to match a 
101     <glossary ref="regex">regular expression</glossary> 
102     against the httpd version. There are two ways to write it:</p>
104     <table style="zebra" border="1">
105     <tr><th><var>operator</var></th><th>description</th></tr>
106     <tr><td><code>=</code> or <code>==</code></td>
107         <td><var>version</var> has the form
108             <code>/<var>regex</var>/</code></td></tr>
109     <tr><td><code>~</code></td>
110         <td><var>version</var> has the form
111             <code><var>regex</var></code></td></tr>
112     </table>
114     <example><title>Example</title>
115       &lt;IfVersion = /^2.1.[01234]$/&gt;<br />
116       <indent>
117         # e.g. workaround for buggy versions
118       </indent>
119       &lt;/IfVersion&gt;
120     </example>
122     <p>In order to reverse the meaning, all operators can be preceded by an
123     exclamation mark (<code>!</code>):</p>
125     <example>
126       &lt;IfVersion !~ ^2.1.[01234]$&gt;<br />
127       <indent>
128         # not for those versions<br />
129       </indent>
130       &lt;/IfVersion&gt;
131     </example>
133     <p>If the <var>operator</var> is omitted, it is assumed to be
134     <code>=</code>.</p>
135 </usage>
136 </directivesynopsis>
138 </modulesynopsis>