Mercurial > hg > nginx-site
diff xml/ru/docs/stream/ngx_stream_js_module.xml @ 1843:3492eb9b8138
Translated http and stream js modules into Russian.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 28 Nov 2016 21:29:02 +0300 |
parents | xml/en/docs/stream/ngx_stream_js_module.xml@15632fc2d548 |
children | f56626ce9c40 |
line wrap: on
line diff
copy from xml/en/docs/stream/ngx_stream_js_module.xml copy to xml/ru/docs/stream/ngx_stream_js_module.xml --- a/xml/en/docs/stream/ngx_stream_js_module.xml +++ b/xml/ru/docs/stream/ngx_stream_js_module.xml @@ -6,33 +6,33 @@ <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> -<module name="Module ngx_stream_js_module" - link="/en/docs/stream/ngx_stream_js_module.html" - lang="en" +<module name="Модуль ngx_stream_js_module" + link="/ru/docs/stream/ngx_stream_js_module.html" + lang="ru" rev="1"> <section id="summary"> <para> -The <literal>ngx_stream_js_module</literal> module is used to -implement handlers in JavaScript. +Модуль <literal>ngx_stream_js_module</literal> позволяет задавать +обработчики на JavaScript. </para> <para> -This module is not built by default, it should be compiled with -nginx JavaScript module using the -<literal>--add_module</literal> configuration parameter: +По умолчанию этот модуль не собирается, его необходимо собрать с +модулем nginx JavaScript с помощью конфигурационного параметра +<literal>--add_module</literal>: <example> ./configure --add-module=<value>path-to-njs</value>/nginx </example> -The <link url="http://hg.nginx.org/njs">repository</link> -with nginx JavaScript module can be cloned with the following command -(requires <link url="https://www.mercurial-scm.org">Mercurial</link> client): +<link url="http://hg.nginx.org/njs">Репозиторий</link> +модуля nginx JavaScript можно клонировать следующей командой +(необходим клиент <link url="https://www.mercurial-scm.org">Mercurial</link>): <example> hg clone http://hg.nginx.org/njs </example> -This module can also be built as -<link doc="../ngx_core_module.xml" id="load_module">dynamic</link>: +Модуль также можно собрать как +<link doc="../ngx_core_module.xml" id="load_module">динамический</link>: <example> ./configure --add-dynamic_module=<value>path-to-njs</value>/nginx </example> @@ -41,16 +41,16 @@ This module can also be built as </section> -<section id="issues" name="Known Issues"> +<section id="issues" name="Известные проблемы"> <para> -The module is experimental, caveat emptor applies. +Модуль экспериментальный, поэтому возможно всё. </para> </section> -<section id="example" name="Example Configuration"> +<section id="example" name="Пример конфигурации"> <para> <example> @@ -89,7 +89,7 @@ http { </para> <para> -The <path>stream.js</path> file: +Файл <path>stream.js</path>: <example> var req = ''; var matched = 0; @@ -114,25 +114,25 @@ function bar(s) { return "foo-var" + v.remote_port + "; pid=" + v.pid; } -// The filter processes one buffer per call. -// The buffer is available in s.buffer both for -// reading and writing. Called for both directions. +// Фильтр обрабатывает один буфер за вызов. +// Буфер недоступен в s.buffer для +// чтения и записи. Вызывается в обоих направлениях. function baz(s) { if (s.fromUpstream || matched) { return; } - // Disable certain addresses. + // Отключение определённых адресов. if (s.remoteAddress.match('^192.*')) { return s.ERROR; } - // Read HTTP request line. - // Collect bytes in 'req' until request - // line is read. Clear current buffer to - // disable output. + // Чтение строки HTTP-запроса. + // Получение байт в 'req' до того как + // будет прочитана строка запроса. Очистка текущего буфера + // для отключения вывода. req = req + s.buffer; s.buffer = ''; @@ -140,7 +140,7 @@ function baz(s) { n = req.search('\n'); if (n != -1) { - // Inject a new HTTP header. + // Вставка нового HTTP-заголовка. var rest = req.substr(n + 1); req = req.substr(0, n + 1); @@ -149,8 +149,8 @@ function baz(s) { s.log('req:' + req); s.log('rest:' + rest); - // Output the result and skip further - // processing. + // Вывод результата и пропуск дальнейшей + // обработки. s.buffer = req + 'Foo: addr_' + addr + '\r\n' + rest; matched = 1; @@ -168,57 +168,58 @@ function xyz(s) { </section> -<section id="directives" name="Directives"> +<section id="directives" name="Директивы"> <directive name="js_access"> -<syntax><value>function</value></syntax> +<syntax><value>функция</value></syntax> <default/> <context>stream</context> <context>server</context> <para> -Sets a JavaScript function which will be called at the -<link doc="stream_processing.xml" id="access_phase">access</link> phase. +Задаёт функцию JavaScript, которая будет вызываться в +<link doc="stream_processing.xml" id="access_phase">access</link>-фазе. </para> </directive> <directive name="js_filter"> -<syntax><value>function</value></syntax> +<syntax><value>функция</value></syntax> <default/> <context>stream</context> <context>server</context> <para> -Sets a data filter. +Задаёт фильтр данных. </para> </directive> <directive name="js_include"> -<syntax><value>file</value></syntax> +<syntax><value>файл</value></syntax> <default/> <context>stream</context> <context>server</context> <para> -Specifies a file that implements server and variable handlers in JavaScript. +Задаёт файл, который позволяет +задавать обработчики server и переменных на JavaScript. </para> </directive> <directive name="js_preread"> -<syntax><value>function</value></syntax> +<syntax><value>функция</value></syntax> <default/> <context>stream</context> <context>server</context> <para> -Sets a JavaScript function which will be called at the -<link doc="stream_processing.xml" id="preread_phase">preread</link> phase. +Задаёт функцию JavaScript, которая будет вызываться в +<link doc="stream_processing.xml" id="preread_phase">preread</link>-фазе. </para> </directive> @@ -226,13 +227,13 @@ Sets a JavaScript function which will be <directive name="js_set"> <syntax> -<value>$variable</value> <value>function</value></syntax> +<value>$переменная</value> <value>функция</value></syntax> <default/> <context>stream</context> <context>server</context> <para> -Sets a JavaScript function for the specified variable. +Задаёт функцию JavaScript для указанной переменной. </para> </directive> @@ -240,77 +241,81 @@ Sets a JavaScript function for the speci </section> -<section id="properties" name="Session Object Properties"> +<section id="properties" name="Свойства объекта сессии"> <para> -Each stream JavaScript handler receives one argument, a stream session object. +Каждый stream-обработчик JavaScript получает один аргумент: +объект stream-сессии. </para> <para> -The session object has the following properties: +Объект сессии имеет следующие свойства: <list type="tag"> <tag-name><literal>remoteAddress</literal></tag-name> <tag-desc> -client address, read-only +адрес клиента, только чтение </tag-desc> <tag-name><literal>eof</literal></tag-name> <tag-desc> -a boolean read-only property, true if the current buffer is the last buffer +логическое свойство, +true, если текущий буфер является последним буфером, +только чтение </tag-desc> <tag-name><literal>fromUpstream</literal></tag-name> <tag-desc> -a boolean read-only property, -true if the current buffer is from the upstream server to the client +логическое свойство, +true, если текущий буфер является буфером от проксируемого сервера к клиенту, +только чтение </tag-desc> <tag-name><literal>buffer</literal></tag-name> <tag-desc> -the current buffer, writable +текущий буфер, доступен для записи </tag-desc> <tag-name><literal>variables{}</literal></tag-name> <tag-desc> -nginx variables object, read-only +объект переменных nginx, только чтение </tag-desc> <tag-name><literal>OK</literal></tag-name> <tag-desc> -the <literal>OK</literal> return code +код <literal>OK</literal> </tag-desc> <tag-name><literal>DECLINED</literal></tag-name> <tag-desc> -the <literal>DECLINED</literal> return code +код <literal>DECLINED</literal> </tag-desc> <tag-name><literal>AGAIN</literal></tag-name> <tag-desc> -the <literal>AGAIN</literal> return code +код <literal>AGAIN</literal> </tag-desc> <tag-name><literal>ERROR</literal></tag-name> <tag-desc> -the <literal>ERROR</literal> return code +код <literal>ERROR</literal> </tag-desc> <tag-name><literal>ABORT</literal></tag-name> <tag-desc> -the <literal>ABORT</literal> return code +код <literal>ABORT</literal> </tag-desc> </list> </para> <para> -The session object has the following methods: +Объект сессии имеет следующие методы: <list type="tag"> -<tag-name><literal>log(<value>string</value>)</literal></tag-name> +<tag-name><literal>log(<value>строка</value>)</literal></tag-name> <tag-desc> -writes a sent <value>string</value> to the error log +записывает отправленную <value>строку</value> в лог-файл ошибок </tag-desc> </list> </para>