Mercurial > hg > nginx-site
annotate xml/en/docs/stream/ngx_stream_js_module.xml @ 2254:d765ffffd08c
Documented proxy_socket_keepalive and friends.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 09 Oct 2018 19:56:33 +0300 |
parents | 32ba43abf9cd |
children | 54dbe105fe77 |
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" |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
12 rev="15"> |
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 This module is not built by default. |
523dc4cc8745
Updated installation procedure in njs modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
24 Download and install instructions are available |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
25 <link doc="../njs/install.xml">here</link>. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
26 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
27 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
28 </section> |
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 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
31 <section id="example" name="Example Configuration"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 <para> |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
34 <note> |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
35 This example is valid for |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
36 njs <link doc="../njs/changes.xml" id="njs0.2.4">0.2.4</link>. |
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
37 For njs <link doc="../njs/changes.xml" id="njs0.2.3">0.2.3</link> |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
38 and earlier, use |
2245
87a0e2c73a25
Refactored njs documentation.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
39 <link doc="../njs/examples.xml" id="legacy">this</link> example. |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
40 </note> |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
41 <example> |
2190
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
42 load_module modules/ngx_stream_js_module.so; |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
43 ... |
dfc49994218c
Updated example in HTTP njs module.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2188
diff
changeset
|
44 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
45 stream { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
46 js_include stream.js; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
47 |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
48 js_set $bar bar; |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
49 js_set $req_line req_line; |
1858
36cbfff92c6d
Restricted context of js_set directive to http and stream only.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1853
diff
changeset
|
50 |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
52 listen 12345; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
54 js_preread preread; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
55 return $req_line; |
1840
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 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
59 listen 12346; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
60 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
61 js_access access; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
62 proxy_pass 127.0.0.1:8000; |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
63 js_filter header_inject; |
1840
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 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
67 http { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 server { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 listen 8000; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 location / { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 return 200 $http_foo\n; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 } |
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 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
75 </example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
76 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
77 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
78 <para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
79 The <path>stream.js</path> file: |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
80 <example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
81 var line = ''; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
82 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
83 function bar(s) { |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
84 var v = s.variables; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
85 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
|
86 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
|
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 function preread(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
90 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
|
91 var n = data.indexOf('\n'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
92 if (n != -1) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
93 line = data.substr(0, n); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
94 s.done(); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
95 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
96 }); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
97 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
98 |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
99 function req_line(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
100 return line; |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
101 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
103 // Read HTTP request line. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
104 // Collect bytes in 'req' until |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
105 // request line is read. |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
106 // Injects HTTP header into a client's request |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
107 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
108 var my_header = 'Foo: foo'; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
109 function header_inject(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
110 var req = ''; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
111 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
|
112 req += data; |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
113 var n = req.search('\n'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
114 if (n != -1) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 s.off('upload'); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
119 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
120 }); |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
121 } |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
122 |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
123 function access(s) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
124 if (s.remoteAddress.match('^192.*')) { |
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
125 s.abort(); |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
126 return; |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
127 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
128 |
2237
5268c13196f2
Documented njs changes triggered by njs-0.2.4.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2190
diff
changeset
|
129 s.allow(); |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
130 } |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
131 </example> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
132 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
133 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
134 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
135 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
136 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
137 <section id="directives" name="Directives"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
138 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
139 <directive name="js_access"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
140 <syntax><value>function</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
141 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
142 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
145 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
146 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
|
147 <link doc="stream_processing.xml" id="access_phase">access</link> phase. |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
148 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
149 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
150 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
151 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
152 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
153 <directive name="js_filter"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
154 <syntax><value>function</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
155 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
156 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
157 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
158 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
159 <para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
160 Sets a data filter. |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
161 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
162 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
163 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
164 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
165 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
166 <directive name="js_include"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
167 <syntax><value>file</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
168 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
169 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
170 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
171 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
172 Specifies a file that implements server and variable handlers in njs. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
174 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
175 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
178 <directive name="js_preread"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
179 <syntax><value>function</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
180 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
181 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
182 <context>server</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
183 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
184 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
185 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
|
186 <link doc="stream_processing.xml" id="preread_phase">preread</link> phase. |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
187 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
188 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
189 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
190 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
191 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
192 <directive name="js_set"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
193 <syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 <value>$variable</value> <value>function</value></syntax> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
195 <default/> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 <context>stream</context> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
198 <para> |
2128
59a3cc84f507
Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2026
diff
changeset
|
199 Sets an njs function for the specified variable. |
1840
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
200 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
201 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
202 </directive> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
203 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
204 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
205 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
206 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
207 <section id="properties" name="Session Object Properties"> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
208 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
209 <para> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2135
diff
changeset
|
210 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
|
211 <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
|
212 </para> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
213 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
214 </section> |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
215 |
15632fc2d548
Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
216 </module> |