Mercurial > hg > nginx-site
annotate xml/ru/docs/stream/ngx_stream_js_module.xml @ 3004:c95cbff9f571
Added info about the Unit 1.31.0 release.
author | Artem Konev <artem.konev@nginx.com> |
---|---|
date | Thu, 31 Aug 2023 22:38:02 +0100 |
parents | 7eafa16bb07c |
children | 3184864bbb3f |
rev | line source |
---|---|
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
9 <module name="Модуль ngx_stream_js_module" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
10 link="/ru/docs/stream/ngx_stream_js_module.html" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
11 lang="ru" |
3000
7eafa16bb07c
Replaced "delete" to "del" in js_shared_dict_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2996
diff
changeset
|
12 rev="38"> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
17 Модуль <literal>ngx_stream_js_module</literal> позволяет задавать |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
18 обработчики на <link doc="../njs/index.xml">njs</link> — |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
19 подмножестве языка JavaScript. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
20 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 <para> |
2188
523dc4cc8745
Updated installation procedure in njs modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
23 Инструкция по сборке и установке доступны |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
24 <link doc="../njs/install.xml">здесь</link>. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
25 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
30 <section id="example" name="Пример конфигурации"> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
33 Пример работает начиная с версии |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
34 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
35 <example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 stream { |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
37 js_import stream.js; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
38 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
39 js_set $bar stream.bar; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
40 js_set $req_line stream.req_line; |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
41 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 listen 12345; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
44 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
45 js_preread stream.preread; |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
46 return $req_line; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
49 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
50 listen 12346; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
52 js_access stream.access; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 proxy_pass 127.0.0.1:8000; |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
54 js_filter stream.header_inject; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
55 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
57 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
58 http { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
59 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 listen 8000; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
61 location / { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 return 200 $http_foo\n; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
65 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 </example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
67 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 <para> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
70 Файл <path>stream.js</path>: |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 <example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 var line = ''; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 function bar(s) { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 var v = s.variables; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 s.log("hello from bar() handler!"); |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
77 return "bar-var" + v.remote_port + "; pid=" + v.pid; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
78 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
79 |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
80 function preread(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
81 s.on('upload', function (data, flags) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
82 var n = data.indexOf('\n'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
83 if (n != -1) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
84 line = data.substr(0, n); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
85 s.done(); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
86 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
87 }); |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
90 function req_line(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
91 return line; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
92 } |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
93 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
94 // Чтение строки HTTP-запроса. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
95 // Получение байт в 'req' до того как |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
96 // будет прочитана строка запроса. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
97 // Добавление HTTP-заголовка в запрос клиента |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
98 |
2288
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
99 var my_header = 'Foo: foo'; |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
100 function header_inject(s) { |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
101 var req = ''; |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
102 s.on('upload', function(data, flags) { |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
103 req += data; |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
104 var n = req.search('\n'); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
105 if (n != -1) { |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
106 var rest = req.substr(n + 1); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
107 req = req.substr(0, n + 1); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
108 s.send(req + my_header + '\r\n' + rest, flags); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
109 s.off('upload'); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
110 } |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
111 }); |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
112 } |
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
113 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
114 function access(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
115 if (s.remoteAddress.match('^192.*')) { |
2649
7517de030c0a
Corrected njs example in ngx_stream_js_module module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2641
diff
changeset
|
116 s.deny(); |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
117 return; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
118 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
119 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
120 s.allow(); |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
121 } |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
122 |
2641
ea9f4dc0c801
Fixed example in stream js module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2591
diff
changeset
|
123 export default {bar, preread, req_line, header_inject, access}; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
124 </example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
125 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
126 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
127 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
128 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
129 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
130 <section id="directives" name="Директивы"> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
131 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
132 <directive name="js_access"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
133 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
134 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
135 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
136 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
137 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
138 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
139 Задаёт функцию njs, которая будет вызываться в |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
140 <link doc="stream_processing.xml" id="access_phase">access</link>-фазе. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
141 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
142 можно ссылаться на функцию модуля. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
145 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
146 Функция вызывается однократно при первом достижении сессией |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
147 <link doc="stream_processing.xml" id="access_phase">access</link>-фазы. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
148 Функция вызывается со следующими аргументами: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
149 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
150 <list type="tag"> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
151 <tag-name><literal>s</literal></tag-name> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
152 <tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
153 объект <link doc="../njs/reference.xml" id="stream">stream-сессии</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
154 </tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
155 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
156 </list> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
157 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
158 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
159 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
160 В этой фазе может происходить инициализация, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
161 также при помощи метода |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
162 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
163 может регистрироваться вызов |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
164 для каждого входящего блока данных пока не будет вызван один из методов: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
165 <link doc="../njs/reference.xml" id="s_done"><literal>s.done()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
166 <link doc="../njs/reference.xml" id="s_decline"><literal>s.decline()</literal></link>, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
167 <link doc="../njs/reference.xml" id="s_allow"><literal>s.allow()</literal></link>. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
168 При вызове любого из этих методов обработка сессии |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
169 переходит на <link doc="stream_processing.xml">следующую фазу</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
170 и все текущие вызовы |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
171 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
172 сбрасываются. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
173 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
174 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
175 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
178 <directive name="js_fetch_buffer_size"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
179 <syntax><value>размер</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
180 <default>16k</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
181 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
182 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
183 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
184 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
185 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
186 Задаёт <value>размер</value> буфера, который будет использоваться |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
187 для чтения и записи для |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
188 <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
189 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
190 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
191 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
192 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
193 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
194 <directive name="js_fetch_ciphers"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
195 <syntax><value>шифры</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
196 <default>HIGH:!aNULL:!MD5</default> |
2844
eb11724745e3
Corrected syntax in some directives of the ngx_stream_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
197 <context>stream</context> |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
198 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
199 <appeared-in>0.7.0</appeared-in> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
200 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
201 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
202 Описывает разрешённые шифры для HTTPS-соединений |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
203 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
204 Шифры задаются в формате, поддерживаемом библиотекой OpenSSL. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
205 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
206 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
207 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
208 Полный список можно посмотреть с помощью команды |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
209 “<command>openssl ciphers</command>”. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
210 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
211 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
212 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
213 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
214 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
215 <directive name="js_fetch_max_response_buffer_size"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
216 <syntax><value>размер</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
217 <default>1m</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
218 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
219 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
220 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
221 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
222 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
223 Задаёт максимальный <value>размер</value> ответа, полученного |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
224 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
225 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
226 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
227 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
228 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
229 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
230 <directive name="js_fetch_protocols"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
231 <syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
232 [<literal>TLSv1</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
233 [<literal>TLSv1.1</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
234 [<literal>TLSv1.2</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
235 [<literal>TLSv1.3</literal>]</syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
236 <default>TLSv1 TLSv1.1 TLSv1.2</default> |
2844
eb11724745e3
Corrected syntax in some directives of the ngx_stream_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
237 <context>stream</context> |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
238 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
239 <appeared-in>0.7.0</appeared-in> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
240 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
241 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
242 Разрешает указанные протоколы для HTTPS-соединений |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
243 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
244 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
245 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
246 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
247 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
248 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
249 <directive name="js_fetch_timeout"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
250 <syntax><value>время</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
251 <default>60s</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
252 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
253 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
254 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
255 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
256 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
257 Задаёт таймаут при чтении и записи |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
258 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
259 Таймаут устанавливается не на всю передачу ответа, |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
260 а только между двумя операциями чтения. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
261 Если по истечении этого времени данные не передавались, соединение закрывается. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
262 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
263 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
264 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
265 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
266 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
267 <directive name="js_fetch_trusted_certificate"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
268 <syntax><value>файл</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
269 <default/> |
2844
eb11724745e3
Corrected syntax in some directives of the ngx_stream_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
270 <context>stream</context> |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
271 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
272 <appeared-in>0.7.0</appeared-in> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
273 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
274 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
275 Задаёт <value>файл</value> с доверенными сертификатами CA в формате PEM, |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
276 используемыми при |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
277 <link doc="../njs/reference.xml" id="fetch_verify">проверке</link> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
278 HTTPS-сертификата |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
279 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
280 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
281 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
282 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
283 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
284 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
285 <directive name="js_fetch_verify"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
286 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
287 <default>on</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
288 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
289 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
290 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
291 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
292 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
293 Разрешает или запрещает проверку сертификата HTTPS-сервера |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
294 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
295 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
296 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
297 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
298 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2844
diff
changeset
|
299 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
300 <directive name="js_fetch_verify_depth"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
301 <syntax><value>число</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
302 <default>100</default> |
2844
eb11724745e3
Corrected syntax in some directives of the ngx_stream_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
303 <context>stream</context> |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
304 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
305 <appeared-in>0.7.0</appeared-in> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
306 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
307 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
308 Устанавливает глубину проверки в цепочке HTTPS-сертификатов |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
309 при помощи <link doc="../njs/reference.xml" id="ngx_fetch">Fetch API</link>. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
310 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
311 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
312 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
313 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
314 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
315 <directive name="js_filter"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
316 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
317 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
318 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
319 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
320 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
321 <para> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
322 Задаёт фильтр данных. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
323 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
324 можно ссылаться на функцию модуля. |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
325 Функция фильтра вызывается однократно при первом достижении сессией |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
326 <link doc="stream_processing.xml" id="content_phase">content</link>-фазы. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
327 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
328 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
329 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
330 Функция фильтра вызывается со следующими аргументами: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
331 <list type="tag"> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
332 <tag-name><literal>s</literal></tag-name> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
333 <tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
334 объект <link doc="../njs/reference.xml" id="stream">stream-сессии</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
335 </tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
336 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
337 </list> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
338 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
339 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
340 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
341 В этой фазе может происходить инициализация, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
342 также при помощи метода |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
343 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
344 может регистрироваться вызов |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
345 для каждого входящего блока данных. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
346 Для отмены регистрации вызова и отмены фильтра |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
347 можно использовать метод |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
348 <link doc="../njs/reference.xml" id="s_off"><literal>s.off()</literal></link>. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
349 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
350 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
351 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
352 <note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
353 Так как обработчик <literal>js_filter</literal> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
354 должен сразу возвращать результат, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
355 то поддерживаются только синхронные операции. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
356 Таким образом, асинхронные операции, например |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
357 <link doc="../njs/reference.xml" id="ngx_fetch"><literal>ngx.fetch()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
358 или |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
359 <link doc="../njs/reference.xml" id="settimeout"><literal>setTimeout()</literal></link>, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
360 не поддерживаются. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
361 </note> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
362 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
363 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
364 </directive> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
365 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
366 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
367 <directive name="js_import"> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
368 <syntax><value>модуль.js</value> | |
2832
a3992db1d3d4
Corrected syntax of js_import in the Russian translation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
369 <value>имя_экспорта from модуль.js</value></syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
370 <default/> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
371 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
372 <context>server</context> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
373 <appeared-in>0.4.0</appeared-in> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
374 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
375 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
376 Импортирует модуль, позволяющий задавать обработчики location и переменных |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
377 на njs. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
378 <literal>Имя_экспорта</literal> является пространством имён |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
379 при доступе к функциям модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
380 Если <literal>имя_экспорта</literal> не задано, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
381 то пространством имён будет являться имя модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
382 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
383 js_import stream.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
384 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
385 В примере при доступе к экспорту в качестве |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
386 пространства имён используется имя модуля <literal>stream</literal>. |
2680
8751cab1d562
Corrected example description in js_import.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2649
diff
changeset
|
387 Если импортируемый модуль экспортирует <literal>foo()</literal>, |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
388 то для доступа используется <literal>stream.foo</literal>. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
389 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
390 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
391 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
392 Директив <literal>js_import</literal> может быть несколько. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
393 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
394 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
395 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
396 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
397 Директива может быть указана |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
398 на уровне <literal>server</literal> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
399 начиная с <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
400 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
401 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
402 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
403 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
404 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
405 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
406 <directive name="js_include"> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
407 <syntax><value>файл</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
408 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
409 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
410 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
411 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
412 Задаёт файл, который позволяет задавать обработчики server и переменных на njs: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
413 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
414 nginx.conf: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
415 js_include stream.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
416 js_set $js_addr address; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
417 server { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
418 listen 127.0.0.1:12345; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
419 return $js_addr; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
420 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
421 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
422 stream.js: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
423 function address(s) { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
424 return s.remoteAddress; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
425 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
426 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
427 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
428 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
429 <para> |
2823
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
430 Директива устарела в версии |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
431 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
432 и была удалена в версии |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
433 <link doc="../njs/changes.xml" id="njs0.7.1">0.7.1</link>. |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
434 Вместо неё следует использовать директиву <link id="js_import"/>. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
435 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
436 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
437 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
438 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
439 |
2901
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
440 <directive name="js_preload_object"> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
441 <syntax><value>имя.json</value> | |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
442 <value>имя</value> from <value>файл.json</value></syntax> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
443 <default/> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
444 <context>stream</context> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
445 <context>server</context> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
446 <appeared-in>0.7.8</appeared-in> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
447 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
448 <para> |
2996
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
449 Предварительно загружает |
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
450 <link doc="../njs/preload_objects.xml">неизменяемый объект</link> |
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
451 во время конфигурации. |
2901
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
452 <literal>Имя</literal> используется в качестве имени глобальной переменной, |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
453 через которую объект доступен в коде njs. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
454 Если <literal>имя</literal> не указано, |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
455 то будет использоваться имя файла. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
456 <example> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
457 js_preload_object map.json; |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
458 </example> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
459 В примере <literal>map</literal> используется в качестве имени |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
460 во время доступа к предварительно загруженному объекту. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
461 </para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
462 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
463 <para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
464 Директив <literal>js_preload_object</literal> может быть несколько. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
465 </para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
466 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
467 </directive> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
468 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
469 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
470 <directive name="js_preread"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
471 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
472 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
473 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
474 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
475 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
476 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
477 Задаёт функцию njs, которая будет вызываться в |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
478 <link doc="stream_processing.xml" id="preread_phase">preread</link>-фазе. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
479 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
480 можно ссылаться на функцию модуля. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
481 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
482 |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
483 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
484 Функция вызывается однократно при первом достижении сессией |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
485 <link doc="stream_processing.xml" id="preread_phase">preread</link>-фазы. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
486 Функция вызывается со следующими аргументами: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
487 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
488 <list type="tag"> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
489 <tag-name><literal>s</literal></tag-name> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
490 <tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
491 объект <link doc="../njs/reference.xml" id="stream">stream-сессии</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
492 </tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
493 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
494 </list> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
495 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
496 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
497 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
498 В этой фазе может происходить инициализация, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
499 также при помощи метода |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
500 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
501 может регистрироваться вызов |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
502 для каждого входящего блока данных пока не будет вызван один из методов: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
503 <link doc="../njs/reference.xml" id="s_done"><literal>s.done()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
504 <link doc="../njs/reference.xml" id="s_decline"><literal>s.decline()</literal></link>, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
505 <link doc="../njs/reference.xml" id="s_allow"><literal>s.allow()</literal></link>. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
506 При вызове любого из этих методов обработка сессии |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
507 переходит на <link doc="stream_processing.xml">следующую фазу</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
508 и все текущие вызовы |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
509 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
510 сбрасываются. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
511 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
512 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
513 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
514 <note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
515 Так как обработчик <literal>js_preread</literal> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
516 должен сразу возвращать результат, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
517 то поддерживаются только синхронные операции. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
518 Таким образом, асинхронные операции, например |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
519 <link doc="../njs/reference.xml" id="ngx_fetch"><literal>ngx.fetch()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
520 или |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
521 <link doc="../njs/reference.xml" id="settimeout"><literal>setTimeout()</literal></link>, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
522 не поддерживаются. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
523 Тем не менее асинхронные операции поддерживаются в вызовах |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
524 <link doc="../njs/reference.xml" id="s_on"><literal>s.on()</literal></link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
525 в |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
526 <link doc="stream_processing.xml" id="preread_phase">preread</link>-фазе. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
527 Подробнее см. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
528 <link url="https://github.com/nginx/njs-examples#authorizing-connections-using-ngx-fetch-as-auth-request-stream-auth-request">пример</link>. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
529 </note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
530 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
531 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
532 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
533 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
534 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
535 <directive name="js_path"> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
536 <syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
537 <value>путь</value></syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
538 <default/> |
2591
f27cedd43e0f
Corrected syntax of js_path in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
539 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
540 <context>server</context> |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
541 <appeared-in>0.3.0</appeared-in> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
542 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
543 <para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
544 Задаёт дополнительный путь для модулей njs. |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
545 </para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
546 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
547 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
548 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
549 Директива может быть указана |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
550 на уровне <literal>server</literal> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
551 начиная с <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
552 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
553 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
554 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
555 </directive> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
556 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
557 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
558 <directive name="js_set"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
559 <syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
560 <value>$переменная</value> <value>функция</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
561 <value>модуль.функция</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
562 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
563 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
564 <context>server</context> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
565 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
566 <para> |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
567 Задаёт <literal>функцию</literal> njs |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
568 для указанной <literal>переменной</literal>. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
569 Начиная с <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
570 можно ссылаться на функцию модуля. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
571 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
572 |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
573 <para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
574 Функция вызывается в момент |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
575 первого обращения к переменной для данного запроса. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
576 Точный момент вызова функции зависит от |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
577 <link doc="stream_processing.xml">фазы</link>, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
578 в которой происходит обращение к переменной. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
579 Это можно использовать для реализации дополнительной логики, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
580 не относящейся к вычислению переменной. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
581 Например, если переменная указана |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
582 в директиве <link doc="ngx_stream_log_module.xml" id="log_format"/>, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
583 то её обработчик не будет выполняться до фазы записи в лог. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
584 Этот обработчик также может использоваться для выполнения процедур |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
585 непосредственно перед освобождением запроса. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
586 </para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
587 |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
588 <para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
589 <note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
590 Так как обработчик <literal>js_set</literal> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
591 должен сразу возвращать результат, |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
592 то поддерживаются только синхронные операции. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
593 Таким образом, асинхронные операции, например |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
594 <link doc="../njs/reference.xml" id="ngx_fetch"><literal>ngx.fetch()</literal></link> |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
595 или |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
596 <link doc="../njs/reference.xml" id="settimeout"><literal>setTimeout()</literal></link>, |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
597 не поддерживаются. |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
598 </note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
599 </para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
600 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
601 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
602 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
603 Директива может быть указана |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
604 на уровне <literal>server</literal> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
605 начиная с <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
606 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
607 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
608 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
609 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
610 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
611 |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
612 <directive name="js_shared_dict_zone"> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
613 <syntax> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
614 <literal>zone</literal>=<value>имя</value>:<value>размер</value> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
615 [<literal>timeout</literal>=<value>время</value>] |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
616 [<literal>type</literal>=<literal>строка</literal>|<literal>число</literal>] |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
617 [<literal>evict</literal>]</syntax> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
618 <default/> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
619 <context>stream</context> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
620 <appeared-in>0.8.0</appeared-in> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
621 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
622 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
623 Задаёт <value>имя</value> и <value>размер</value> зоны разделяемой памяти, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
624 в которой хранится словарь ключей и значений, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
625 разделяемый между рабочими процессами. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
626 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
627 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
628 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
629 По умолчанию в качестве ключа и значения используется строка. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
630 Необязательный параметр <literal>type</literal> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
631 позволяет изменить тип значения на число. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
632 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
633 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
634 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
635 Необязательный параметр <literal>timeout</literal> задаёт время, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
636 по завершении которого все записи в словаре удаляются из зоны. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
637 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
638 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
639 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
640 Необязательный параметр <literal>evict</literal> удаляет самую старую |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
641 пару ключ-значение при переполнении зоны. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
642 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
643 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
644 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
645 Пример: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
646 <example> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
647 example.conf: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
648 # Создаётся словарь размером 1Мб со строковыми значениями, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
649 # пары ключ-значение удаляются при отсутствии активности в течение 60 секунд: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
650 js_shared_dict_zone zone=foo:1M timeout=60s; |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
651 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
652 # Создаётся словарь размером 512Кб со строковыми значениями, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
653 # удаляется самая старая пара ключ-значение при переполнении зоны: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
654 js_shared_dict_zone zone=bar:512K timeout=30s evict; |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
655 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
656 # Создаётся постоянный словарь размером 32Кб с числовыми значениями: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
657 js_shared_dict_zone zone=num:32k type=number; |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
658 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
659 example.js: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
660 function get(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
661 r.return(200, ngx.shared.foo.get(r.args.key)); |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
662 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
663 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
664 function set(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
665 r.return(200, ngx.shared.foo.set(r.args.key, r.args.value)); |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
666 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
667 |
3000
7eafa16bb07c
Replaced "delete" to "del" in js_shared_dict_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2996
diff
changeset
|
668 function del(r) { |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
669 r.return(200, ngx.shared.bar.delete(r.args.key)); |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
670 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
671 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
672 function increment(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
673 r.return(200, ngx.shared.num.incr(r.args.key, 2)); |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
674 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
675 </example> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
676 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
677 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
678 </directive> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
679 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
680 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
681 <directive name="js_var"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
682 <syntax><value>$переменная</value> [<value>значение</value>]</syntax> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
683 <default/> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
684 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
685 <context>server</context> |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
686 <appeared-in>0.5.3</appeared-in> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
687 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
688 <para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
689 Объявляет |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
690 <link doc="../njs/reference.xml" id="r_variables">перезаписываемую</link> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
691 переменную. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
692 В качестве значения можно использовать текст, переменные и их комбинации. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
693 </para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
694 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
695 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
696 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
697 Директива может быть указана |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
698 на уровне <literal>server</literal> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
699 начиная с <link doc="../njs/changes.xml" id="njs0.7.7">0.7.7</link>. |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
700 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
701 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
702 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
703 </directive> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
704 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
705 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
706 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
707 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
708 <section id="properties" name="Свойства объекта сессии"> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
709 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
710 <para> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2135
diff
changeset
|
711 Каждый stream-обработчик njs получает один аргумент, |
2288
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
712 <link doc="../njs/reference.xml" id="stream">объект</link> stream-сессии. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
713 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
714 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
715 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
716 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
717 </module> |