annotate xml/en/docs/stream/ngx_stream_js_module.xml @ 2845:a3aee2697d4e

Documented directives for Fetch API in njs.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 05 May 2022 18:31:47 +0100
parents 652356b39f0f
children fd8ec06ceafa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
2845
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
12 rev="31">
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
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
145 </directive>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
146
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
147
2845
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
148 <directive name="js_fetch_buffer_size">
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
149 <syntax><value>size</value></syntax>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
150 <default>16k</default>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
151 <context>stream</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
152 <context>server</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
153 <appeared-in>0.7.4</appeared-in>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
154
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
155 <para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
156 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
157 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
158 </para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
159
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
160 </directive>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
161
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
162
2773
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
163 <directive name="js_fetch_ciphers">
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
164 <syntax><value>ciphers</value></syntax>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
165 <default>HIGH:!aNULL:!MD5</default>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
166 <context>stream</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
167 <context>server</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
168 <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
169
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
170 <para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
171 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
172 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
173 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
174 </para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
175
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
176 <para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
177 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
178 “<command>openssl ciphers</command>” command.
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
179 </para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
180
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
181 </directive>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
182
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
183
2845
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
184 <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
185 <syntax><value>size</value></syntax>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
186 <default>1m</default>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
187 <context>stream</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
188 <context>server</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
189 <appeared-in>0.7.4</appeared-in>
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 <para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
192 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
193 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
194 </para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
195
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
196 </directive>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
197
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
198
2773
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
199 <directive name="js_fetch_protocols">
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
200 <syntax>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
201 [<literal>TLSv1</literal>]
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
202 [<literal>TLSv1.1</literal>]
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
203 [<literal>TLSv1.2</literal>]
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
204 [<literal>TLSv1.3</literal>]</syntax>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
205 <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
206 <context>stream</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
207 <context>server</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
208 <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
209
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 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
212 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
213 </para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
214
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
215 </directive>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
216
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
217
2845
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
218 <directive name="js_fetch_timeout">
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
219 <syntax><value>time</value></syntax>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
220 <default>60s</default>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
221 <context>stream</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
222 <context>server</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
223 <appeared-in>0.7.4</appeared-in>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
224
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 Defines a timeout for reading and writing
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
227 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
228 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
229 not for the whole response.
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
230 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
231 </para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
232
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
233 </directive>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
234
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
235
2773
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
236 <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
237 <syntax><value>file</value></syntax>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
238 <default/>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
239 <context>stream</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
240 <context>server</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
241 <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
242
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
243 <para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
244 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
245 used to
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
246 <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
247 the HTTPS certificate
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
248 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
249 </para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
250
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
251 </directive>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
252
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
253
2845
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
254 <directive name="js_fetch_verify">
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
255 <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
256 <default>on</default>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
257 <context>stream</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
258 <context>server</context>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
259 <appeared-in>0.7.4</appeared-in>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
260
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
261 <para>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
262 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
263 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
264 </para>
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 </directive>
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
267
a3aee2697d4e Documented directives for Fetch API in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2823
diff changeset
268
2773
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
269 <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
270 <syntax><value>number</value></syntax>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
271 <default>100</default>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
272 <context>stream</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
273 <context>server</context>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
274 <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
275
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
276 <para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
277 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
278 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
279 </para>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
280
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
281 </directive>
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
282
a2852750c379 Added fetch directives to js http and stream modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2747
diff changeset
283
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
284 <directive name="js_filter">
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
285 <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
286 <default/>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
287 <context>stream</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
288 <context>server</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
289
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
290 <para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
291 Sets a data filter.
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
292 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
293 a module function can be referenced.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
294 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
295
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
296 </directive>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
297
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
298
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
299 <directive name="js_import">
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
300 <syntax><value>module.js</value> |
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
301 <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
302 <default/>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
303 <context>stream</context>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
304 <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
305
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
306 <para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
307 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
308 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
309 to access module functions.
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
310 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
311 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
312 <example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
313 js_import stream.js;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
314 </example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
315 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
316 while accessing exports.
2680
8751cab1d562 Corrected example description in js_import.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2649
diff changeset
317 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
318 <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
319 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
320
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
321 <para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
322 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
323 </para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
324
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
325 </directive>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
326
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
327
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
328 <directive name="js_include">
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
329 <syntax><value>file</value></syntax>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
330 <default/>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
331 <context>stream</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
332
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
333 <para>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
334 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
335 <example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
336 nginx.conf:
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
337 js_include stream.js;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
338 js_set $js_addr address;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
339 server {
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
340 listen 127.0.0.1:12345;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
341 return $js_addr;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
342 }
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
343
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
344 stream.js:
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
345 function address(s) {
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
346 return s.remoteAddress;
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
347 }
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
348 </example>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
349 </para>
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
350
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
351 <para>
2823
652356b39f0f Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2773
diff changeset
352 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
353 <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
354 and was removed in version
652356b39f0f Added info about removal of the js_import directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2773
diff changeset
355 <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
356 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
357 </para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
358
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
359 </directive>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
360
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
361
2352
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
362 <directive name="js_path">
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
363 <syntax>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
364 <value>path</value></syntax>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
365 <default/>
2591
f27cedd43e0f Corrected syntax of js_path in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2534
diff changeset
366 <context>stream</context>
2352
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
367 <appeared-in>0.3.0</appeared-in>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
368
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
369 <para>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
370 Sets an additional path for njs modules.
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
371 </para>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
372
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
373 </directive>
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
374
1101e24c6d14 Documented the js_path directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2332
diff changeset
375
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
376 <directive name="js_preread">
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
377 <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
378 <default/>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
379 <context>stream</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
380 <context>server</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
381
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
382 <para>
2128
59a3cc84f507 Renamed nginScript to njs
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2026
diff changeset
383 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
384 <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
385 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
386 a module function can be referenced.
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
387 </para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
388
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
389 </directive>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
390
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
391
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
392 <directive name="js_set">
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
393 <syntax>
2530
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
394 <value>$variable</value> <value>function</value> |
407c5bd5bffc Documented the js_import directive and corresponding changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2352
diff changeset
395 <value>module.function</value></syntax>
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
396 <default/>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
397 <context>stream</context>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
398
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
399 <para>
2686
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
400 Sets an njs <literal>function</literal>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
401 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
402 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
403 a module function can be referenced.
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
404 </para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
405
2686
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
406 <para>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
407 The function is called when
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
408 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
409 The exact moment depends on a
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
410 <link doc="stream_processing.xml">phase</link>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
411 at which the variable is referenced.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
412 This can be used to perform some logic
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
413 not related to variable evaluation.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
414 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
415 <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
416 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
417 This handler can be used to do some cleanup
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
418 right before the request is freed.
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
419 </para>
45214e5316cd Improved description of js_set.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2680
diff changeset
420
2747
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
421 <para>
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
422 <note>
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
423 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
424 returns its result immediately, it supports
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
425 only synchronous callbacks.
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
426 Thus, asynchronous callbacks such as
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
427 <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
428 or
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
429 <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
430 are not supported.
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
431 </note>
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
432 </para>
42fb92e582db Added note to js_set about asyncronous calls.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2697
diff changeset
433
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
434 </directive>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
435
2693
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
436
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
437 <directive name="js_var">
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
438 <syntax><value>$variable</value> [<value>value</value>]</syntax>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
439 <default/>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
440 <context>stream</context>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
441 <appeared-in>0.5.3</appeared-in>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
442
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
443 <para>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
444 Declares
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
445 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
446 variable.
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
447 The value can contain text, variables, and their combination.
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
448 </para>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
449
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
450 </directive>
3cbd6e440581 Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2686
diff changeset
451
1840
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
452 </section>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
453
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
454
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
455 <section id="properties" name="Session Object Properties">
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
456
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
457 <para>
2175
cd4889fdcfa4 Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2135
diff changeset
458 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
459 <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
460 </para>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
461
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
462 </section>
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
463
15632fc2d548 Documented http and stream nginScript modules.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff changeset
464 </module>