]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_version.xml
Merge in APR[-util] macros from branches/trunk-buildconf-noapr
[apache] / docs / manual / mod / mod_version.xml
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$ -->
5
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
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
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 -->
22
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
30 <summary>
31     <p>This module is designed for the use in test suites and large
32     networks which have to deal with different httpd versions and
33     different configurations. It provides a new container -- <directive
34     type="section" module="mod_version">IfVersion</directive>, which
35     allows a flexible version checking including numeric comparisons and
36     regular expressions.</p>
37
38     <example><title>Examples</title>
39     <highlight language="config">
40 &lt;IfVersion 2.4.2&gt;
41     # current httpd version is exactly 2.4.2
42 &lt;/IfVersion&gt;
43
44 &lt;IfVersion >= 2.5&gt;
45     # use really new features :-)
46 &lt;/IfVersion&gt;
47       </highlight>
48     </example>
49
50     <p>See below for further possibilities.</p>
51 </summary>
52
53 <directivesynopsis type="section">
54 <name>IfVersion</name>
55 <description>contains version dependent configuration</description>
56 <syntax>&lt;IfVersion [[!]<var>operator</var>] <var>version</var>&gt; ...
57 &lt;/IfVersion&gt;</syntax>
58 <contextlist><context>server config</context><context>virtual host</context>
59 <context>directory</context><context>.htaccess</context></contextlist>
60 <override>All</override>
61
62 <usage>
63     <p>The <directive type="section">IfVersion</directive> section encloses
64     configuration directives which are executed only if the
65     <program>httpd</program> version
66     matches the desired criteria. For normal (numeric) comparisons the
67     <var>version</var> argument has the format
68     <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
69     <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
70     <var>patch</var> are optional. If these numbers are omitted, they are
71     assumed to be zero. The following numerical <var>operator</var>s are
72     possible:</p>
73
74     <table style="zebra" border="1">
75     <tr><th><var>operator</var></th><th>description</th></tr>
76     <tr><td><code>=</code> or <code>==</code></td>
77         <td>httpd version is equal</td></tr>
78     <tr><td><code>&gt;</code></td>
79         <td>httpd version is greater than</td></tr>
80     <tr><td><code>&gt;=</code></td>
81         <td>httpd version is greater or equal</td></tr>
82     <tr><td><code>&lt;</code></td>
83         <td>httpd version is less than</td></tr>
84     <tr><td><code>&lt;=</code></td>
85         <td>httpd version is less or equal</td></tr>
86     </table>
87
88     <example><title>Example</title>
89     <highlight language="config">
90 &lt;IfVersion >= 2.3&gt;
91     # this happens only in versions greater or
92     # equal 2.3.0.
93 &lt;/IfVersion&gt;
94       </highlight>
95     </example>
96
97     <p>Besides the numerical comparison it is possible to match a
98     <glossary ref="regex">regular expression</glossary>
99     against the httpd version. There are two ways to write it:</p>
100
101     <table style="zebra" border="1">
102     <tr><th><var>operator</var></th><th>description</th></tr>
103     <tr><td><code>=</code> or <code>==</code></td>
104         <td><var>version</var> has the form
105             <code>/<var>regex</var>/</code></td></tr>
106     <tr><td><code>~</code></td>
107         <td><var>version</var> has the form
108             <code><var>regex</var></code></td></tr>
109     </table>
110
111     <example><title>Example</title>
112     <highlight language="config">
113 &lt;IfVersion = /^2.4.[01234]$/&gt;
114     # e.g. workaround for buggy versions
115 &lt;/IfVersion&gt;
116       </highlight>
117     </example>
118
119     <p>In order to reverse the meaning, all operators can be preceded by an
120     exclamation mark (<code>!</code>):</p>
121
122     <highlight language="config">
123 &lt;IfVersion !~ ^2.4.[01234]$&gt;
124     # not for those versions
125 &lt;/IfVersion&gt;
126     </highlight>
127
128     <p>If the <var>operator</var> is omitted, it is assumed to be
129     <code>=</code>.</p>
130 </usage>
131 </directivesynopsis>
132
133 </modulesynopsis>