Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_js_module.xml @ 2163:ca35862f1630
Corrected typo in auth_jwt module.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 21 May 2018 15:19:21 +0300 |
parents | 6df1a86a60b8 |
children | cd4889fdcfa4 |
rev | line source |
---|---|
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <module name="Модуль ngx_http_js_module" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/http/ngx_http_js_module.html" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
12 rev="10"> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать |
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
18 обработчики location и переменных |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
19 на <link doc="../njs_about.xml">njs</link> — |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
20 подмножестве языка JavaScript. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
24 По умолчанию этот модуль не собирается, его необходимо собрать с |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
25 модулем njs с помощью конфигурационного параметра |
2026
af51ec6b5489
Fixed typos in njs configure string examples.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1942
diff
changeset
|
26 <literal>--add-module</literal>: |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 <example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 ./configure --add-module=<value>path-to-njs</value>/nginx |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 <link url="http://hg.nginx.org/njs">Репозиторий</link> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
31 модуля njs можно клонировать следующей командой |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 (необходим клиент <link url="https://www.mercurial-scm.org">Mercurial</link>): |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 <example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
34 hg clone http://hg.nginx.org/njs |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
35 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 Модуль также можно собрать как |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
37 <link doc="../ngx_core_module.xml" id="load_module">динамический</link>: |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
38 <example> |
2026
af51ec6b5489
Fixed typos in njs configure string examples.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1942
diff
changeset
|
39 ./configure --add-dynamic-module=<value>path-to-njs</value>/nginx |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
40 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
41 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
45 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
46 <section id="example" name="Пример конфигурации"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
49 <example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
50 js_include http.js; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
52 js_set $foo foo; |
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
53 js_set $summary summary; |
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
54 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 server { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 listen 8000; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
57 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
58 location / { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
59 add_header X-Foo $foo; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 js_content baz; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 location /summary { |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
64 return 200 $summary; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
65 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
67 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 Файл <path>http.js</path>: |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 <example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 function foo(req, res) { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 req.log("hello from foo() handler"); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 return "foo"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 function summary(req, res) { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
79 var a, s, h; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
81 s = "JS summary\n\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
82 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 s += "Method: " + req.method + "\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 s += "HTTP version: " + req.httpVersion + "\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 s += "Host: " + req.headers.host + "\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
86 s += "Remote Address: " + req.remoteAddress + "\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
87 s += "URI: " + req.uri + "\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 s += "Headers:\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
90 for (h in req.headers) { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
91 s += " header '" + h + "' is '" + req.headers[h] + "'\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
92 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
93 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
94 s += "Args:\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
95 for (a in req.args) { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 s += " arg '" + a + "' is '" + req.args[a] + "'\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
98 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
99 return s; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
100 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 function baz(req, res) { |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
103 res.headers.foo = 1234; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
104 res.status = 200; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
105 res.contentType = "text/plain; charset=utf-8"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
106 res.contentLength = 15; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 res.sendHeader(); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
108 res.send("nginx"); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
109 res.send("java"); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
110 res.send("script"); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
111 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
112 res.finish(); |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
113 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
114 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
115 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
116 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
117 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
118 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
119 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
120 <section id="directives" name="Директивы"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
121 |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
122 <directive name="js_content"> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
123 <syntax><value>функция</value></syntax> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
124 <default/> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
125 <context>location</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
126 <context>limit_except</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
127 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
128 <para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
129 Задаёт функцию njs в качестве обработчика содержимого location. |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
130 </para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
131 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
132 </directive> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
133 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
134 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
135 <directive name="js_include"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
136 <syntax><value>файл</value></syntax> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
137 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
138 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
139 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
140 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
141 Задаёт файл, позволяющий задавать обработчики location и переменных |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
142 на njs. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
145 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
146 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
147 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
148 <directive name="js_set"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
149 <syntax> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
150 <value>$переменная</value> <value>функция</value></syntax> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
151 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
152 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
153 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
154 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
155 Задаёт функцию njs для указанной переменной. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
156 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
157 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
158 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
159 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
160 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
161 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
162 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
163 <section id="arguments" name="Аргументы запроса и ответа"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
164 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
165 Каждый HTTP-обработчик njs получает два аргумента: запрос и ответ. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
166 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
167 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
168 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
169 Объект запроса имеет следующие свойства: |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
170 <list type="tag"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
171 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
172 <tag-name><literal>uri</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
174 текущий URI запроса, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
175 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 <tag-name><literal>method</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
178 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
179 метод запроса, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
180 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
181 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
182 <tag-name><literal>httpVersion</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
183 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
184 версия HTTP, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
185 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
186 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
187 <tag-name><literal>remoteAddress</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
188 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
189 адрес клиента, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
190 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
191 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
192 <tag-name><literal>headers{}</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
193 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 объект заголовков запроса, только чтение. |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
195 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 Например, доступ к заголовку <literal>Header-Name</literal> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 можно получить при помощи синтаксиса <literal>headers['Header-Name']</literal> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
198 или <literal>headers.Header_name</literal> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
199 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
200 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
201 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
202 <tag-name><literal>args{}</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
203 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
204 объект аргументов запроса, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
205 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
206 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
207 <tag-name><literal>variables{}</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
208 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
209 объект переменных nginx, только чтение |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
210 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
211 |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
212 <tag-name><literal>response</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
213 <tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
214 объект ответа (0.2.0), только чтение |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
215 </tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
216 </list> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
217 </para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
218 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
219 <para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
220 Объект запроса имеет следующие свойства: |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
221 <list type="tag"> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
222 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
223 <tag-name><literal>log(<value>строка</value>)</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
224 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
225 записывает <literal>строку</literal> в лог-файл ошибок |
2135
6c7841469ec5
Specified logging level for the "log" argument in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2128
diff
changeset
|
226 на уровне лога <literal>info</literal> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
227 </tag-desc> |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
228 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
229 <tag-name><literal>warn(<value>строка</value>)</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
230 <tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
231 записывает <literal>строку</literal> в лог-файл ошибок |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
232 на уровне лога <literal>warning</literal> (0.2.0) |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
233 </tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
234 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
235 <tag-name><literal>error(<value>строка</value>)</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
236 <tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
237 записывает <literal>строку</literal> в лог-файл ошибок |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
238 на уровне лога <literal>error</literal> (0.2.0) |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
239 </tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
240 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
241 <tag-name><literal>subrequest(<value>uri</value>[, <value>options</value>[, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
242 <value>callback</value>]])</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
243 <tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
244 создаёт подзапрос с заданными <literal>uri</literal> и |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
245 <literal>options</literal> и |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
246 устанавливает необязательный <literal>callback</literal> завершения (0.2.0). |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
247 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
248 <para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
249 Если <literal>options</literal> является строкой, то в ней |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
250 содержится срока аргументов подзапроса. |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
251 В противном случае ожидается, что <literal>options</literal> является объектом |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
252 со следующими ключами: |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
253 <list type="tag"> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
254 <tag-name><literal>args</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
255 <tag-desc>строка с аргументами</tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
256 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
257 <tag-name><literal>body</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
258 <tag-desc>тело запроса</tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
259 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
260 <tag-name><literal>method</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
261 <tag-desc>метод HTTP</tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
262 </list> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
263 </para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
264 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
265 <para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
266 <literal>callback</literal> получает объект ответа |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
267 со следующими свойствами: |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
268 <literal>uri</literal>, <literal>method</literal>, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
269 <literal>status</literal>, <literal>contentType</literal>, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
270 <literal>contentLength</literal>, <literal>headers</literal>, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
271 <literal>args</literal>. |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
272 Эти свойства имеют те же значения, что и свойства объекта запроса. |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
273 Дополнительно у объекта ответа есть свойство <literal>body</literal>, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
274 содержащее тело ответа подзапроса, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
275 и свойство <literal>parent</literal>, |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
276 ссылающееся на родительский объект запроса. |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
277 </para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
278 </tag-desc> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
279 </list> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
280 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
281 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
282 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
283 Объект ответа имеет следующие свойства: |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
284 <list type="tag"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
285 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
286 <tag-name><literal>status</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
287 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
288 статус ответа, доступно для записи |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
289 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
290 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
291 <tag-name><literal>headers{}</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
292 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
293 объект заголовков ответа |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
294 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
295 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
296 <tag-name><literal>contentType</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
297 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
298 значение поля <header>Content-Type</header> заголовка ответа, |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
299 доступно для записи |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
300 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
301 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
302 <tag-name><literal>contentLength</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
303 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
304 значение поля <header>Content-Length</header> заголовка ответа, |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
305 доступно для записи |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
306 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
307 </list> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
308 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
309 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
310 <para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
311 Объект ответа имеет следующие методы: |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
312 <list type="tag"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
313 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
314 <tag-name><literal>sendHeader()</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
315 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
316 отправляет заголовок HTTP клиенту |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
317 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
318 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
319 <tag-name><literal>send(<value>строка</value>)</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
320 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
321 отправляет часть тела ответа клиенту |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
322 </tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
323 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
324 <tag-name><literal>finish()</literal></tag-name> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
325 <tag-desc> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
326 завершает отправку ответа клиенту |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
327 </tag-desc> |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
328 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
329 <tag-name><literal>return(код[, строка])</literal></tag-name> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
330 <tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
331 отправляет |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
332 клиенту полный ответ с указанным <literal>кодом</literal> (0.2.0) |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
333 <para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
334 Можно задать или URL перенаправления |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
335 (для кодов 301, 302, 303, 307 и 308), |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
336 или текст тела ответа (для остальных кодов) в качестве второго аргумента. |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
337 </para> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
338 </tag-desc> |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
339 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
340 </list> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
341 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
342 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
343 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
344 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
345 </module> |