Mercurial > hg > nginx-site
annotate xml/ru/docs/njs/reference.xml @ 2270:cd9934924920
Moved summary to top of njs index page.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Mon, 29 Oct 2018 21:45:06 +0300 |
parents | 32ba43abf9cd |
children | 65c6c1ee3c78 |
rev | line source |
---|---|
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
9 <article name="Справочник" |
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2244
diff
changeset
|
10 link="/ru/docs/njs/reference.html" |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="ru" |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
12 rev="1"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
2244
467aef18bf12
Renamed the "About njs" page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2189
diff
changeset
|
17 <link doc="index.xml">njs</link> предоставляет объекты, методы и свойства |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
18 для расширения функциональности nginx. |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
19 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
20 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
21 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
22 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
23 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
24 <section id="http" name="HTTP"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
25 |
2189
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
26 <para> |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
27 Объект <literal>HTTP</literal> доступен только в |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
28 модуле <link doc="../http/ngx_http_js_module.xml">ngx_http_js_module</link>. |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
29 Все строки в объекте <literal>HTTP</literal> являются |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
30 <link id="strings">байтовыми строками</link>. |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
31 </para> |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
32 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
33 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
34 <section id="http_request" name="Запрос"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
35 |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
36 <para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
37 <list type="tag"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
38 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
39 <tag-name><literal>r.args{}</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
40 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
41 объект аргументов запроса, только чтение |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
42 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
43 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
44 <tag-name><literal>r.error(<value>строка</value>)</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
45 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
46 записывает <literal>строку</literal> в лог-файл ошибок |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
47 на уровне лога <literal>error</literal> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
48 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
49 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
50 <tag-name><literal>r.finish()</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
51 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
52 завершает отправку ответа клиенту |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
53 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
54 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
55 <tag-name><literal>r.headersIn{}</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
56 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
57 объект исходящих заголовков, только чтение. |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
58 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
59 Например, доступ к заголовку <literal>Header-Name</literal> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
60 можно получить при помощи синтаксиса <literal>headers['Header-Name']</literal> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
61 или <literal>headers.Header_name</literal> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
62 </para> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
63 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
64 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
65 <tag-name><literal>r.headersOut{}</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
66 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
67 объект исходящих заголовков, доступно для записи. |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
68 <para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
69 Например, доступ к заголовку <literal>Header-Name</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
70 можно получить при помощи синтаксиса <literal>headers['Header-Name']</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
71 или <literal>headers.Header_name</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
72 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
73 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
74 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
75 <tag-name><literal>r.httpVersion</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
76 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
77 версия HTTP, только чтение |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
78 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
79 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
80 <tag-name><literal>r.log(<value>строка</value>)</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
81 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
82 записывает <literal>строку</literal> в лог-файл ошибок |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
83 на уровне лога <literal>info</literal> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
84 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
85 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
86 <tag-name><literal>r.method</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
87 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
88 HTTP метод, только чтение |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
89 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
90 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
91 <tag-name><literal>r.parent</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
92 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
93 ссылается на родительский объект запроса |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
94 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
95 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
96 <tag-name><literal>r.remoteAddress</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
97 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
98 адрес клиента, только чтение |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
99 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
100 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
101 <tag-name><literal>r.requestBody</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
102 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
103 хранит тело запроса, только чтение |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
104 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
105 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
106 <tag-name><literal>r.responseBody</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
107 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
108 хранит тело ответа <link id="subrequest">подзапроса</link>, только чтение |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
109 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
110 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
111 <tag-name><literal>r.return(код[, строка])</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
112 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
113 отправляет |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
114 клиенту полный ответ с указанным <literal>кодом</literal> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
115 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
116 Можно задать или URL перенаправления |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
117 (для кодов 301, 302, 303, 307 и 308), |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
118 или текст тела ответа (для остальных кодов) в качестве второго аргумента |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
119 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
120 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
121 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
122 <tag-name><literal>r.send(<value>строка</value>)</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
123 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
124 отправляет часть тела ответа клиенту |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
125 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
126 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
127 <tag-name><literal>r.sendHeader()</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
128 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
129 отправляет заголовок HTTP клиенту |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
130 </tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
131 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
132 <tag-name><literal>r.status</literal></tag-name> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
133 <tag-desc> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
134 статус, доступно для записи |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
135 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
136 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
137 <tag-name><literal>req.variables{}</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
138 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
139 объект переменных nginx, только чтение |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
140 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
141 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
142 <tag-name><literal>r.warn(<value>строка</value>)</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
143 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
144 записывает <literal>строку</literal> в лог-файл ошибок |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
145 на уровне лога <literal>warning</literal> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
146 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
147 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
148 <tag-name><literal>r.uri</literal></tag-name> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
149 <tag-desc> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
150 текущий URI, только чтение |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
151 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
152 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
153 <tag-name id="subrequest"><literal>r.subrequest(<value>uri</value>[, |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
154 <value>options</value>[, <value>callback</value>]])</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
155 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
156 создаёт подзапрос с заданными <literal>uri</literal> и |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
157 <literal>options</literal> и |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
158 устанавливает необязательный <literal>callback</literal> завершения. |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
159 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
160 <para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
161 Если <literal>options</literal> является строкой, то в ней |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
162 содержится срока аргументов подзапроса. |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
163 В противном случае ожидается, что <literal>options</literal> является объектом |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
164 со следующими ключами: |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
165 |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
166 <list type="tag"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
167 <tag-name><literal>args</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
168 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
169 строка с аргументами |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
170 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
171 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
172 <tag-name><literal>body</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
173 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
174 тело запроса |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
175 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
176 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
177 <tag-name><literal>method</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
178 <tag-desc |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
179 >метод HTTP |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
180 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
181 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
182 </list> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
183 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
184 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
185 <para> |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
186 <literal>callback</literal> получает |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
187 объект ответа подзапроса с методами и свойствами, |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
188 идентичными родительскому объекту запроса. |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
189 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
190 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
191 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
192 </list> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
193 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
194 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
195 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
196 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
197 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
198 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
199 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
200 <section id="stream" name="Stream"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
201 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
202 <para> |
2189
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
203 Объект <literal>stream</literal> доступен только в |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
204 модуле |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
205 <link doc="../stream/ngx_stream_js_module.xml">ngx_stream_js_module</link>. |
2189
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
206 Все строки в объекте <literal>stream</literal> являются |
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
207 <link id="strings">байтовыми строками</link>. |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
208 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
209 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
210 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
211 <section id="stream_session" name="Сессия"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
212 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
213 <para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
214 <list type="tag"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
215 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
216 <tag-name><literal>s.remoteAddress</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
217 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
218 адрес клиента, только чтение |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
219 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
220 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
221 <tag-name><literal>s.eof</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
222 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
223 логическое свойство, |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
224 true, если текущий буфер является последним буфером, |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
225 только чтение |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
226 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
227 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
228 <tag-name><literal>s.fromUpstream</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
229 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
230 логическое свойство, |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
231 true, если текущий буфер является буфером от проксируемого сервера к клиенту, |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
232 только чтение |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
233 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
234 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
235 <tag-name><literal>s.buffer</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
236 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
237 текущий буфер, доступен для записи |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
238 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
239 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
240 <tag-name><literal>s.variables{}</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
241 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
242 объект переменных nginx, только чтение |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
243 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
244 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
245 <tag-name><literal>s.OK</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
246 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
247 код <literal>OK</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
248 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
249 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
250 <tag-name><literal>s.DECLINED</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
251 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
252 код <literal>DECLINED</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
253 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
254 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
255 <tag-name><literal>s.AGAIN</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
256 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
257 код <literal>AGAIN</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
258 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
259 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
260 <tag-name><literal>s.ERROR</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
261 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
262 код <literal>ERROR</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
263 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
264 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
265 <tag-name><literal>s.ABORT</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
266 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
267 код <literal>ABORT</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
268 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
269 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
270 <tag-name><literal>s.log(<value>строка</value>)</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
271 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
272 записывает отправленную <value>строку</value> в лог-файл ошибок |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
273 на уровне лога <literal>info</literal> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
274 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
275 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
276 <tag-name><literal>s.warn(<value>строка</value>)</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
277 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
278 записывает отправленную <literal>строку</literal> в лог-файл ошибок |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
279 на уровне лога <literal>warning</literal> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
280 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
281 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
282 <tag-name><literal>s.error(<value>строка</value>)</literal></tag-name> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
283 <tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
284 записывает отправленную <literal>строку</literal> в лог-файл ошибок |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
285 на уровне лога <literal>error</literal> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
286 </tag-desc> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
287 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
288 </list> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
289 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
290 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
291 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
292 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
293 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
294 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
295 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
296 <section id="example" name="Примеры"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
297 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
298 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
299 <section id="example_urldecode" name="Декодирование URL"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
300 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
301 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
302 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
303 js_include urldecode.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
304 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
305 js_set $decoded_foo decoded_foo; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
306 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
307 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
308 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
309 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
310 Файл <path>urldecode.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
311 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
312 function decoded_foo(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
313 return decodeURIComponent(r.args.foo); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
314 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
315 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
316 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
317 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
318 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
319 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
320 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
321 <section id="example_urlencode" name="Кодирование URL"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
322 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
323 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
324 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
325 js_include urlencode.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
326 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
327 js_set $encoded_foo encoded_foo; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
328 ... |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
329 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
330 location / { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
331 proxy_pass http://example.com?foo=$encoded_foo; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
332 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
333 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
334 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
335 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
336 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
337 Файл <path>urlencode.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
338 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
339 function encoded_foo(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
340 return encodeURIComponent('foo & bar?'); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
341 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
342 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
343 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
344 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
345 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
346 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
347 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
348 <section id="example_fast_response" name="Возврат самого быстрого ответа от прокси"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
349 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
350 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
351 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
352 js_include fastresponse.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
353 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
354 location /start { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
355 js_content content; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
356 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
357 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
358 location /foo { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
359 proxy_pass http://backend1; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
360 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
361 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
362 location /bar { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
363 proxy_pass http://backend2; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
364 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
365 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
366 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
367 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
368 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
369 Файл <path>fastresponse.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
370 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
371 function content(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
372 var n = 0; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
373 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
374 function done(res) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
375 if (n++ == 0) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
376 r.return(res.status, res.responseBody); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
377 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
378 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
379 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
380 r.subrequest('/foo', r.variables.args, done); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
381 r.subrequest('/bar', r.variables.args, done);TBD |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
382 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
383 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
384 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
385 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
386 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
387 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
388 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
389 <section id="example_jwt" name="Создание HS JWT"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
390 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
391 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
392 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
393 js_include hs_jwt.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
394 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
395 js_set $jwt jwt; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
396 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
397 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
398 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
399 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
400 Файл <path>hs_jwt.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
401 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
402 function create_hs256_jwt(claims, key, valid) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
403 var header = { "typ" : "JWT", "alg" : "HS256", "exp" : Date.now() + valid }; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
404 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
405 var s = JSON.stringify(header).toBytes().toString('base64url') + '.' |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
406 + JSON.stringify(claims).toBytes().toString('base64url'); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
407 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
408 var h = require('crypto').createHmac('sha256', key); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
409 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
410 return s + '.' + h.update(s).digest().toString('base64url'); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
411 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
412 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
413 function jwt(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
414 var claims = { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
415 "iss" : "nginx", |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
416 "sub" : "alice", |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
417 "foo" : 123, |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
418 "bar" : "qq", |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
419 "zyx" : false |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
420 }; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
421 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
422 return create_hs256_jwt(claims, 'foo', 600); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
423 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
424 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
425 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
426 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
427 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
428 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
429 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
430 <section id="example_subrequest" name="Доступ к API при помощи подзапроса"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
431 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
432 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
433 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
434 js_include subrequest.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
435 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
436 keyval_zone zone=foo:10m; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
437 ... |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
438 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
439 location /keyval { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
440 js_content set_keyval; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
441 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
442 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
443 location /version { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
444 js_content version; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
445 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
446 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
447 location /api { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
448 api write=on; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
449 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
450 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
451 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
452 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
453 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
454 Файл <path>subrequest.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
455 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
456 function set_keyval(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
457 r.subrequest('/api/3/http/keyvals/foo', |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
458 { method: 'POST', |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
459 body: JSON.stringify({ foo: 789, bar: "ss dd 00" })}, |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
460 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
461 function(res) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
462 if (res.status >= 300) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
463 r.return(res.status, res.responseBody); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
464 return; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
465 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
466 r.return(500); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
467 }); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
468 } |
2189
23cfb62121d1
Mentioned byte strings for njs HTTP and stream objects.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2182
diff
changeset
|
469 |
2182
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
470 function version(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
471 r.subrequest('/api/3/nginx', { method: 'GET' }, function(res) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
472 if (res.status != 200) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
473 r.return(res.status); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
474 return; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
475 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
476 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
477 var json = JSON.parse(res.responseBody); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
478 r.return(200, json.version); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
479 }); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
480 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
481 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
482 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
483 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
484 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
485 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
486 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
487 <section id="example_secure_link" name="Создание хэша secure_link"> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
488 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
489 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
490 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
491 js_include hash.js; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
492 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
493 js_set $new_foo create_secure_link; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
494 ... |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
495 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
496 location / { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
497 secure_link $cookie_foo; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
498 secure_link_md5 "$uri mykey"; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
499 ... |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
500 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
501 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
502 location @login { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
503 add_header Set-Cookie "foo=$new_foo; Max-Age=60"; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
504 return 302 /; |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
505 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
506 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
507 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
508 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
509 <para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
510 Файл <path>hash.js</path>: |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
511 <example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
512 function create_secure_link(r) { |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
513 return require('crypto').createHash('md5') |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
514 .update(r.uri).update(" mykey") |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
515 .digest('base64url'); |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
516 } |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
517 </example> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
518 </para> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
519 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
520 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
521 |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
522 </section> |
7865ca0da0ab
Merged HTTP request,response, and reply in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2175
diff
changeset
|
523 |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
524 </article> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
525 |