Mercurial > hg > nginx-site
comparison xml/en/docs/njs/reference.xml @ 2670:e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Fri, 05 Mar 2021 18:22:39 +0000 |
parents | e067ad74b0cd |
children | 8f3e9ff2785f |
comparison
equal
deleted
inserted
replaced
2669:5c4199cfdc16 | 2670:e53592a1d979 |
---|---|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> | 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
8 | 8 |
9 <article name="Reference" | 9 <article name="Reference" |
10 link="/en/docs/njs/reference.html" | 10 link="/en/docs/njs/reference.html" |
11 lang="en" | 11 lang="en" |
12 rev="66"> | 12 rev="67"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 <link doc="index.xml">njs</link> provides objects, methods and properties | 17 <link doc="index.xml">njs</link> provides objects, methods and properties |
468 <para> | 468 <para> |
469 <list type="tag"> | 469 <list type="tag"> |
470 | 470 |
471 <tag-name id="s_allow"><literal>s.allow()</literal></tag-name> | 471 <tag-name id="s_allow"><literal>s.allow()</literal></tag-name> |
472 <tag-desc> | 472 <tag-desc> |
473 successfully finalizes the phase handler | 473 an alias to |
474 <link id="s_done"><literal>s.done(0)</literal></link> | |
474 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) | 475 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
475 </tag-desc> | 476 </tag-desc> |
476 | 477 |
477 <tag-name id="s_decline"><literal>s.decline()</literal></tag-name> | 478 <tag-name id="s_decline"><literal>s.decline()</literal></tag-name> |
478 <tag-desc> | 479 <tag-desc> |
479 finalizes the phase handler and passes control to the next handler | 480 an alias to |
481 <link id="s_done"><literal>s.done(-5)</literal></link> | |
480 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) | 482 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
481 </tag-desc> | 483 </tag-desc> |
482 | 484 |
483 <tag-name id="s_deny"><literal>s.deny()</literal></tag-name> | 485 <tag-name id="s_deny"><literal>s.deny()</literal></tag-name> |
484 <tag-desc> | 486 <tag-desc> |
485 finalizes the phase handler with the access error code | 487 an alias to |
488 <link id="s_done"><literal>s.done(403)</literal></link> | |
486 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) | 489 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
487 </tag-desc> | 490 </tag-desc> |
488 | 491 |
489 <tag-name id="s_done"><literal>s.done</literal>(<value>[code]</value>)</tag-name> | 492 <tag-name id="s_done"><literal>s.done([<value>code</value>]</literal>)</tag-name> |
490 <tag-desc> | 493 <tag-desc> |
491 successfully finalizes the current phase handler | 494 sets an exit <literal>code</literal> for the current |
492 or finalizes it with the specified numeric code | 495 <link doc="../stream/stream_processing.xml">phase</link> handler |
496 to a code value, by default <literal>0</literal>. | |
497 The actual finalization happens when the js handler is completed | |
498 and all pending events, for example, from | |
499 <link id="ngx_fetch"><literal>ngx.fetch</literal></link> or | |
500 <link id="settimeout"><literal>setTimeout()</literal></link>, | |
501 are processed | |
493 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>). | 502 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>). |
503 <para> | |
504 Possible code values: | |
505 <list type="bullet"> | |
506 | |
507 <listitem> | |
508 <literal>0</literal>— | |
509 successful finalization, passing control to the next phase | |
510 </listitem> | |
511 | |
512 <listitem> | |
513 <literal>-5</literal>— | |
514 undecided, passing control to the next handler of the current phase (if any) | |
515 </listitem> | |
516 | |
517 <listitem> | |
518 <literal>403</literal>— | |
519 access is forbidden | |
520 </listitem> | |
521 | |
522 </list> | |
523 </para> | |
524 May be called only from a phase handler function: | |
525 <link doc="../stream/ngx_stream_js_module.xml" id="js_access"><literal>js_access</literal></link> | |
526 or | |
527 <link doc="../stream/ngx_stream_js_module.xml" id="js_preread"><literal>js_preread</literal></link>. | |
494 </tag-desc> | 528 </tag-desc> |
495 | 529 |
496 <tag-name id="s_error"><literal>s.error(<value>string</value>)</literal></tag-name> | 530 <tag-name id="s_error"><literal>s.error(<value>string</value>)</literal></tag-name> |
497 <tag-desc> | 531 <tag-desc> |
498 writes a sent <literal>string</literal> to the error log | 532 writes a sent <literal>string</literal> to the error log |