Mercurial > hg > nginx-site
annotate xml/en/docs/stream/ngx_stream_js_module.xml @ 3029:27008cb3fb27
Updated docs for the upcoming NGINX Plus release.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 19 Dec 2023 12:58:01 +0000 |
parents | c0a4a4a55e45 |
children | e6b785b7e308 |
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 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
9 <module name="Module ngx_stream_js_module" |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
10 link="/en/docs/stream/ngx_stream_js_module.html" |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="en" |
3014
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3011
diff
changeset
|
12 rev="43"> |
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> |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
17 The <literal>ngx_stream_js_module</literal> module is used to implement |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
18 handlers in <link doc="../njs/index.xml">njs</link> — |
1844
f56626ce9c40
Changed JavaScript to nginScript.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1840
diff
changeset
|
19 a subset of the JavaScript language. |
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 Download and install instructions are available |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
24 <link doc="../njs/install.xml">here</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 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
30 <section id="example" name="Example Configuration"> |
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 The example works since |
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> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 The <path>stream.js</path> file: |
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 }); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
88 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
89 |
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; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
92 } |
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 // Read HTTP request line. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
95 // Collect bytes in 'req' until |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
96 // request line is read. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
97 // Injects HTTP header into a client's request |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
98 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
99 var my_header = 'Foo: foo'; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
100 function header_inject(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
101 var req = ''; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
102 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
|
103 req += data; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
104 var n = req.search('\n'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
105 if (n != -1) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
106 var rest = req.substr(n + 1); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
107 req = req.substr(0, n + 1); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
108 s.send(req + my_header + '\r\n' + rest, flags); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
109 s.off('upload'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
110 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
111 }); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
112 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
113 |
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 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
130 <section id="directives" name="Directives"> |
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>function</value> | <value>module.function</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 Sets an njs function which will be called at the |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
140 <link doc="stream_processing.xml" id="access_phase">access</link> phase. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
141 Since <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 a module function can be referenced. |
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 The function is called once at the moment when the stream session reaches |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
147 the <link doc="stream_processing.xml" id="access_phase">access</link> phase |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
148 for the first time. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
149 The function is called with the following arguments: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
150 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
151 <list type="tag"> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
152 <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
|
153 <tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
154 the <link doc="../njs/reference.xml" id="stream">Stream Session</link> object |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
155 </tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
156 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
157 </list> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
158 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
159 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
160 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
161 At this phase, it is possible to perform initialization |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
162 or register a callback with |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
163 the <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
|
164 method |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
165 for each incoming data chunk until one of the following methods are called: |
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_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
|
167 <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
|
168 <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
|
169 As soon as one of these methods is called, the stream session processing |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
170 switches to the <link doc="stream_processing.xml">next phase</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
171 and all current |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
172 <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
|
173 callbacks are dropped. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
174 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
175 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
178 |
2845
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
179 <directive name="js_fetch_buffer_size"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
180 <syntax><value>size</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
181 <default>16k</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
182 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
183 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
184 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
185 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
186 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
187 Sets the <value>size</value> of the buffer used for reading and writing |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
188 with <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:
2823
diff
changeset
|
189 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
190 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
191 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
192 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
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>ciphers</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> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
197 <context>stream</context> |
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 Specifies the enabled ciphers for HTTPS connections |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
203 with <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 The ciphers are specified in the format understood by the OpenSSL library. |
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 The full list can be viewed using the |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
209 “<command>openssl ciphers</command>” 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:
2823
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:
2823
diff
changeset
|
216 <syntax><value>size</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
217 <default>1m</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
218 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
219 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
220 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
221 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
222 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
223 Sets the maximum <value>size</value> of the response received |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
224 with <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:
2823
diff
changeset
|
225 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
226 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
227 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
228 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
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> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
237 <context>stream</context> |
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 Enables the specified protocols for HTTPS connections |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
243 with <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:
2823
diff
changeset
|
249 <directive name="js_fetch_timeout"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
250 <syntax><value>time</value></syntax> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
251 <default>60s</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
252 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
253 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
254 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
255 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
256 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
257 Defines a timeout for reading and writing |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
258 for <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:
2823
diff
changeset
|
259 The timeout is set only between two successive read/write operations, |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
260 not for the whole response. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
261 If no data is transmitted within this time, the connection is closed. |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
262 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
263 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
264 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
265 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
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>file</value></syntax> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
269 <default/> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
270 <context>stream</context> |
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 Specifies a <value>file</value> with trusted CA certificates in the PEM format |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
276 used to |
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">verify</link> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
278 the HTTPS certificate |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
279 with <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:
2823
diff
changeset
|
285 <directive name="js_fetch_verify"> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
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:
2823
diff
changeset
|
287 <default>on</default> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
288 <context>stream</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
289 <context>server</context> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
290 <appeared-in>0.7.4</appeared-in> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
291 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
292 <para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
293 Enables or disables verification of the HTTPS server certificate |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
294 with <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:
2823
diff
changeset
|
295 </para> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
296 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
297 </directive> |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
diff
changeset
|
298 |
a3aee2697d4e
Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2823
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>number</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> |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
303 <context>stream</context> |
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 Sets the verification depth in the HTTPS server certificates chain |
a2852750c379
Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2747
diff
changeset
|
309 with <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>function</value> | <value>module.function</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> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
322 Sets a data filter. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
323 Since <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 a module function can be referenced. |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
325 The filter function is called once at the moment when the stream session reaches |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
326 the <link doc="stream_processing.xml" id="content_phase">content</link> phase. |
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 The filter function is called with the following arguments: |
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 the <link doc="../njs/reference.xml" id="stream">Stream Session</link> object |
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 At this phase, it is possible to perform initialization |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
342 or register a callback with |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
343 the <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 method for each incoming data chunk. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
345 The |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
346 <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
|
347 method may be used to unregister a callback and stop filtering. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
348 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
349 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
350 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
351 <note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
352 As the <literal>js_filter</literal> handler |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
353 returns its result immediately, it supports |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
354 only synchronous operations. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
355 Thus, asynchronous operations such as |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
356 <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
|
357 or |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
358 <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
|
359 are not supported. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
360 </note> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
361 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
362 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
363 </directive> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
364 |
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 <directive name="js_import"> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
367 <syntax><value>module.js</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
368 <value>export_name from module.js</value></syntax> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
369 <default/> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
370 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
371 <context>server</context> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
372 <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
|
373 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
374 <para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
375 Imports a module that implements location and variable handlers in njs. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
376 The <literal>export_name</literal> is used as a namespace |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
377 to access module functions. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
378 If the <literal>export_name</literal> is not specified, |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
379 the module name will be used as a namespace. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
380 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
381 js_import stream.js; |
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 Here, the module name <literal>stream</literal> is used as a namespace |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
384 while accessing exports. |
2680
8751cab1d562
Corrected example description in js_import.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2649
diff
changeset
|
385 If the imported module exports <literal>foo()</literal>, |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
386 <literal>stream.foo</literal> is used to refer to it. |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
387 </para> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
388 |
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 Several <literal>js_import</literal> directives can be specified. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
391 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
392 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
393 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
394 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
395 The directive can be specified on the |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
396 <literal>server</literal> level |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
397 since <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
|
398 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
399 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
400 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
401 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
402 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
403 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
404 <directive name="js_include"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
405 <syntax><value>file</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
406 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
407 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
408 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
409 <para> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
410 Specifies a file that implements server and variable handlers in njs: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
411 <example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
412 nginx.conf: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
413 js_include stream.js; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
414 js_set $js_addr address; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
415 server { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
416 listen 127.0.0.1:12345; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
417 return $js_addr; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
418 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
419 |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
420 stream.js: |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
421 function address(s) { |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
422 return s.remoteAddress; |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
423 } |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
424 </example> |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
425 </para> |
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> |
2823
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
428 The directive was made obsolete in version |
652356b39f0f
Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2773
diff
changeset
|
429 <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
|
430 and was removed in version |
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.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
|
432 The <link id="js_import"/> directive should be used instead. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
433 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
434 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
435 </directive> |
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 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
438 <directive name="js_path"> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
439 <syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
440 <value>path</value></syntax> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
441 <default/> |
2591
f27cedd43e0f
Corrected syntax of js_path in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2534
diff
changeset
|
442 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
443 <context>server</context> |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
444 <appeared-in>0.3.0</appeared-in> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
445 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
446 <para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
447 Sets an additional path for njs modules. |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
448 </para> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
449 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
450 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
451 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
452 The directive can be specified on the |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
453 <literal>server</literal> level |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
454 since <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
|
455 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
456 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
457 |
2352
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
458 </directive> |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
459 |
1101e24c6d14
Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
460 |
3008
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
461 <directive name="js_periodic"> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
462 <syntax><value>function</value> | |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
463 <value>module.function</value> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
464 [<literal>interval</literal>=<value>time</value>] |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
465 [<literal>jitter</literal>=<value>number</value>] |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
466 [<literal>worker_affinity</literal>=<value>mask</value>]</syntax> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
467 <default/> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
468 <context>server</context> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
469 <appeared-in>0.8.1</appeared-in> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
470 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
471 <para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
472 Specifies a content handler to run at regular interval. |
3014
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3011
diff
changeset
|
473 The handler receives a |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3011
diff
changeset
|
474 <link doc="../njs/reference.xml" id="periodic_session">session object</link> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3011
diff
changeset
|
475 as its first argument, |
3008
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
476 it also has access to global objects such as |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
477 <link doc="../njs/reference.xml" id="ngx">ngx</link>. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
478 </para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
479 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
480 <para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
481 The optional <literal>interval</literal> parameter |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
482 sets the interval between two consecutive runs, |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
483 by default, 5 seconds. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
484 </para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
485 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
486 <para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
487 The optional <literal>jitter</literal> parameter sets the time within which |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
488 the location content handler will be randomly delayed, |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
489 by default, there is no delay. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
490 </para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
491 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
492 <para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
493 By default, the <literal>js_handler</literal> is executed on worker process 0. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
494 The optional <literal>worker_affinity</literal> parameter |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
495 allows specifying particular worker processes |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
496 where the location content handler should be executed. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
497 Each worker process set is represented by a bitmask of allowed worker processes. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
498 The <literal>all</literal> mask allows the handler to be executed |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
499 in all worker processes. |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
500 </para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
501 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
502 <para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
503 Example: |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
504 <example> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
505 example.conf: |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
506 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
507 location @periodics { |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
508 # to be run at 1 minute intervals in worker process 0 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
509 js_periodic main.handler interval=60s; |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
510 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
511 # to be run at 1 minute intervals in all worker processes |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
512 js_periodic main.handler interval=60s worker_affinity=all; |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
513 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
514 # to be run at 1 minute intervals in worker processes 1 and 3 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
515 js_periodic main.handler interval=60s worker_affinity=0101; |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
516 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
517 resolver 10.0.0.1; |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
518 js_fetch_trusted_certificate /path/to/ISRG_Root_X1.pem; |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
519 } |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
520 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
521 example.js: |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
522 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
523 async function handler(s) { |
3011
55d49eb065ac
Fixed example in the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3008
diff
changeset
|
524 let reply = await ngx.fetch('https://nginx.org/en/docs/njs/'); |
55d49eb065ac
Fixed example in the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3008
diff
changeset
|
525 let body = await reply.text(); |
3008
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
526 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
527 ngx.log(ngx.INFO, body); |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
528 } |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
529 </example> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
530 </para> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
531 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
532 </directive> |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
533 |
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
534 |
2901
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
535 <directive name="js_preload_object"> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
536 <syntax><value>name.json</value> | |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
537 <value>name</value> from <value>file.json</value></syntax> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
538 <default/> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
539 <context>stream</context> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
540 <context>server</context> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
541 <appeared-in>0.7.8</appeared-in> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
542 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
543 <para> |
2996
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
544 Preloads an |
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
545 <link doc="../njs/preload_objects.xml">immutable object</link> |
98bd95a5ac70
Added link to Preload Objects from js_preload_object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2990
diff
changeset
|
546 at configure time. |
2901
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
547 The <literal>name</literal> is used a name of the global variable |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
548 though which the object is available in njs code. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
549 If the <literal>name</literal> is not specified, |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
550 the file name will be used instead. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
551 <example> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
552 js_preload_object map.json; |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
553 </example> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
554 Here, the <literal>map</literal> is used as a name |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
555 while accessing the preloaded object. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
556 </para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
557 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
558 <para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
559 Several <literal>js_preload_object</literal> directives can be specified. |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
560 </para> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
561 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
562 </directive> |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
563 |
9719a0184a67
Documented the js_preload_object directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2882
diff
changeset
|
564 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
565 <directive name="js_preread"> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
566 <syntax><value>function</value> | <value>module.function</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
567 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
568 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
569 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
570 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
571 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
572 Sets an njs function which will be called at the |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
573 <link doc="stream_processing.xml" id="preread_phase">preread</link> phase. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
574 Since <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
|
575 a module function can be referenced. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
576 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
577 |
2878
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
578 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
579 The function is called once |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
580 at the moment when the stream session reaches the |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
581 <link doc="stream_processing.xml" id="preread_phase">preread</link> phase |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
582 for the first time. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
583 The function is called with the following arguments: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
584 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
585 <list type="tag"> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
586 <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
|
587 <tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
588 the <link doc="../njs/reference.xml" id="stream">Stream Session</link> object |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
589 </tag-desc> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
590 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
591 </list> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
592 </para> |
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 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
595 At this phase, it is possible to perform initialization |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
596 or register a callback with |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
597 the <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
|
598 method |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
599 for each incoming data chunk until one of the following methods are called: |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
600 <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
|
601 <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
|
602 <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
|
603 When one of these methods is called, |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
604 the stream session switches to the |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
605 <link doc="stream_processing.xml">next phase</link> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
606 and all current |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
607 <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
|
608 callbacks are dropped. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
609 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
610 |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
611 <para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
612 <note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
613 As the <literal>js_preread</literal> handler |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
614 returns its result immediately, it supports |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
615 only synchronous callbacks. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
616 Thus, asynchronous callbacks such as |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
617 <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
|
618 or |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
619 <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
|
620 are not supported. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
621 Nevertheless, asynchronous operations are supported in |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
622 <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
|
623 callbacks in the |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
624 <link doc="stream_processing.xml" id="preread_phase">preread</link> phase. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
625 See |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
626 <link url="https://github.com/nginx/njs-examples#authorizing-connections-using-ngx-fetch-as-auth-request-stream-auth-request">this example</link> for more information. |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
627 </note> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
628 </para> |
fd8ec06ceafa
Improved descriptions of js_access, js_filter, js_preread.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2845
diff
changeset
|
629 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
630 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
631 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
632 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
633 <directive name="js_set"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
634 <syntax> |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
635 <value>$variable</value> <value>function</value> | |
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
636 <value>module.function</value></syntax> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
637 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
638 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
639 <context>server</context> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
640 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
641 <para> |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
642 Sets an njs <literal>function</literal> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
643 for the specified <literal>variable</literal>. |
2530
407c5bd5bffc
Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2352
diff
changeset
|
644 Since <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
|
645 a module function can be referenced. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
646 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
647 |
2686
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
648 <para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
649 The function is called when |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
650 the variable is referenced for the first time for a given request. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
651 The exact moment depends on a |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
652 <link doc="stream_processing.xml">phase</link> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
653 at which the variable is referenced. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
654 This can be used to perform some logic |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
655 not related to variable evaluation. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
656 For example, if the variable is referenced only in the |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
657 <link doc="ngx_stream_log_module.xml" id="log_format"/> directive, |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
658 its handler will not be executed until the log phase. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
659 This handler can be used to do some cleanup |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
660 right before the request is freed. |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
661 </para> |
45214e5316cd
Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2680
diff
changeset
|
662 |
2747
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
663 <para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
664 <note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
665 As the <literal>js_set</literal> handler |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
666 returns its result immediately, it supports |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
667 only synchronous callbacks. |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
668 Thus, asynchronous callbacks such as |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
669 <link doc="../njs/reference.xml" id="ngx_fetch">ngx.fetch()</link> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
670 or |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
671 <link doc="../njs/reference.xml" id="settimeout">setTimeout()</link> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
672 are not supported. |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
673 </note> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
674 </para> |
42fb92e582db
Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2697
diff
changeset
|
675 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
676 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
677 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
678 The directive can be specified on the |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
679 <literal>server</literal> level |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
680 since <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
|
681 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
682 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
683 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
684 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
685 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
686 |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
687 <directive name="js_shared_dict_zone"> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
688 <syntax> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
689 <literal>zone</literal>=<value>name</value>:<value>size</value> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
690 [<literal>timeout</literal>=<value>time</value>] |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
691 [<literal>type</literal>=<literal>string</literal>|<literal>number</literal>] |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
692 [<literal>evict</literal>]</syntax> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
693 <default/> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
694 <context>stream</context> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
695 <appeared-in>0.8.0</appeared-in> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
696 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
697 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
698 Sets the <value>name</value> and <value>size</value> of the shared memory zone |
3007
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3000
diff
changeset
|
699 that keeps the |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3000
diff
changeset
|
700 key-value <link doc="../njs/reference.xml" id="dict">dictionary</link> |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
701 shared between worker processes. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
702 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
703 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
704 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
705 By default the shared dictionary uses a string as a key and a value. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
706 The optional <literal>type</literal> parameter |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
707 allows redefining the value type to number. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
708 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
709 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
710 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
711 The optional <literal>timeout</literal> parameter sets |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
712 the time after which all shared dictionary entries are removed from the zone. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
713 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
714 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
715 <para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
716 The optional <literal>evict</literal> parameter removes the oldest |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
717 key-value pair when the zone storage is exhausted. |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
718 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
719 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
720 <para> |
3008
4470b2bff7b7
Documented the js_periodic directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
721 Example: |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
722 <example> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
723 example.conf: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
724 # Creates a 1Mb dictionary with string values, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
725 # removes key-value pairs after 60 seconds of inactivity: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
726 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
|
727 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
728 # Creates a 512Kb dictionary with string values, |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
729 # forcibly removes oldest key-value pairs when the zone is exhausted: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
730 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
|
731 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
732 # Creates a 32Kb permanent dictionary with number values: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
733 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
|
734 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
735 example.js: |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
736 function get(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
737 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
|
738 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
739 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
740 function set(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
741 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
|
742 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
743 |
3000
7eafa16bb07c
Replaced "delete" to "del" in js_shared_dict_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2996
diff
changeset
|
744 function del(r) { |
2990
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
745 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
|
746 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
747 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
748 function increment(r) { |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
749 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
|
750 } |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
751 </example> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
752 </para> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
753 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
754 </directive> |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
755 |
7e83ebfac8ca
Documented the js_shared_dict_zone directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2911
diff
changeset
|
756 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
757 <directive name="js_var"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
758 <syntax><value>$variable</value> [<value>value</value>]</syntax> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
759 <default/> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
760 <context>stream</context> |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
761 <context>server</context> |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
762 <appeared-in>0.5.3</appeared-in> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
763 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
764 <para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
765 Declares |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
766 a <link doc="../njs/reference.xml" id="r_variables">writable</link> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
767 variable. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
768 The value can contain text, variables, and their combination. |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
769 </para> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
770 |
2882
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
771 <para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
772 <note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
773 The directive can be specified on the |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
774 <literal>server</literal> level |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
775 since <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
|
776 </note> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
777 </para> |
986e1f930e3b
Documented server, location, if contexts for some js directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2878
diff
changeset
|
778 |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
779 </directive> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2686
diff
changeset
|
780 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
781 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
782 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
783 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
784 <section id="properties" name="Session Object Properties"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
785 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
786 <para> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2135
diff
changeset
|
787 Each stream njs handler receives one argument, a stream session |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
788 <link doc="../njs/reference.xml" id="stream">object</link>. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
789 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
790 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
791 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
792 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
793 </module> |