changeset 1743:3d686cb47c2c

Documented the map module in stream.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 05 Jul 2016 17:58:34 +0300
parents c511b73da3a9
children ab56dcd73af2
files xml/en/GNUmakefile xml/en/docs/index.xml xml/en/docs/stream/ngx_stream_map_module.xml xml/ru/GNUmakefile xml/ru/docs/index.xml xml/ru/docs/stream/ngx_stream_map_module.xml
diffstat 6 files changed, 46 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/GNUmakefile
+++ b/xml/en/GNUmakefile
@@ -97,6 +97,7 @@ REFS =									\
 		stream/ngx_stream_access_module				\
 		stream/ngx_stream_core_module				\
 		stream/ngx_stream_limit_conn_module			\
+		stream/ngx_stream_map_module				\
 		stream/ngx_stream_proxy_module				\
 		stream/ngx_stream_ssl_module				\
 		stream/ngx_stream_upstream_module			\
--- a/xml/en/docs/index.xml
+++ b/xml/en/docs/index.xml
@@ -8,7 +8,7 @@
 <article name="nginx documentation"
          link="/en/docs/"
          lang="en"
-         rev="24"
+         rev="25"
          toc="no">
 
 
@@ -497,6 +497,11 @@ ngx_stream_limit_conn_module</link>
 </listitem>
 
 <listitem>
+<link doc="stream/ngx_stream_map_module.xml">
+ngx_stream_map_module</link>
+</listitem>
+
+<listitem>
 <link doc="stream/ngx_stream_proxy_module.xml">
 ngx_stream_proxy_module</link>
 </listitem>
copy from xml/en/docs/http/ngx_http_map_module.xml
copy to xml/en/docs/stream/ngx_stream_map_module.xml
--- a/xml/en/docs/http/ngx_http_map_module.xml
+++ b/xml/en/docs/stream/ngx_stream_map_module.xml
@@ -7,15 +7,15 @@
 
 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
 
-<module name="Module ngx_http_map_module"
-        link="/en/docs/http/ngx_http_map_module.html"
+<module name="Module ngx_stream_map_module"
+        link="/en/docs/stream/ngx_stream_map_module.html"
         lang="en"
-        rev="4">
+        rev="1">
 
 <section id="summary">
 
 <para>
-The <literal>ngx_http_map_module</literal> module creates variables
+The <literal>ngx_stream_map_module</literal> module (1.11.2) creates variables
 whose values depend on values of other variables.
 </para>
 
@@ -26,23 +26,13 @@ whose values depend on values of other v
 
 <para>
 <example>
-map $http_host $name {
-    hostnames;
-
-    default       0;
-
-    example.com   1;
-    *.example.com 1;
-    example.org   2;
-    *.example.org 2;
-    .example.net  3;
-    wap.*         4;
+map $remote_addr $limit {
+    127.0.0.1    "";
+    default      $binary_remote_addr;
 }
 
-map $http_user_agent $mobile {
-    default       0;
-    "~Opera Mini" 1;
-}
+limit_conn_zone $limit zone=addr:10m;
+limit_conn addr 1;
 </example>
 </para>
 
@@ -56,23 +46,19 @@ map $http_user_agent $mobile {
     <value>string</value>
     <value>$variable</value></syntax>
 <default/>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Creates a new variable whose value
 depends on values of one or more of the source variables
 specified in the first parameter.
-<note>
-Before version 0.9.0 only a single variable could be
-specified in the first parameter.
-</note>
 </para>
 
 <para>
 <note>
 Since variables are evaluated only when they are used, the mere declaration
 even of a large number of “<literal>map</literal>” variables
-does not add any extra costs to request processing.
+does not add any extra costs to connection processing.
 </note>
 </para>
 
@@ -82,7 +68,7 @@ between source and resulting values.
 </para>
 
 <para>
-Source values are specified as strings or regular expressions (0.9.6).
+Source values are specified as strings or regular expressions.
 </para>
 
 <para>
@@ -92,7 +78,7 @@ Strings are matched ignoring the case.
 <para>
 A regular expression should either start from the “<literal>~</literal>”
 symbol for a case-sensitive matching, or from the “<literal>~*</literal>”
-symbols (1.0.4) for case-insensitive matching.
+symbols for case-insensitive matching.
 A regular expression can contain named and positional captures
 that can later be used in other directives along with the
 resulting variable.
@@ -105,7 +91,7 @@ described below, it should be prefixed with the “<literal>\</literal>” symbol.
 
 <para>
 The resulting value can contain text,
-variable (0.9.0), and their combination (1.11.0).
+variable, and their combination.
 </para>
 
 <para>
@@ -185,7 +171,7 @@ default value
 <directive name="map_hash_bucket_size">
 <syntax><value>size</value></syntax>
 <default>32|64|128</default>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Sets the bucket size for the <link id="map"/> variables hash tables.
@@ -200,7 +186,7 @@ The details of setting up hash tables ar
 <directive name="map_hash_max_size">
 <syntax><value>size</value></syntax>
 <default>2048</default>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Sets the maximum <value>size</value> of the <link id="map"/> variables
--- a/xml/ru/GNUmakefile
+++ b/xml/ru/GNUmakefile
@@ -86,6 +86,7 @@ REFS =									\
 		stream/ngx_stream_access_module				\
 		stream/ngx_stream_core_module				\
 		stream/ngx_stream_limit_conn_module			\
+		stream/ngx_stream_map_module				\
 		stream/ngx_stream_proxy_module				\
 		stream/ngx_stream_ssl_module				\
 		stream/ngx_stream_upstream_module			\
--- a/xml/ru/docs/index.xml
+++ b/xml/ru/docs/index.xml
@@ -8,7 +8,7 @@
 <article name="nginx: документация"
          link="/ru/docs/"
          lang="ru"
-         rev="24"
+         rev="25"
          toc="no">
 
 
@@ -501,6 +501,11 @@ ngx_stream_limit_conn_module</link>
 </listitem>
 
 <listitem>
+<link doc="stream/ngx_stream_map_module.xml">
+ngx_stream_map_module</link>
+</listitem>
+
+<listitem>
 <link doc="stream/ngx_stream_proxy_module.xml">
 ngx_stream_proxy_module</link>
 </listitem>
copy from xml/ru/docs/http/ngx_http_map_module.xml
copy to xml/ru/docs/stream/ngx_stream_map_module.xml
--- a/xml/ru/docs/http/ngx_http_map_module.xml
+++ b/xml/ru/docs/stream/ngx_stream_map_module.xml
@@ -7,15 +7,15 @@
 
 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
 
-<module name="Модуль ngx_http_map_module"
-        link="/ru/docs/http/ngx_http_map_module.html"
+<module name="Модуль ngx_stream_map_module"
+        link="/ru/docs/stream/ngx_stream_map_module.html"
         lang="ru"
-        rev="4">
+        rev="1">
 
 <section id="summary">
 
 <para>
-Модуль <literal>ngx_http_map_module</literal> создаёт переменные,
+Модуль <literal>ngx_stream_map_module</literal> (1.11.2) создаёт переменные,
 значения которых зависят от значений других переменных.
 </para>
 
@@ -26,23 +26,13 @@
 
 <para>
 <example>
-map $http_host $name {
-    hostnames;
-
-    default       0;
-
-    example.com   1;
-    *.example.com 1;
-    example.org   2;
-    *.example.org 2;
-    .example.net  3;
-    wap.*         4;
+map $remote_addr $limit {
+    127.0.0.1    "";
+    default      $binary_remote_addr;
 }
 
-map $http_user_agent $mobile {
-    default       0;
-    "~Opera Mini" 1;
-}
+limit_conn_zone $limit zone=addr:10m;
+limit_conn addr 1;
 </example>
 </para>
 
@@ -56,16 +46,12 @@ map $http_user_agent $mobile {
     <value>строка</value>
     <value>$переменная</value></syntax>
 <default/>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Создаёт новую переменную, значение которой
 зависит от значений одной или более исходных переменных,
 указанных в первом параметре.
-<note>
-До версии 0.9.0 в качестве первого параметра можно было
-указать только одну переменную.
-</note>
 </para>
 
 <para>
@@ -73,7 +59,7 @@ map $http_user_agent $mobile {
 Поскольку переменные вычисляются только в момент использования,
 само по себе наличие даже большого числа объявлений переменных
 “<literal>map</literal>” не влечёт за собой никаких дополнительных
-расходов на обработку запросов.
+расходов на обработку соединений.
 </note>
 </para>
 
@@ -83,7 +69,7 @@ map $http_user_agent $mobile {
 </para>
 
 <para>
-Исходные значения задаются строками или регулярными выражениями (0.9.6).
+Исходные значения задаются строками или регулярными выражениями.
 </para>
 
 <para>
@@ -93,7 +79,7 @@ map $http_user_agent $mobile {
 <para>
 Перед регулярным выражением ставится символ “<literal>~</literal>”,
 если при сравнении следует учитывать регистр символов, либо символы
-“<literal>~*</literal>” (1.0.4), если регистр символов учитывать не нужно.
+“<literal>~*</literal>”, если регистр символов учитывать не нужно.
 Регулярное выражение может содержать именованные и позиционные выделения,
 которые могут затем использоваться в других директивах совместно с
 результирующей переменной.
@@ -106,7 +92,7 @@ map $http_user_agent $mobile {
 
 <para>
 В качестве результирующего значения можно указать текст,
-переменную (0.9.0) и их комбинации (1.11.0).
+переменную и их комбинации.
 </para>
 
 <para>
@@ -187,7 +173,7 @@ example.com   1;
 <directive name="map_hash_bucket_size">
 <syntax><value>размер</value></syntax>
 <default>32|64|128</default>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Задаёт размер корзины в хэш-таблицах для переменных <link id="map"/>.
@@ -202,7 +188,7 @@ example.com   1;
 <directive name="map_hash_max_size">
 <syntax><value>размер</value></syntax>
 <default>2048</default>
-<context>http</context>
+<context>stream</context>
 
 <para>
 Задаёт максимальный размер хэш-таблиц для переменных <link id="map"/>.