summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_version.xml
blob: ab378586725d81d5e8f4070dab19f108ce0f5b24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Copyright 2004-2006 The Apache Software Foundation or its licensors, as
 applicable.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_version.xml.meta">
<name>mod_version</name>
<description>Version dependent configuration</description>
<status>Extension</status>
<sourcefile>mod_version.c</sourcefile>
<identifier>version_module</identifier>
<compatibility>Available in version 2.0.56 and later</compatibility>

<summary>
    <p>This module is designed for the use in test suites and large
    networks which have to deal with different httpd versions and
    different configurations. It provides a new container -- <directive
    type="section" module="mod_version">IfVersion</directive>, which
    allows a flexible version checking including numeric comparisons and
    regular expressions.</p>

    <example><title>Examples</title>
      &lt;IfVersion 2.1.0&gt;<br />
      <indent>
        # current httpd version is exactly 2.1.0<br />
      </indent>
      &lt;/IfVersion&gt;<br />
      <br />
      &lt;IfVersion >= 2.2&gt;<br />
      <indent>
        # use really new features :-)<br />
      </indent>
      &lt;/IfVersion&gt;
    </example>

    <p>See below for further possibilities.</p>
</summary>

<directivesynopsis type="section">
<name>IfVersion</name>
<description>contains version dependent configuration</description>
<syntax>&lt;IfVersion [[!]<var>operator</var>] <var>version</var>&gt; ...
&lt;/IfVersion&gt;</syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>All</override>

<usage>
    <p>The <directive type="section">IfVersion</directive> section encloses
    configuration directives which are executed only if the
    <program>httpd</program> version
    matches the desired criteria. For normal (numeric) comparisons the
    <var>version</var> argument has the format
    <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
    <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
    <var>patch</var> are optional. If these numbers are omitted, they are
    assumed to be zero. The following numerical <var>operator</var>s are
    possible:</p>

    <table style="zebra" border="1">
    <tr><th><var>operator</var></th><th>description</th></tr>
    <tr><td><code>=</code> or <code>==</code></td>
        <td>httpd version is equal</td></tr>
    <tr><td><code>&gt;</code></td>
        <td>httpd version is greater than</td></tr>
    <tr><td><code>&gt;=</code></td>
        <td>httpd version is greater or equal</td></tr>
    <tr><td><code>&lt;</code></td>
        <td>httpd version is less than</td></tr>
    <tr><td><code>&lt;=</code></td>
        <td>httpd version is less or equal</td></tr>
    </table>

    <example><title>Example</title>
      &lt;IfVersion >= 2.1&gt;<br />
      <indent>
        # this happens only in versions greater or<br />
        # equal 2.1.0.<br />
      </indent>
      &lt;/IfVersion&gt;
    </example>

    <p>Besides the numerical comparison it is possible to match a 
    <glossary ref="regex">regular expression</glossary> 
    against the httpd version. There are two ways to write it:</p>

    <table style="zebra" border="1">
    <tr><th><var>operator</var></th><th>description</th></tr>
    <tr><td><code>=</code> or <code>==</code></td>
        <td><var>version</var> has the form
            <code>/<var>regex</var>/</code></td></tr>
    <tr><td><code>~</code></td>
        <td><var>version</var> has the form
            <code><var>regex</var></code></td></tr>
    </table>

    <example><title>Example</title>
      &lt;IfVersion = /^2.1.[01234]$/&gt;<br />
      <indent>
        # e.g. workaround for buggy versions
      </indent>
      &lt;/IfVersion&gt;
    </example>

    <p>In order to reverse the meaning, all operators can be preceded by an
    exclamation mark (<code>!</code>):</p>

    <example>
      &lt;IfVersion !~ ^2.1.[01234]$&gt;<br />
      <indent>
        # not for those versions<br />
      </indent>
      &lt;/IfVersion&gt;
    </example>

    <p>If the <var>operator</var> is omitted, it is assumed to be
    <code>=</code>.</p>
</usage>
</directivesynopsis>

</modulesynopsis>