Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_js_module.xml @ 2872:1e1a15c84515
Extended description of r.args in njs reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 19 Jul 2022 16:53:00 +0100 |
parents | a3aee2697d4e |
children | 986e1f930e3b |
rev | line source |
---|---|
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <module name="Модуль ngx_http_js_module" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/ru/docs/http/ngx_http_js_module.html" |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
12 rev="35"> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
17 Модуль <literal>ngx_http_js_module</literal> позволяет задавать |
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
18 обработчики location и переменных |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
19 на <link doc="../njs/index.xml">njs</link> — |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1843
diff
changeset
|
20 подмножестве языка JavaScript. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 <para> |
2188
523dc4cc8745
Updated installation procedure in njs modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2187
diff
changeset
|
24 Инструкция по сборке и установке доступны |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
25 <link doc="../njs/install.xml">здесь</link>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
29 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 <section id="example" name="Пример конфигурации"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
34 Пример работает начиная с версии |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
35 <link doc="../njs/changes.xml" id="njs0.4.0">0.4.0</link>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 <example> |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
37 http { |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
38 js_import http.js; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
39 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
40 js_set $foo http.foo; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
41 js_set $summary http.summary; |
2779
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
42 js_set $hash http.hash; |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
43 |
2784
65591dd31d64
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2779
diff
changeset
|
44 resolver 10.0.0.1; |
65591dd31d64
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2779
diff
changeset
|
45 |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
46 server { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
47 listen 8000; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
49 location / { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
50 add_header X-Foo $foo; |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
51 js_content http.baz; |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
52 } |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 |
2206
5cacd6fffade
Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents:
2190
diff
changeset
|
54 location = /summary { |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
55 return 200 $summary; |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
56 } |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
57 |
2206
5cacd6fffade
Eliminated some examples of unsafe prefix locations.
Ruslan Ermilov <ru@nginx.com>
parents:
2190
diff
changeset
|
58 location = /hello { |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
59 js_content http.hello; |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
60 } |
2779
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
61 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
62 # начиная с версии 0.7.0 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
63 location = /fetch { |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
64 js_content http.fetch; |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
65 js_fetch_trusted_certificate /path/to/ISRG_Root_X1.pem; |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
66 } |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
67 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
68 # начиная с версии 0.7.0 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
69 location = /crypto { |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
70 add_header Hash $hash; |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
71 return 200; |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
72 } |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 <para> |
2779
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
79 Файл <path>http.js</path>: |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 <example> |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
81 function foo(r) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
82 r.log("hello from foo() handler"); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 return "foo"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
86 function summary(r) { |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
87 var a, s, h; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
88 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
89 s = "JS summary\n\n"; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
90 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
91 s += "Method: " + r.method + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
92 s += "HTTP version: " + r.httpVersion + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
93 s += "Host: " + r.headersIn.host + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
94 s += "Remote Address: " + r.remoteAddress + "\n"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
95 s += "URI: " + r.uri + "\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
96 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
97 s += "Headers:\n"; |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
98 for (h in r.headersIn) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
99 s += " header '" + h + "' is '" + r.headersIn[h] + "'\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
100 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 s += "Args:\n"; |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
103 for (a in r.args) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
104 s += " arg '" + a + "' is '" + r.args[a] + "'\n"; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
105 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
106 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 return s; |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
108 } |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
109 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
110 function baz(r) { |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
111 r.status = 200; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
112 r.headersOut.foo = 1234; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
113 r.headersOut['Content-Type'] = "text/plain; charset=utf-8"; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
114 r.headersOut['Content-Length'] = 15; |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
115 r.sendHeader(); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
116 r.send("nginx"); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
117 r.send("java"); |
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
118 r.send("script"); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
119 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
120 r.finish(); |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
121 } |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
122 |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
123 function hello(r) { |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
124 r.return(200, "Hello world!"); |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
125 } |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
126 |
2779
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
127 // начиная с версии 0.7.0 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
128 async function fetch(r) { |
2784
65591dd31d64
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2779
diff
changeset
|
129 let results = await Promise.all([ngx.fetch('https://nginx.org/'), |
65591dd31d64
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2779
diff
changeset
|
130 ngx.fetch('https://nginx.org/en/')]); |
2779
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
131 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
132 r.return(200, JSON.stringify(results, undefined, 4)); |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
133 } |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
134 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
135 // начиная с версии 0.7.0 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
136 async function hash(r) { |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
137 let hash = await crypto.subtle.digest('SHA-512', r.headersIn.host); |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
138 r.setReturnValue(Buffer.from(hash).toString('hex')); |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
139 } |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
140 |
b6bbdce8c659
Updated Example Configuration in ngx_http_js_module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
141 export default {foo, summary, baz, hello, fetch, hash}; |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
142 </example> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
145 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
146 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
147 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
148 <section id="directives" name="Директивы"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
149 |
2664
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
150 <directive name="js_body_filter"> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
151 <syntax><value>функция</value> | <value>модуль.функция</value> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
152 [<value>buffer_type</value>=<value>строка</value> | <value>буфер</value>]</syntax> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
153 <default/> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
154 <context>location</context> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
155 <context>limit_except</context> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
156 <appeared-in>0.5.2</appeared-in> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
157 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
158 <para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
159 Задаёт функцию njs в качестве фильтра тела ответа. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
160 Функция фильтра вызывается для каждого блока данных тела ответа |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
161 со следующими аргументами: |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
162 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
163 <list type="tag"> |
2675
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
164 <tag-name><literal>r</literal></tag-name> |
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
165 <tag-desc> |
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
166 объект <link doc="../njs/reference.xml" id="http">HTTP request</link> |
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
167 </tag-desc> |
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
168 |
2664
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
169 <tag-name><literal>data</literal></tag-name> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
170 <tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
171 входящий блок данных |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
172 может быть строкой или буфером |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
173 в зависимости от значения <literal>buffer_type</literal>, |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
174 по умолчанию является строкой. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
175 </tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
176 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
177 <tag-name><literal>flags</literal></tag-name> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
178 <tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
179 объект со следующими свойствами: |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
180 <list type="tag"> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
181 <tag-name><literal>last</literal></tag-name> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
182 <tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
183 логическое значение, true, если данные являются последним буфером. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
184 </tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
185 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
186 </list> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
187 </tag-desc> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
188 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
189 </list> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
190 </para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
191 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
192 <para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
193 Функция фильтра может передавать свою модифицированную версию |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
194 входящего блока данных следующему фильтру тела ответа при помощи вызова |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
195 <link doc="../njs/reference.xml" id="r_sendbuffer"><literal>r.sendBuffer()</literal></link>. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
196 Пример преобразования букв в нижний регистр в теле ответа: |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
197 <example> |
2675
893cd7724c8c
Documented the "r" argument for js_body_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2664
diff
changeset
|
198 function filter(r, data, flags) { |
2664
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
199 r.sendBuffer(data.toLowerCase(), flags); |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
200 } |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
201 </example> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
202 Для отмены фильтра (блоки данных будут передаваться клиенту |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
203 без вызова <literal>js_body_filter</literal>), |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
204 можно использовать |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
205 <link doc="../njs/reference.xml" id="r_done"><literal>r.done()</literal></link>. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
206 </para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
207 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
208 <para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
209 Если функция фильтра изменяет длину тела ответа, то |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
210 необходимо очистить заголовок ответа <header>Content-Length</header> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
211 (если присутствует) в |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
212 <link id="js_header_filter"><literal>js_header_filter</literal></link>, |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
213 чтобы применить поблочное кодирование. |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
214 </para> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
215 |
2787
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
216 <para> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
217 <note> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
218 Так как обработчик <literal>js_body_filter</literal> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
219 должен сразу возвращать результат, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
220 то поддерживаются только синхронные операции, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
221 Таким образом, асинхронные операции, например |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
222 <link doc="../njs/reference.xml" id="r_subrequest">r.subrequest()</link> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
223 или |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
224 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link>, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
225 не поддерживаются. |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
226 </note> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
227 </para> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
228 |
2664
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
229 </directive> |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
230 |
9e39e64bff84
Documented the js_body_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2651
diff
changeset
|
231 |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
232 <directive name="js_content"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
233 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
234 <default/> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
235 <context>location</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
236 <context>limit_except</context> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
237 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
238 <para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
239 Задаёт функцию njs в качестве обработчика содержимого location. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
240 Начиная с версии <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
|
241 можно ссылаться на функцию модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
242 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
243 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
244 </directive> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
245 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
246 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
247 <directive name="js_fetch_buffer_size"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
248 <syntax><value>размер</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
249 <default>16k</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
250 <context>http</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
251 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
252 <context>location</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
253 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
254 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
255 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
256 Задаёт <value>размер</value> буфера, который будет использоваться |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
257 для чтения и записи для |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
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:
2832
diff
changeset
|
259 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
260 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
261 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
262 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
263 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
264 <directive name="js_fetch_ciphers"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
265 <syntax><value>шифры</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
266 <default>HIGH:!aNULL:!MD5</default> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
267 <context>http</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
268 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
269 <context>location</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
270 <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
|
271 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
272 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
273 Описывает разрешённые шифры для HTTPS-запросов |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
274 при помощи <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
|
275 Шифры задаются в формате, поддерживаемом библиотекой OpenSSL. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
276 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
277 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
278 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
279 Полный список можно посмотреть с помощью команды |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
280 “<command>openssl ciphers</command>”. |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
281 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
282 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
283 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
284 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
285 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
286 <directive name="js_fetch_max_response_buffer_size"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
287 <syntax><value>размер</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
288 <default>1m</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
289 <context>http</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
290 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
291 <context>location</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
292 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
293 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
294 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
295 Задаёт максимальный <value>размер</value> ответа, полученного |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
296 при помощи <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:
2832
diff
changeset
|
297 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
298 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
299 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
300 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
301 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
302 <directive name="js_fetch_protocols"> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
303 <syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
304 [<literal>TLSv1</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
305 [<literal>TLSv1.1</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
306 [<literal>TLSv1.2</literal>] |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
307 [<literal>TLSv1.3</literal>]</syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
308 <default>TLSv1 TLSv1.1 TLSv1.2</default> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
309 <context>http</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
310 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
311 <context>location</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
312 <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
|
313 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
314 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
315 Разрешает указанные протоколы для HTTPS-запросов |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
316 при помощи <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
|
317 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
318 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
319 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
320 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
321 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
322 <directive name="js_fetch_timeout"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
323 <syntax><value>время</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
324 <default>60s</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
325 <context>http</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
326 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
327 <context>location</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
328 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
329 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
330 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
331 Задаёт таймаут при чтении и записи |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
332 при помощи <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:
2832
diff
changeset
|
333 Таймаут устанавливается не на всю передачу ответа, |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
334 а только между двумя операциями чтения. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
335 Если по истечении этого времени данные не передавались, соединение закрывается. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
336 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
337 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
338 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
339 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
340 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
341 <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
|
342 <syntax><value>файл</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
343 <default/> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
344 <context>http</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
345 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
346 <context>location</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
347 <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
|
348 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
349 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
350 Задаёт <value>файл</value> с доверенными сертификатами CA в формате PEM, |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
351 используемыми при |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
352 <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
|
353 HTTPS-сертификата |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
354 при помощи <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
|
355 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
356 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
357 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
358 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
359 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
360 <directive name="js_fetch_verify"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
361 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
362 <default>on</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
363 <context>http</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
364 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
365 <context>location</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
366 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
367 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
368 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
369 Разрешает или запрещает проверку сертификата HTTPS-сервера |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
370 при помощи <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:
2832
diff
changeset
|
371 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
372 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
373 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
374 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2832
diff
changeset
|
375 |
2773
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
376 <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
|
377 <syntax><value>число</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
378 <default>100</default> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
379 <context>http</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
380 <context>server</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
381 <context>location</context> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
382 <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
|
383 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
384 <para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
385 Устанавливает глубину проверки в цепочке HTTPS-сертификатов |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
386 при помощи <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
|
387 </para> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
388 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
389 </directive> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
390 |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
391 |
2651
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
392 <directive name="js_header_filter"> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
393 <syntax><value>функция</value> | <value>модуль.функция</value></syntax> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
394 <default/> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
395 <context>location</context> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
396 <context>limit_except</context> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
397 <appeared-in>0.5.1</appeared-in> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
398 |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
399 <para> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
400 Задаёт функцию njs в качестве фильтра заголовка ответа. |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
401 Директива позволяет менять произвольные поля заголовка ответа. |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
402 </para> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
403 |
2787
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
404 <para> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
405 <note> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
406 Так как обработчик <literal>js_header_filter</literal> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
407 должен сразу возвращать результат, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
408 то поддерживаются только синхронные операции, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
409 Таким образом, асинхронные операции, например |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
410 <link doc="../njs/reference.xml" id="r_subrequest">r.subrequest()</link> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
411 или |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
412 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link>, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
413 не поддерживаются. |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
414 </note> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
415 </para> |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
416 |
2651
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
417 </directive> |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
418 |
b4991bbd64ee
Documented the js_header_filter directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
419 |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
420 <directive name="js_import"> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
421 <syntax><value>модуль.js</value> | |
2832
a3992db1d3d4
Corrected syntax of js_import in the Russian translation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
422 <value>имя_экспорта from модуль.js</value></syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
423 <default/> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
424 <context>http</context> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
425 <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
|
426 |
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 Импортирует модуль, позволяющий задавать обработчики location и переменных |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
429 на njs. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
430 <literal>Имя_экспорта</literal> является пространством имён |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
431 при доступе к функциям модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
432 Если <literal>имя_экспорта</literal> не задано, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
433 то пространством имён будет являться имя модуля. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
434 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
435 js_import http.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
436 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
437 В примере при доступе к экспорту в качестве |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
438 пространства имён используется имя модуля <literal>http</literal>. |
2680
8751cab1d562
Corrected example description in js_import.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2675
diff
changeset
|
439 Если импортируемый модуль экспортирует <literal>foo()</literal>, |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
440 то для доступа используется <literal>http.foo</literal>. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
441 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
442 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
443 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
444 Директив <literal>js_import</literal> может быть несколько. |
2142
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
445 </para> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
446 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
447 </directive> |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
448 |
ca7568f67dee
Sorted directives alphabetically.
Ruslan Ermilov <ru@nginx.com>
parents:
2135
diff
changeset
|
449 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
450 <directive name="js_include"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
451 <syntax><value>файл</value></syntax> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
452 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
453 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
454 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
455 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
456 Задаёт файл, позволяющий задавать обработчики location и переменных на njs: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
457 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
458 nginx.conf: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
459 js_include http.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
460 location /version { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
461 js_content version; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
462 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
463 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
464 http.js: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
465 function version(r) { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
466 r.return(200, njs.version); |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
467 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
468 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
469 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
470 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
471 <para> |
2823
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2787
diff
changeset
|
472 Директива устарела в версии |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2787
diff
changeset
|
473 <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:
2787
diff
changeset
|
474 и была удалена в версии |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2787
diff
changeset
|
475 <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:
2787
diff
changeset
|
476 Вместо неё следует использовать директиву <link id="js_import"/>. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
477 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
478 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
479 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
480 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
481 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
482 <directive name="js_path"> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
483 <syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
484 <value>путь</value></syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
485 <default/> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
486 <context>http</context> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
487 <appeared-in>0.3.0</appeared-in> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
488 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
489 <para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
490 Задаёт дополнительный путь для модулей njs. |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
491 </para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
492 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
493 </directive> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
494 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2288
diff
changeset
|
495 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
496 <directive name="js_set"> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
497 <syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
498 <value>$переменная</value> <value>функция</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
499 <value>модуль.функция</value></syntax> |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
500 <default/> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
501 <context>http</context> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
502 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
503 <para> |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
504 Задаёт <literal>функцию</literal> njs |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
505 для указанной <literal>переменной</literal>. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
506 Начиная с <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
|
507 можно ссылаться на функцию модуля. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
508 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
509 |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
510 <para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
511 Функция вызывается в момент |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
512 первого обращения к переменной для данного запроса. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
513 Точный момент вызова функции зависит от |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
514 <link doc="../dev/development_guide.xml" id="http_phases">фазы</link>, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
515 в которой происходит обращение к переменной. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
516 Это можно использовать для реализации дополнительной логики, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
517 не относящейся к вычислению переменной. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
518 Например, если переменная указана |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
519 в директиве <link doc="ngx_http_log_module.xml" id="log_format"/>, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
520 то её обработчик не будет выполняться до фазы записи в лог. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
521 Этот обработчик также может использоваться для выполнения процедур |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
522 непосредственно перед освобождением запроса. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
523 </para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
524 |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
525 <para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
526 <note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
527 Так как обработчик <literal>js_set</literal> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
528 должен сразу возвращать результат, |
2787
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
529 то поддерживаются только синхронные операции, |
005b056c267f
Added note about async calls for js_body_filter, js_header_filter.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2784
diff
changeset
|
530 Таким образом, асинхронные операции, например |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
531 <link doc="../njs/reference.xml" id="r_subrequest">r.subrequest()</link> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
532 или |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
533 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link>, |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
534 не поддерживаются. |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
535 </note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
536 </para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
537 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
538 </directive> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
539 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
540 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
541 <directive name="js_var"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
542 <syntax><value>$переменная</value> [<value>значение</value>]</syntax> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
543 <default/> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
544 <context>http</context> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
545 <appeared-in>0.5.3</appeared-in> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
546 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
547 <para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
548 Объявляет |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
549 <link doc="../njs/reference.xml" id="r_variables">перезаписываемую</link> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
550 переменную. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
551 В качестве значения можно использовать текст, переменные и их комбинации. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
552 Переменная не перезаписывается после перенаправления, |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
553 в отличие от переменных, созданных при помощи |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
554 директивы <link doc="ngx_http_rewrite_module.xml" id="set"/>. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
555 </para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
556 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
557 </directive> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
558 |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
559 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
560 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
561 |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
562 <section id="arguments" name="Аргумент запроса"> |
2149
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
563 |
6df1a86a60b8
Added new njs HTTP properties and methods.
Roman Arutyunyan <arut@nginx.com>
parents:
2142
diff
changeset
|
564 <para> |
2187
ed905ab118c7
Updated HTTP njs module according to njs 0.2.2.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
565 Каждый HTTP-обработчик njs получает один аргумент, |
2288
786e96c52c7a
Corrected links and example in Russian http and stream js modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
566 <link doc="../njs/reference.xml" id="http">объект</link> запроса. |
1843
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
567 </para> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
568 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
569 </section> |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
570 |
3492eb9b8138
Translated http and stream js modules into Russian.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
571 </module> |