Mercurial > hg > nginx-site
comparison xml/en/docs/dev/development_guide.xml @ 1935:be7490a66d1b
Style: use long dash with non-breaking space where appropriate.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 16 Mar 2017 15:53:09 +0300 |
parents | 937e03180281 |
children | 8f996938fe23 |
comparison
equal
deleted
inserted
replaced
1934:a0a64fee6b13 | 1935:be7490a66d1b |
---|---|
17 <section name="Code layout" id="code_layout"> | 17 <section name="Code layout" id="code_layout"> |
18 | 18 |
19 <para> | 19 <para> |
20 <list type="bullet"> | 20 <list type="bullet"> |
21 <listitem> | 21 <listitem> |
22 <literal>auto</literal> - build scripts | 22 <literal>auto</literal> — build scripts |
23 </listitem> | 23 </listitem> |
24 | 24 |
25 <listitem> | 25 <listitem> |
26 <literal>src</literal> | 26 <literal>src</literal> |
27 | 27 |
28 <list type="bullet"> | 28 <list type="bullet"> |
29 | 29 |
30 <listitem> | 30 <listitem> |
31 <literal>core</literal> - basic types and functions - string, array, log, | 31 <literal>core</literal> — basic types and functions — string, array, log, |
32 pool etc | 32 pool etc |
33 </listitem> | 33 </listitem> |
34 | 34 |
35 <listitem> | 35 <listitem> |
36 <literal>event</literal> - event core | 36 <literal>event</literal> — event core |
37 | 37 |
38 <list type="bullet"> | 38 <list type="bullet"> |
39 | 39 |
40 <listitem> | 40 <listitem> |
41 <literal>modules</literal> - event notification modules: epoll, kqueue, | 41 <literal>modules</literal> — event notification modules: epoll, kqueue, |
42 select etc | 42 select etc |
43 </listitem> | 43 </listitem> |
44 | 44 |
45 </list> | 45 </list> |
46 | 46 |
47 </listitem> | 47 </listitem> |
48 | 48 |
49 <listitem> | 49 <listitem> |
50 <literal>http</literal> - core HTTP module and common code | 50 <literal>http</literal> — core HTTP module and common code |
51 | 51 |
52 <list type="bullet"> | 52 <list type="bullet"> |
53 | 53 |
54 <listitem> | 54 <listitem> |
55 <literal>modules</literal> - other HTTP modules | 55 <literal>modules</literal> — other HTTP modules |
56 </listitem> | 56 </listitem> |
57 | 57 |
58 <listitem> | 58 <listitem> |
59 <literal>v2</literal> - HTTPv2 | 59 <literal>v2</literal> — HTTPv2 |
60 </listitem> | 60 </listitem> |
61 | 61 |
62 </list> | 62 </list> |
63 | 63 |
64 </listitem> | 64 </listitem> |
65 | 65 |
66 <listitem> | 66 <listitem> |
67 <literal>mail</literal> - mail modules | 67 <literal>mail</literal> — mail modules |
68 </listitem> | 68 </listitem> |
69 | 69 |
70 <listitem> | 70 <listitem> |
71 <literal>os</literal> - platform-specific code | 71 <literal>os</literal> — platform-specific code |
72 | 72 |
73 <list type="bullet"> | 73 <list type="bullet"> |
74 | 74 |
75 <listitem> | 75 <listitem> |
76 <literal>unix</literal> | 76 <literal>unix</literal> |
83 </list> | 83 </list> |
84 | 84 |
85 </listitem> | 85 </listitem> |
86 | 86 |
87 <listitem> | 87 <listitem> |
88 <literal>stream</literal> - stream modules | 88 <literal>stream</literal> — stream modules |
89 </listitem> | 89 </listitem> |
90 | 90 |
91 </list> | 91 </list> |
92 | 92 |
93 </listitem> | 93 </listitem> |
159 | 159 |
160 <para> | 160 <para> |
161 <list type="bullet"> | 161 <list type="bullet"> |
162 | 162 |
163 <listitem> | 163 <listitem> |
164 <literal>NGX_OK</literal> - operation succeeded | 164 <literal>NGX_OK</literal> — operation succeeded |
165 </listitem> | 165 </listitem> |
166 | 166 |
167 <listitem> | 167 <listitem> |
168 <literal>NGX_ERROR</literal> - operation failed | 168 <literal>NGX_ERROR</literal> — operation failed |
169 </listitem> | 169 </listitem> |
170 | 170 |
171 <listitem> | 171 <listitem> |
172 <literal>NGX_AGAIN</literal> - operation incomplete, function should be called | 172 <literal>NGX_AGAIN</literal> — operation incomplete, function should be called |
173 again | 173 again |
174 </listitem> | 174 </listitem> |
175 | 175 |
176 <listitem> | 176 <listitem> |
177 <literal>NGX_DECLINED</literal> - operation rejected, for example, if disabled | 177 <literal>NGX_DECLINED</literal> — operation rejected, for example, if disabled |
178 in configuration. This is never an error | 178 in configuration. This is never an error |
179 </listitem> | 179 </listitem> |
180 | 180 |
181 <listitem> | 181 <listitem> |
182 <literal>NGX_BUSY</literal> - resource is not available | 182 <literal>NGX_BUSY</literal> — resource is not available |
183 </listitem> | 183 </listitem> |
184 | 184 |
185 <listitem> | 185 <listitem> |
186 <literal>NGX_DONE</literal> - operation done or continued elsewhere. | 186 <literal>NGX_DONE</literal> — operation done or continued elsewhere. |
187 Also used as an alternative success code | 187 Also used as an alternative success code |
188 </listitem> | 188 </listitem> |
189 | 189 |
190 <listitem> | 190 <listitem> |
191 <literal>NGX_ABORT</literal> - function was aborted. | 191 <literal>NGX_ABORT</literal> — function was aborted. |
192 Also used as an alternative error code | 192 Also used as an alternative error code |
193 </listitem> | 193 </listitem> |
194 | 194 |
195 </list> | 195 </list> |
196 </para> | 196 </para> |
441 in <path>src/core/ngx_string.c</path>. Some of them are: | 441 in <path>src/core/ngx_string.c</path>. Some of them are: |
442 </para> | 442 </para> |
443 | 443 |
444 | 444 |
445 <programlisting> | 445 <programlisting> |
446 %O - off_t | 446 %O — off_t |
447 %T - time_t | 447 %T — time_t |
448 %z - size_t | 448 %z — size_t |
449 %i - ngx_int_t | 449 %i — ngx_int_t |
450 %p - void * | 450 %p — void * |
451 %V - ngx_str_t * | 451 %V — ngx_str_t * |
452 %s - u_char * (null-terminated) | 452 %s — u_char * (null-terminated) |
453 %*s - size_t + u_char * | 453 %*s — size_t + u_char * |
454 </programlisting> | 454 </programlisting> |
455 | 455 |
456 <para> | 456 <para> |
457 The ‘u’ modifier makes most types unsigned, ‘X’/‘x’ convert output to hex. | 457 The ‘u’ modifier makes most types unsigned, ‘X’/‘x’ convert output to hex. |
458 </para> | 458 </para> |
465 size_t len; | 465 size_t len; |
466 ngx_int_t n; | 466 ngx_int_t n; |
467 | 467 |
468 /* set n here */ | 468 /* set n here */ |
469 | 469 |
470 len = ngx_sprintf(buf, "%ui", n) - buf; | 470 len = ngx_sprintf(buf, "%ui", n) — buf; |
471 </programlisting> | 471 </programlisting> |
472 | 472 |
473 </para> | 473 </para> |
474 | 474 |
475 </section> | 475 </section> |
483 | 483 |
484 <para> | 484 <para> |
485 <list type="bullet"> | 485 <list type="bullet"> |
486 | 486 |
487 <listitem> | 487 <listitem> |
488 <literal>ngx_atoi(line, n)</literal> - converts a string of given length to a | 488 <literal>ngx_atoi(line, n)</literal> — converts a string of given length to a |
489 positive integer of type <literal>ngx_int_t</literal>. | 489 positive integer of type <literal>ngx_int_t</literal>. |
490 Returns <literal>NGX_ERROR</literal> on error | 490 Returns <literal>NGX_ERROR</literal> on error |
491 </listitem> | 491 </listitem> |
492 | 492 |
493 <listitem> | 493 <listitem> |
494 <literal>ngx_atosz(line, n)</literal> - same for <literal>ssize_t</literal> | 494 <literal>ngx_atosz(line, n)</literal> — same for <literal>ssize_t</literal> |
495 type | 495 type |
496 </listitem> | 496 </listitem> |
497 | 497 |
498 <listitem> | 498 <listitem> |
499 <literal>ngx_atoof(line, n)</literal> - same for <literal>off_t</literal> | 499 <literal>ngx_atoof(line, n)</literal> — same for <literal>off_t</literal> |
500 type | 500 type |
501 </listitem> | 501 </listitem> |
502 | 502 |
503 <listitem> | 503 <listitem> |
504 <literal>ngx_atotm(line, n)</literal> - same for <literal>time_t</literal> | 504 <literal>ngx_atotm(line, n)</literal> — same for <literal>time_t</literal> |
505 type | 505 type |
506 </listitem> | 506 </listitem> |
507 | 507 |
508 <listitem> | 508 <listitem> |
509 <literal>ngx_atofp(line, n, point)</literal> - converts a fixed point floating | 509 <literal>ngx_atofp(line, n, point)</literal> — converts a fixed point floating |
510 number of given length to a positive integer of type | 510 number of given length to a positive integer of type |
511 <literal>ngx_int_t</literal>. | 511 <literal>ngx_int_t</literal>. |
512 The result is shifted left by <literal>points</literal> decimal | 512 The result is shifted left by <literal>points</literal> decimal |
513 positions. The string representation of the number is expected to have no more | 513 positions. The string representation of the number is expected to have no more |
514 than <literal>points</literal> fractional digits. | 514 than <literal>points</literal> fractional digits. |
515 Returns <literal>NGX_ERROR</literal> on error. For example, | 515 Returns <literal>NGX_ERROR</literal> on error. For example, |
516 <literal>ngx_atofp("10.5", 4, 2)</literal> returns <literal>1050</literal> | 516 <literal>ngx_atofp("10.5", 4, 2)</literal> returns <literal>1050</literal> |
517 </listitem> | 517 </listitem> |
518 | 518 |
519 <listitem> | 519 <listitem> |
520 <literal>ngx_hextoi(line, n)</literal> - converts hexadecimal representation of | 520 <literal>ngx_hextoi(line, n)</literal> — converts hexadecimal representation of |
521 a positive integer to <literal>ngx_int_t</literal>. Returns | 521 a positive integer to <literal>ngx_int_t</literal>. Returns |
522 <literal>NGX_ERROR</literal> on error | 522 <literal>NGX_ERROR</literal> on error |
523 </listitem> | 523 </listitem> |
524 | 524 |
525 </list> | 525 </list> |
611 ngx_str_t name, value; | 611 ngx_str_t name, value; |
612 | 612 |
613 /* all captures */ | 613 /* all captures */ |
614 for (i = 0; i < n * 2; i += 2) { | 614 for (i = 0; i < n * 2; i += 2) { |
615 value.data = input.data + captures[i]; | 615 value.data = input.data + captures[i]; |
616 value.len = captures[i + 1] - captures[i]; | 616 value.len = captures[i + 1] — captures[i]; |
617 } | 617 } |
618 | 618 |
619 /* accessing named captures */ | 619 /* accessing named captures */ |
620 | 620 |
621 size = rc.name_size; | 621 size = rc.name_size; |
629 | 629 |
630 n = 2 * ((p[0] << 8) + p[1]); | 630 n = 2 * ((p[0] << 8) + p[1]); |
631 | 631 |
632 /* captured value */ | 632 /* captured value */ |
633 value.data = &input.data[captures[n]]; | 633 value.data = &input.data[captures[n]]; |
634 value.len = captures[n + 1] - captures[n]; | 634 value.len = captures[n + 1] — captures[n]; |
635 } | 635 } |
636 </programlisting> | 636 </programlisting> |
637 </para> | 637 </para> |
638 | 638 |
639 <para> | 639 <para> |
860 <para> | 860 <para> |
861 <list type="bullet"> | 861 <list type="bullet"> |
862 | 862 |
863 <listitem> | 863 <listitem> |
864 <literal>ngx_queue_insert_head(h, x)</literal>, | 864 <literal>ngx_queue_insert_head(h, x)</literal>, |
865 <literal>ngx_queue_insert_tail(h, x)</literal> - insert a new node | 865 <literal>ngx_queue_insert_tail(h, x)</literal> — insert a new node |
866 </listitem> | 866 </listitem> |
867 | 867 |
868 <listitem> | 868 <listitem> |
869 <literal>ngx_queue_remove(x)</literal> - remove a queue node | 869 <literal>ngx_queue_remove(x)</literal> — remove a queue node |
870 </listitem> | 870 </listitem> |
871 | 871 |
872 <listitem> | 872 <listitem> |
873 <literal>ngx_queue_split(h, q, n)</literal> - split a queue at a node, | 873 <literal>ngx_queue_split(h, q, n)</literal> — split a queue at a node, |
874 queue tail is returned in a separate queue | 874 queue tail is returned in a separate queue |
875 </listitem> | 875 </listitem> |
876 | 876 |
877 <listitem> | 877 <listitem> |
878 <literal>ngx_queue_add(h, n)</literal> - add second queue to the first queue | 878 <literal>ngx_queue_add(h, n)</literal> — add second queue to the first queue |
879 </listitem> | 879 </listitem> |
880 | 880 |
881 <listitem> | 881 <listitem> |
882 <literal>ngx_queue_head(h)</literal>, | 882 <literal>ngx_queue_head(h)</literal>, |
883 <literal>ngx_queue_last(h)</literal> - get first or last queue node | 883 <literal>ngx_queue_last(h)</literal> — get first or last queue node |
884 </listitem> | 884 </listitem> |
885 | 885 |
886 <listitem> | 886 <listitem> |
887 <literal>ngx_queue_sentinel(h)</literal> | 887 <literal>ngx_queue_sentinel(h)</literal> |
888 - get a queue sentinel object to end iteration at | 888 - get a queue sentinel object to end iteration at |
889 </listitem> | 889 </listitem> |
890 | 890 |
891 <listitem> | 891 <listitem> |
892 <literal>ngx_queue_data(q, type, link)</literal> - get reference to the beginning of a | 892 <literal>ngx_queue_data(q, type, link)</literal> — get reference to the beginning of a |
893 queue node data structure, considering the queue field offset in it | 893 queue node data structure, considering the queue field offset in it |
894 </listitem> | 894 </listitem> |
895 | 895 |
896 </list> | 896 </list> |
897 </para> | 897 </para> |
1239 | 1239 |
1240 <para> | 1240 <para> |
1241 The lookup in a combined hash is handled by the | 1241 The lookup in a combined hash is handled by the |
1242 <literal>ngx_hash_find_combined(chash, key, name, len)</literal>: | 1242 <literal>ngx_hash_find_combined(chash, key, name, len)</literal>: |
1243 <programlisting> | 1243 <programlisting> |
1244 /* key = "bar.example.org"; - will match ".example.org" */ | 1244 /* key = "bar.example.org"; — will match ".example.org" */ |
1245 /* key = "foo.example.com"; - will match "foo.*" */ | 1245 /* key = "foo.example.com"; — will match "foo.*" */ |
1246 | 1246 |
1247 hkey = ngx_hash_key(key.data, key.len); | 1247 hkey = ngx_hash_key(key.data, key.len); |
1248 res = ngx_hash_find_combined(&foo_hash, hkey, key.data, key.len); | 1248 res = ngx_hash_find_combined(&foo_hash, hkey, key.data, key.len); |
1249 </programlisting> | 1249 </programlisting> |
1250 </para> | 1250 </para> |
1268 | 1268 |
1269 <para> | 1269 <para> |
1270 <list type="bullet"> | 1270 <list type="bullet"> |
1271 | 1271 |
1272 <listitem> | 1272 <listitem> |
1273 <literal>ngx_alloc(size, log)</literal> - allocate memory from system heap. | 1273 <literal>ngx_alloc(size, log)</literal> — allocate memory from system heap. |
1274 This is a wrapper around <literal>malloc()</literal> with logging support. | 1274 This is a wrapper around <literal>malloc()</literal> with logging support. |
1275 Allocation error and debugging information is logged to <literal>log</literal> | 1275 Allocation error and debugging information is logged to <literal>log</literal> |
1276 </listitem> | 1276 </listitem> |
1277 | 1277 |
1278 <listitem> | 1278 <listitem> |
1279 <literal>ngx_calloc(size, log)</literal> - same as | 1279 <literal>ngx_calloc(size, log)</literal> — same as |
1280 <literal>ngx_alloc()</literal>, but memory is filled with zeroes after | 1280 <literal>ngx_alloc()</literal>, but memory is filled with zeroes after |
1281 allocation | 1281 allocation |
1282 </listitem> | 1282 </listitem> |
1283 | 1283 |
1284 <listitem> | 1284 <listitem> |
1285 <literal>ngx_memalign(alignment, size, log)</literal> - allocate aligned memory | 1285 <literal>ngx_memalign(alignment, size, log)</literal> — allocate aligned memory |
1286 from system heap. This is a wrapper around <literal>posix_memalign()</literal> | 1286 from system heap. This is a wrapper around <literal>posix_memalign()</literal> |
1287 on those platforms which provide it. | 1287 on those platforms which provide it. |
1288 Otherwise implementation falls back to <literal>ngx_alloc()</literal> which | 1288 Otherwise implementation falls back to <literal>ngx_alloc()</literal> which |
1289 provides maximum alignment | 1289 provides maximum alignment |
1290 </listitem> | 1290 </listitem> |
1291 | 1291 |
1292 <listitem> | 1292 <listitem> |
1293 <literal>ngx_free(p)</literal> - free allocated memory. | 1293 <literal>ngx_free(p)</literal> — free allocated memory. |
1294 This is a wrapper around <literal>free()</literal> | 1294 This is a wrapper around <literal>free()</literal> |
1295 </listitem> | 1295 </listitem> |
1296 | 1296 |
1297 </list> | 1297 </list> |
1298 </para> | 1298 </para> |
1323 | 1323 |
1324 <para> | 1324 <para> |
1325 <list type="bullet"> | 1325 <list type="bullet"> |
1326 | 1326 |
1327 <listitem> | 1327 <listitem> |
1328 <literal>ngx_create_pool(size, log)</literal> - create a pool with given | 1328 <literal>ngx_create_pool(size, log)</literal> — create a pool with given |
1329 block size. The pool object returned is allocated in the pool as well. | 1329 block size. The pool object returned is allocated in the pool as well. |
1330 </listitem> | 1330 </listitem> |
1331 | 1331 |
1332 <listitem> | 1332 <listitem> |
1333 <literal>ngx_destroy_pool(pool)</literal> - free all pool memory, including | 1333 <literal>ngx_destroy_pool(pool)</literal> — free all pool memory, including |
1334 the pool object itself. | 1334 the pool object itself. |
1335 </listitem> | 1335 </listitem> |
1336 | 1336 |
1337 <listitem> | 1337 <listitem> |
1338 <literal>ngx_palloc(pool, size)</literal> - allocate aligned memory from pool | 1338 <literal>ngx_palloc(pool, size)</literal> — allocate aligned memory from pool |
1339 </listitem> | 1339 </listitem> |
1340 | 1340 |
1341 <listitem> | 1341 <listitem> |
1342 <literal>ngx_pcalloc(pool, size)</literal> - allocated aligned memory | 1342 <literal>ngx_pcalloc(pool, size)</literal> — allocated aligned memory |
1343 from pool and fill it with zeroes | 1343 from pool and fill it with zeroes |
1344 </listitem> | 1344 </listitem> |
1345 | 1345 |
1346 <listitem> | 1346 <listitem> |
1347 <literal>ngx_pnalloc(pool, size)</literal> - allocate unaligned memory from pool. | 1347 <literal>ngx_pnalloc(pool, size)</literal> — allocate unaligned memory from pool. |
1348 Mostly used for allocating strings | 1348 Mostly used for allocating strings |
1349 </listitem> | 1349 </listitem> |
1350 | 1350 |
1351 <listitem> | 1351 <listitem> |
1352 <literal>ngx_pfree(pool, p)</literal> - free memory, previously allocated | 1352 <literal>ngx_pfree(pool, p)</literal> — free memory, previously allocated |
1353 in the pool. | 1353 in the pool. |
1354 Only allocations, forwarded to the system allocator, can be freed. | 1354 Only allocations, forwarded to the system allocator, can be freed. |
1355 </listitem> | 1355 </listitem> |
1356 | 1356 |
1357 </list> | 1357 </list> |
1451 | 1451 |
1452 <para> | 1452 <para> |
1453 <list type="bullet"> | 1453 <list type="bullet"> |
1454 | 1454 |
1455 <listitem> | 1455 <listitem> |
1456 <literal>init</literal> - initialization callback, called after shared zone is | 1456 <literal>init</literal> — initialization callback, called after shared zone is |
1457 mapped to actual memory | 1457 mapped to actual memory |
1458 </listitem> | 1458 </listitem> |
1459 | 1459 |
1460 <listitem> | 1460 <listitem> |
1461 <literal>data</literal> - data context, used to pass arbitrary data to the | 1461 <literal>data</literal> — data context, used to pass arbitrary data to the |
1462 <literal>init</literal> callback | 1462 <literal>init</literal> callback |
1463 </listitem> | 1463 </listitem> |
1464 | 1464 |
1465 <listitem> | 1465 <listitem> |
1466 <literal>noreuse</literal> - flag, disabling shared zone reuse from the | 1466 <literal>noreuse</literal> — flag, disabling shared zone reuse from the |
1467 old cycle | 1467 old cycle |
1468 </listitem> | 1468 </listitem> |
1469 | 1469 |
1470 <listitem> | 1470 <listitem> |
1471 <literal>tag</literal> - shared zone tag | 1471 <literal>tag</literal> — shared zone tag |
1472 </listitem> | 1472 </listitem> |
1473 | 1473 |
1474 <listitem> | 1474 <listitem> |
1475 <literal>shm</literal> - platform-specific object of type | 1475 <literal>shm</literal> — platform-specific object of type |
1476 <literal>ngx_shm_t</literal>, having at least the following fields: | 1476 <literal>ngx_shm_t</literal>, having at least the following fields: |
1477 <list type="bullet"> | 1477 <list type="bullet"> |
1478 | 1478 |
1479 <listitem> | 1479 <listitem> |
1480 <literal>addr</literal> - mapped shared memory address, initially NULL | 1480 <literal>addr</literal> — mapped shared memory address, initially NULL |
1481 </listitem> | 1481 </listitem> |
1482 | 1482 |
1483 <listitem> | 1483 <listitem> |
1484 <literal>size</literal> - shared memory size | 1484 <literal>size</literal> — shared memory size |
1485 </listitem> | 1485 </listitem> |
1486 | 1486 |
1487 <listitem> | 1487 <listitem> |
1488 <literal>name</literal> - shared memory name | 1488 <literal>name</literal> — shared memory name |
1489 </listitem> | 1489 </listitem> |
1490 | 1490 |
1491 <listitem> | 1491 <listitem> |
1492 <literal>log</literal> - shared memory log | 1492 <literal>log</literal> — shared memory log |
1493 </listitem> | 1493 </listitem> |
1494 | 1494 |
1495 <listitem> | 1495 <listitem> |
1496 <literal>exists</literal> - flag, showing that shared memory was inherited | 1496 <literal>exists</literal> — flag, showing that shared memory was inherited |
1497 from the master process (Windows-specific) | 1497 from the master process (Windows-specific) |
1498 </listitem> | 1498 </listitem> |
1499 | 1499 |
1500 </list> | 1500 </list> |
1501 </listitem> | 1501 </listitem> |
1625 Nginx logger provides support for several types of output: | 1625 Nginx logger provides support for several types of output: |
1626 | 1626 |
1627 <list type="bullet"> | 1627 <list type="bullet"> |
1628 | 1628 |
1629 <listitem> | 1629 <listitem> |
1630 stderr - logging to standard error output | 1630 stderr — logging to standard error output |
1631 </listitem> | 1631 </listitem> |
1632 | 1632 |
1633 <listitem> | 1633 <listitem> |
1634 file - logging to file | 1634 file — logging to file |
1635 </listitem> | 1635 </listitem> |
1636 | 1636 |
1637 <listitem> | 1637 <listitem> |
1638 syslog - logging to syslog | 1638 syslog — logging to syslog |
1639 </listitem> | 1639 </listitem> |
1640 | 1640 |
1641 <listitem> | 1641 <listitem> |
1642 memory - logging to internal memory storage for development purposes. | 1642 memory — logging to internal memory storage for development purposes. |
1643 The memory could be accessed later with debugger | 1643 The memory could be accessed later with debugger |
1644 </listitem> | 1644 </listitem> |
1645 | 1645 |
1646 </list> | 1646 </list> |
1647 </para> | 1647 </para> |
1746 | 1746 |
1747 <para> | 1747 <para> |
1748 <list type="bullet"> | 1748 <list type="bullet"> |
1749 | 1749 |
1750 <listitem> | 1750 <listitem> |
1751 <literal>ngx_log_error(level, log, err, fmt, ...)</literal> - error logging | 1751 <literal>ngx_log_error(level, log, err, fmt, ...)</literal> — error logging |
1752 </listitem> | 1752 </listitem> |
1753 | 1753 |
1754 <listitem> | 1754 <listitem> |
1755 <literal>ngx_log_debug0(level, log, err, fmt)</literal>, | 1755 <literal>ngx_log_debug0(level, log, err, fmt)</literal>, |
1756 <literal>ngx_log_debug1(level, log, err, fmt, arg1)</literal> etc - debug | 1756 <literal>ngx_log_debug1(level, log, err, fmt, arg1)</literal> etc — debug |
1757 logging, up to 8 formatting arguments are supported | 1757 logging, up to 8 formatting arguments are supported |
1758 </listitem> | 1758 </listitem> |
1759 | 1759 |
1760 </list> | 1760 </list> |
1761 </para> | 1761 </para> |
1831 | 1831 |
1832 <para> | 1832 <para> |
1833 <list type="bullet"> | 1833 <list type="bullet"> |
1834 | 1834 |
1835 <listitem> | 1835 <listitem> |
1836 <literal>pool</literal> - cycle pool. Created for each new cycle | 1836 <literal>pool</literal> — cycle pool. Created for each new cycle |
1837 </listitem> | 1837 </listitem> |
1838 | 1838 |
1839 <listitem> | 1839 <listitem> |
1840 <literal>log</literal> - cycle log. Initially, this log is inherited from the | 1840 <literal>log</literal> — cycle log. Initially, this log is inherited from the |
1841 old cycle. | 1841 old cycle. |
1842 After reading configuration, this member is set to point to | 1842 After reading configuration, this member is set to point to |
1843 <literal>new_log</literal> | 1843 <literal>new_log</literal> |
1844 </listitem> | 1844 </listitem> |
1845 | 1845 |
1846 <listitem> | 1846 <listitem> |
1847 <literal>new_log</literal> - cycle log, created by the configuration. | 1847 <literal>new_log</literal> — cycle log, created by the configuration. |
1848 It's affected by the root scope <literal>error_log</literal> directive | 1848 It's affected by the root scope <literal>error_log</literal> directive |
1849 </listitem> | 1849 </listitem> |
1850 | 1850 |
1851 <listitem> | 1851 <listitem> |
1852 <literal>connections</literal>, <literal>connections_n</literal> - per-worker | 1852 <literal>connections</literal>, <literal>connections_n</literal> — per-worker |
1853 array of connections of type <literal>ngx_connection_t</literal>, created by | 1853 array of connections of type <literal>ngx_connection_t</literal>, created by |
1854 the event module while initializing each nginx worker. | 1854 the event module while initializing each nginx worker. |
1855 The number of connections is set by the <literal>worker_connections</literal> | 1855 The number of connections is set by the <literal>worker_connections</literal> |
1856 directive | 1856 directive |
1857 </listitem> | 1857 </listitem> |
1858 | 1858 |
1859 <listitem> | 1859 <listitem> |
1860 <literal>free_connections</literal>, | 1860 <literal>free_connections</literal>, |
1861 <literal>free_connections_n</literal> - the and number of currently available | 1861 <literal>free_connections_n</literal> — the and number of currently available |
1862 connections. | 1862 connections. |
1863 If no connections are available, nginx worker refuses to accept new clients | 1863 If no connections are available, nginx worker refuses to accept new clients |
1864 </listitem> | 1864 </listitem> |
1865 | 1865 |
1866 <listitem> | 1866 <listitem> |
1867 <literal>files</literal>, <literal>files_n</literal> - array for mapping file | 1867 <literal>files</literal>, <literal>files_n</literal> — array for mapping file |
1868 descriptors to nginx connections. | 1868 descriptors to nginx connections. |
1869 This mapping is used by the event modules, having the | 1869 This mapping is used by the event modules, having the |
1870 <literal>NGX_USE_FD_EVENT</literal> flag (currently, it's poll and devpoll) | 1870 <literal>NGX_USE_FD_EVENT</literal> flag (currently, it's poll and devpoll) |
1871 </listitem> | 1871 </listitem> |
1872 | 1872 |
1873 <listitem> | 1873 <listitem> |
1874 <literal>conf_ctx</literal> - array of core module configurations. | 1874 <literal>conf_ctx</literal> — array of core module configurations. |
1875 The configurations are created and filled while reading nginx configuration | 1875 The configurations are created and filled while reading nginx configuration |
1876 files | 1876 files |
1877 </listitem> | 1877 </listitem> |
1878 | 1878 |
1879 <listitem> | 1879 <listitem> |
1880 <literal>modules</literal>, <literal>modules_n</literal> - array of modules | 1880 <literal>modules</literal>, <literal>modules_n</literal> — array of modules |
1881 <literal>ngx_module_t</literal>, both static and dynamic, loaded by current | 1881 <literal>ngx_module_t</literal>, both static and dynamic, loaded by current |
1882 configuration | 1882 configuration |
1883 </listitem> | 1883 </listitem> |
1884 | 1884 |
1885 <listitem> | 1885 <listitem> |
1886 <literal>listening</literal> - array of listening objects | 1886 <literal>listening</literal> — array of listening objects |
1887 <literal>ngx_listening_t</literal>. | 1887 <literal>ngx_listening_t</literal>. |
1888 Listening objects are normally added by the the <literal>listen</literal> | 1888 Listening objects are normally added by the the <literal>listen</literal> |
1889 directive of different modules which call the | 1889 directive of different modules which call the |
1890 <literal>ngx_create_listening()</literal> function. | 1890 <literal>ngx_create_listening()</literal> function. |
1891 Based on listening objects, listen sockets are created by nginx | 1891 Based on listening objects, listen sockets are created by nginx |
1892 </listitem> | 1892 </listitem> |
1893 | 1893 |
1894 <listitem> | 1894 <listitem> |
1895 <literal>paths</literal> - array of paths <literal>ngx_path_t</literal>. | 1895 <literal>paths</literal> — array of paths <literal>ngx_path_t</literal>. |
1896 Paths are added by calling the function <literal>ngx_add_path()</literal> from | 1896 Paths are added by calling the function <literal>ngx_add_path()</literal> from |
1897 modules which are going to operate on certain directories. | 1897 modules which are going to operate on certain directories. |
1898 These directories are created by nginx after reading configuration, if missing. | 1898 These directories are created by nginx after reading configuration, if missing. |
1899 Moreover, two handlers can be added for each path: | 1899 Moreover, two handlers can be added for each path: |
1900 | 1900 |
1901 <list type="bullet"> | 1901 <list type="bullet"> |
1902 | 1902 |
1903 <listitem> | 1903 <listitem> |
1904 path loader - executed only once in 60 seconds after starting or reloading | 1904 path loader — executed only once in 60 seconds after starting or reloading |
1905 nginx. Normally, reads the directory and stores data in nginx shared | 1905 nginx. Normally, reads the directory and stores data in nginx shared |
1906 memory. The handler is called from a dedicated nginx process "nginx | 1906 memory. The handler is called from a dedicated nginx process "nginx |
1907 cache loader" | 1907 cache loader" |
1908 </listitem> | 1908 </listitem> |
1909 | 1909 |
1910 <listitem> | 1910 <listitem> |
1911 path manager - executed periodically. Normally, removes old files from the | 1911 path manager — executed periodically. Normally, removes old files from the |
1912 directory and reflects these changes in nginx memory. The handler is | 1912 directory and reflects these changes in nginx memory. The handler is |
1913 called from a dedicated nginx process "nginx cache manager" | 1913 called from a dedicated nginx process "nginx cache manager" |
1914 </listitem> | 1914 </listitem> |
1915 | 1915 |
1916 </list> | 1916 </list> |
1917 </listitem> | 1917 </listitem> |
1918 | 1918 |
1919 <listitem> | 1919 <listitem> |
1920 <literal>open_files</literal> - list of <literal>ngx_open_file_t</literal> | 1920 <literal>open_files</literal> — list of <literal>ngx_open_file_t</literal> |
1921 objects. | 1921 objects. |
1922 An open file object is created by calling the function | 1922 An open file object is created by calling the function |
1923 <literal>ngx_conf_open_file()</literal>. | 1923 <literal>ngx_conf_open_file()</literal>. |
1924 After reading configuration nginx opens all files from the | 1924 After reading configuration nginx opens all files from the |
1925 <literal>open_files</literal> list and stores file descriptors in the | 1925 <literal>open_files</literal> list and stores file descriptors in the |
1930 In this case the <literal>fd</literal> fields are changed to new descriptors. | 1930 In this case the <literal>fd</literal> fields are changed to new descriptors. |
1931 The open files are currently used for logging | 1931 The open files are currently used for logging |
1932 </listitem> | 1932 </listitem> |
1933 | 1933 |
1934 <listitem> | 1934 <listitem> |
1935 <literal>shared_memory</literal> - list of shared memory zones, each added by | 1935 <literal>shared_memory</literal> — list of shared memory zones, each added by |
1936 calling the <literal>ngx_shared_memory_add()</literal> function. | 1936 calling the <literal>ngx_shared_memory_add()</literal> function. |
1937 Shared zones are mapped to the same address range in all nginx processes and | 1937 Shared zones are mapped to the same address range in all nginx processes and |
1938 are used to share common data, for example HTTP cache in-memory tree | 1938 are used to share common data, for example HTTP cache in-memory tree |
1939 </listitem> | 1939 </listitem> |
1940 | 1940 |
1962 | 1962 |
1963 <para> | 1963 <para> |
1964 <list type="bullet"> | 1964 <list type="bullet"> |
1965 | 1965 |
1966 <listitem> | 1966 <listitem> |
1967 <literal>start</literal>, <literal>end</literal> - the boundaries of memory | 1967 <literal>start</literal>, <literal>end</literal> — the boundaries of memory |
1968 block, allocated for the buffer | 1968 block, allocated for the buffer |
1969 </listitem> | 1969 </listitem> |
1970 | 1970 |
1971 <listitem> | 1971 <listitem> |
1972 <literal>pos</literal>, <literal>last</literal> - memory buffer boundaries, | 1972 <literal>pos</literal>, <literal>last</literal> — memory buffer boundaries, |
1973 normally a subrange of <literal>start</literal> .. <literal>end</literal> | 1973 normally a subrange of <literal>start</literal> .. <literal>end</literal> |
1974 </listitem> | 1974 </listitem> |
1975 | 1975 |
1976 <listitem> | 1976 <listitem> |
1977 <literal>file_pos</literal>, <literal>file_last</literal> - file buffer | 1977 <literal>file_pos</literal>, <literal>file_last</literal> — file buffer |
1978 boundaries, these are offsets from the beginning of the file | 1978 boundaries, these are offsets from the beginning of the file |
1979 </listitem> | 1979 </listitem> |
1980 | 1980 |
1981 <listitem> | 1981 <listitem> |
1982 <literal>tag</literal> - unique value, used to distinguish buffers, created by | 1982 <literal>tag</literal> — unique value, used to distinguish buffers, created by |
1983 different nginx module, usually, for the purpose of buffer reuse | 1983 different nginx module, usually, for the purpose of buffer reuse |
1984 </listitem> | 1984 </listitem> |
1985 | 1985 |
1986 <listitem> | 1986 <listitem> |
1987 <literal>file</literal> - file object | 1987 <literal>file</literal> — file object |
1988 </listitem> | 1988 </listitem> |
1989 | 1989 |
1990 <listitem> | 1990 <listitem> |
1991 <literal>temporary</literal> - flag, meaning that the buffer references | 1991 <literal>temporary</literal> — flag, meaning that the buffer references |
1992 writable memory | 1992 writable memory |
1993 </listitem> | 1993 </listitem> |
1994 | 1994 |
1995 <listitem> | 1995 <listitem> |
1996 <literal>memory</literal> - flag, meaning that the buffer references read-only | 1996 <literal>memory</literal> — flag, meaning that the buffer references read-only |
1997 memory | 1997 memory |
1998 </listitem> | 1998 </listitem> |
1999 | 1999 |
2000 <listitem> | 2000 <listitem> |
2001 <literal>in_file</literal> - flag, meaning that current buffer references data | 2001 <literal>in_file</literal> — flag, meaning that current buffer references data |
2002 in a file | 2002 in a file |
2003 </listitem> | 2003 </listitem> |
2004 | 2004 |
2005 <listitem> | 2005 <listitem> |
2006 <literal>flush</literal> - flag, meaning that all data prior to this buffer | 2006 <literal>flush</literal> — flag, meaning that all data prior to this buffer |
2007 should be flushed | 2007 should be flushed |
2008 </listitem> | 2008 </listitem> |
2009 | 2009 |
2010 <listitem> | 2010 <listitem> |
2011 <literal>recycled</literal> - flag, meaning that the buffer can be reused and | 2011 <literal>recycled</literal> — flag, meaning that the buffer can be reused and |
2012 should be consumed as soon as possible | 2012 should be consumed as soon as possible |
2013 </listitem> | 2013 </listitem> |
2014 | 2014 |
2015 <listitem> | 2015 <listitem> |
2016 <literal>sync</literal> - flag, meaning that the buffer carries no data or | 2016 <literal>sync</literal> — flag, meaning that the buffer carries no data or |
2017 special signal like <literal>flush</literal> or <literal>last_buf</literal>. | 2017 special signal like <literal>flush</literal> or <literal>last_buf</literal>. |
2018 Normally, such buffers are considered an error by nginx. This flags allows | 2018 Normally, such buffers are considered an error by nginx. This flags allows |
2019 skipping the error checks | 2019 skipping the error checks |
2020 </listitem> | 2020 </listitem> |
2021 | 2021 |
2022 <listitem> | 2022 <listitem> |
2023 <literal>last_buf</literal> - flag, meaning that current buffer is the last in | 2023 <literal>last_buf</literal> — flag, meaning that current buffer is the last in |
2024 output | 2024 output |
2025 </listitem> | 2025 </listitem> |
2026 | 2026 |
2027 <listitem> | 2027 <listitem> |
2028 <literal>last_in_chain</literal> - flag, meaning that there's no more data | 2028 <literal>last_in_chain</literal> — flag, meaning that there's no more data |
2029 buffers in a (sub)request | 2029 buffers in a (sub)request |
2030 </listitem> | 2030 </listitem> |
2031 | 2031 |
2032 <listitem> | 2032 <listitem> |
2033 <literal>shadow</literal> - reference to another buffer, related to the current | 2033 <literal>shadow</literal> — reference to another buffer, related to the current |
2034 buffer. Usually current buffer uses data from the shadow buffer. Once current | 2034 buffer. Usually current buffer uses data from the shadow buffer. Once current |
2035 buffer is consumed, the shadow buffer should normally also be marked as | 2035 buffer is consumed, the shadow buffer should normally also be marked as |
2036 consumed | 2036 consumed |
2037 </listitem> | 2037 </listitem> |
2038 | 2038 |
2039 <listitem> | 2039 <listitem> |
2040 <literal>last_shadow</literal> - flag, meaning that current buffer is the last | 2040 <literal>last_shadow</literal> — flag, meaning that current buffer is the last |
2041 buffer, referencing a particular shadow buffer | 2041 buffer, referencing a particular shadow buffer |
2042 </listitem> | 2042 </listitem> |
2043 | 2043 |
2044 <listitem> | 2044 <listitem> |
2045 <literal>temp_file</literal> - flag, meaning that the buffer is in a temporary | 2045 <literal>temp_file</literal> — flag, meaning that the buffer is in a temporary |
2046 file | 2046 file |
2047 </listitem> | 2047 </listitem> |
2048 | 2048 |
2049 </list> | 2049 </list> |
2050 </para> | 2050 </para> |
2142 | 2142 |
2143 <para> | 2143 <para> |
2144 <list type="bullet"> | 2144 <list type="bullet"> |
2145 | 2145 |
2146 <listitem> | 2146 <listitem> |
2147 <literal>fd</literal> - socket descriptor | 2147 <literal>fd</literal> — socket descriptor |
2148 </listitem> | 2148 </listitem> |
2149 | 2149 |
2150 <listitem> | 2150 <listitem> |
2151 <literal>data</literal> - arbitrary connection context. | 2151 <literal>data</literal> — arbitrary connection context. |
2152 Normally, a pointer to a higher level object, built on top of the connection, | 2152 Normally, a pointer to a higher level object, built on top of the connection, |
2153 like HTTP request or Stream session | 2153 like HTTP request or Stream session |
2154 </listitem> | 2154 </listitem> |
2155 | 2155 |
2156 <listitem> | 2156 <listitem> |
2157 <literal>read</literal>, <literal>write</literal> - read and write events for | 2157 <literal>read</literal>, <literal>write</literal> — read and write events for |
2158 the connection | 2158 the connection |
2159 </listitem> | 2159 </listitem> |
2160 | 2160 |
2161 <listitem> | 2161 <listitem> |
2162 <literal>recv</literal>, <literal>send</literal>, | 2162 <literal>recv</literal>, <literal>send</literal>, |
2163 <literal>recv_chain</literal>, <literal>send_chain</literal> - I/O operations | 2163 <literal>recv_chain</literal>, <literal>send_chain</literal> — I/O operations |
2164 for the connection | 2164 for the connection |
2165 </listitem> | 2165 </listitem> |
2166 | 2166 |
2167 <listitem> | 2167 <listitem> |
2168 <literal>pool</literal> - connection pool | 2168 <literal>pool</literal> — connection pool |
2169 </listitem> | 2169 </listitem> |
2170 | 2170 |
2171 <listitem> | 2171 <listitem> |
2172 <literal>log</literal> - connection log | 2172 <literal>log</literal> — connection log |
2173 </listitem> | 2173 </listitem> |
2174 | 2174 |
2175 <listitem> | 2175 <listitem> |
2176 <literal>sockaddr</literal>, <literal>socklen</literal>, | 2176 <literal>sockaddr</literal>, <literal>socklen</literal>, |
2177 <literal>addr_text</literal> - remote socket address in binary and text forms | 2177 <literal>addr_text</literal> — remote socket address in binary and text forms |
2178 </listitem> | 2178 </listitem> |
2179 | 2179 |
2180 <listitem> | 2180 <listitem> |
2181 <literal>local_sockaddr</literal>, <literal>local_socklen</literal> - local | 2181 <literal>local_sockaddr</literal>, <literal>local_socklen</literal> — local |
2182 socket address in binary form. | 2182 socket address in binary form. |
2183 Initially, these fields are empty. | 2183 Initially, these fields are empty. |
2184 Function <literal>ngx_connection_local_sockaddr()</literal> should be used to | 2184 Function <literal>ngx_connection_local_sockaddr()</literal> should be used to |
2185 get socket local address | 2185 get socket local address |
2186 </listitem> | 2186 </listitem> |
2190 - PROXY protocol client address and port, if PROXY protocol is enabled for the | 2190 - PROXY protocol client address and port, if PROXY protocol is enabled for the |
2191 connection | 2191 connection |
2192 </listitem> | 2192 </listitem> |
2193 | 2193 |
2194 <listitem> | 2194 <listitem> |
2195 <literal>ssl</literal> - nginx connection SSL context | 2195 <literal>ssl</literal> — nginx connection SSL context |
2196 </listitem> | 2196 </listitem> |
2197 | 2197 |
2198 <listitem> | 2198 <listitem> |
2199 <literal>reusable</literal> - flag, meaning, that the connection is at the | 2199 <literal>reusable</literal> — flag, meaning, that the connection is at the |
2200 state, when it can be reused | 2200 state, when it can be reused |
2201 </listitem> | 2201 </listitem> |
2202 | 2202 |
2203 <listitem> | 2203 <listitem> |
2204 <literal>close</literal> - flag, meaning, that the connection is being reused | 2204 <literal>close</literal> — flag, meaning, that the connection is being reused |
2205 and should be closed | 2205 and should be closed |
2206 </listitem> | 2206 </listitem> |
2207 | 2207 |
2208 </list> | 2208 </list> |
2209 </para> | 2209 </para> |
2273 | 2273 |
2274 <para> | 2274 <para> |
2275 <list type="bullet"> | 2275 <list type="bullet"> |
2276 | 2276 |
2277 <listitem> | 2277 <listitem> |
2278 <literal>data</literal> - arbitrary event context, used in event handler, | 2278 <literal>data</literal> — arbitrary event context, used in event handler, |
2279 usually, a pointer to a connection, tied with the event | 2279 usually, a pointer to a connection, tied with the event |
2280 </listitem> | 2280 </listitem> |
2281 | 2281 |
2282 <listitem> | 2282 <listitem> |
2283 <literal>handler</literal> - callback function to be invoked when the event | 2283 <literal>handler</literal> — callback function to be invoked when the event |
2284 happens | 2284 happens |
2285 </listitem> | 2285 </listitem> |
2286 | 2286 |
2287 <listitem> | 2287 <listitem> |
2288 <literal>write</literal> - flag, meaning that this is the write event. | 2288 <literal>write</literal> — flag, meaning that this is the write event. |
2289 Used to distinguish between read and write events | 2289 Used to distinguish between read and write events |
2290 </listitem> | 2290 </listitem> |
2291 | 2291 |
2292 <listitem> | 2292 <listitem> |
2293 <literal>active</literal> - flag, meaning that the event is registered for | 2293 <literal>active</literal> — flag, meaning that the event is registered for |
2294 receiving I/O notifications, normally from notification mechanisms like epoll, | 2294 receiving I/O notifications, normally from notification mechanisms like epoll, |
2295 kqueue, poll | 2295 kqueue, poll |
2296 </listitem> | 2296 </listitem> |
2297 | 2297 |
2298 <listitem> | 2298 <listitem> |
2299 <literal>ready</literal> - flag, meaning that the event has received an | 2299 <literal>ready</literal> — flag, meaning that the event has received an |
2300 I/O notification | 2300 I/O notification |
2301 </listitem> | 2301 </listitem> |
2302 | 2302 |
2303 <listitem> | 2303 <listitem> |
2304 <literal>delayed</literal> - flag, meaning that I/O is delayed due to rate | 2304 <literal>delayed</literal> — flag, meaning that I/O is delayed due to rate |
2305 limiting | 2305 limiting |
2306 </listitem> | 2306 </listitem> |
2307 | 2307 |
2308 <listitem> | 2308 <listitem> |
2309 <literal>timer</literal> - Red-Black tree node for inserting the event into | 2309 <literal>timer</literal> — Red-Black tree node for inserting the event into |
2310 the timer tree | 2310 the timer tree |
2311 </listitem> | 2311 </listitem> |
2312 | 2312 |
2313 <listitem> | 2313 <listitem> |
2314 <literal>timer_set</literal> - flag, meaning that the event timer is set, | 2314 <literal>timer_set</literal> — flag, meaning that the event timer is set, |
2315 but not yet expired | 2315 but not yet expired |
2316 </listitem> | 2316 </listitem> |
2317 | 2317 |
2318 <listitem> | 2318 <listitem> |
2319 <literal>timedout</literal> - flag, meaning that the event timer has expired | 2319 <literal>timedout</literal> — flag, meaning that the event timer has expired |
2320 </listitem> | 2320 </listitem> |
2321 | 2321 |
2322 <listitem> | 2322 <listitem> |
2323 <literal>eof</literal> - read event flag, meaning that the eof has happened | 2323 <literal>eof</literal> — read event flag, meaning that the eof has happened |
2324 while reading data | 2324 while reading data |
2325 </listitem> | 2325 </listitem> |
2326 | 2326 |
2327 <listitem> | 2327 <listitem> |
2328 <literal>pending_eof</literal> - flag, meaning that the eof is pending on the | 2328 <literal>pending_eof</literal> — flag, meaning that the eof is pending on the |
2329 socket, even though there may be some data available before it. | 2329 socket, even though there may be some data available before it. |
2330 The flag is delivered via <literal>EPOLLRDHUP</literal> epoll event or | 2330 The flag is delivered via <literal>EPOLLRDHUP</literal> epoll event or |
2331 <literal>EV_EOF</literal> kqueue flag | 2331 <literal>EV_EOF</literal> kqueue flag |
2332 </listitem> | 2332 </listitem> |
2333 | 2333 |
2334 <listitem> | 2334 <listitem> |
2335 <literal>error</literal> - flag, meaning that an error has happened while | 2335 <literal>error</literal> — flag, meaning that an error has happened while |
2336 reading (for read event) or writing (for write event) | 2336 reading (for read event) or writing (for write event) |
2337 </listitem> | 2337 </listitem> |
2338 | 2338 |
2339 <listitem> | 2339 <listitem> |
2340 <literal>cancelable</literal> - timer event flag, meaning that the event | 2340 <literal>cancelable</literal> — timer event flag, meaning that the event |
2341 handler should be called while performing nginx worker graceful shutdown, event | 2341 handler should be called while performing nginx worker graceful shutdown, event |
2342 though event timeout has not yet expired. The flag provides a way to finalize | 2342 though event timeout has not yet expired. The flag provides a way to finalize |
2343 certain activities, for example, flush log files | 2343 certain activities, for example, flush log files |
2344 </listitem> | 2344 </listitem> |
2345 | 2345 |
2346 <listitem> | 2346 <listitem> |
2347 <literal>posted</literal> - flag, meaning that the event is posted to queue | 2347 <literal>posted</literal> — flag, meaning that the event is posted to queue |
2348 </listitem> | 2348 </listitem> |
2349 | 2349 |
2350 <listitem> | 2350 <listitem> |
2351 <literal>queue</literal> - queue node for posting the event to a queue | 2351 <literal>queue</literal> — queue node for posting the event to a queue |
2352 </listitem> | 2352 </listitem> |
2353 | 2353 |
2354 </list> | 2354 </list> |
2355 </para> | 2355 </para> |
2356 | 2356 |
2415 The macro <literal>ngx_post_event(ev, q)</literal> posts the event | 2415 The macro <literal>ngx_post_event(ev, q)</literal> posts the event |
2416 <literal>ev</literal> to the post queue <literal>q</literal>. | 2416 <literal>ev</literal> to the post queue <literal>q</literal>. |
2417 Macro <literal>ngx_delete_posted_event(ev)</literal> deletes the event | 2417 Macro <literal>ngx_delete_posted_event(ev)</literal> deletes the event |
2418 <literal>ev</literal> from whatever queue it's currently posted. | 2418 <literal>ev</literal> from whatever queue it's currently posted. |
2419 Normally, events are posted to the <literal>ngx_posted_events</literal> queue. | 2419 Normally, events are posted to the <literal>ngx_posted_events</literal> queue. |
2420 This queue is processed late in the event loop - after all I/O and timer | 2420 This queue is processed late in the event loop — after all I/O and timer |
2421 events are already handled. | 2421 events are already handled. |
2422 The function <literal>ngx_event_process_posted()</literal> is called to process | 2422 The function <literal>ngx_event_process_posted()</literal> is called to process |
2423 an event queue. | 2423 an event queue. |
2424 This function calls event handlers until the queue is not empty. This means | 2424 This function calls event handlers until the queue is not empty. This means |
2425 that a posted event handler can post more events to be processed within the | 2425 that a posted event handler can post more events to be processed within the |
2550 <list type="bullet"> | 2550 <list type="bullet"> |
2551 | 2551 |
2552 <listitem> | 2552 <listitem> |
2553 | 2553 |
2554 <para> | 2554 <para> |
2555 <literal>NGX_PROCESS_MASTER</literal> - the master process runs the | 2555 <literal>NGX_PROCESS_MASTER</literal> — the master process runs the |
2556 <literal>ngx_master_process_cycle()</literal> function. | 2556 <literal>ngx_master_process_cycle()</literal> function. |
2557 Master process does not have any I/O and responds only to signals. | 2557 Master process does not have any I/O and responds only to signals. |
2558 It reads configuration, creates cycles, starts and controls child processes | 2558 It reads configuration, creates cycles, starts and controls child processes |
2559 </para> | 2559 </para> |
2560 | 2560 |
2562 </listitem> | 2562 </listitem> |
2563 | 2563 |
2564 <listitem> | 2564 <listitem> |
2565 | 2565 |
2566 <para> | 2566 <para> |
2567 <literal>NGX_PROCESS_WORKER</literal> - the worker process runs the | 2567 <literal>NGX_PROCESS_WORKER</literal> — the worker process runs the |
2568 <literal>ngx_worker_process_cycle()</literal> function. | 2568 <literal>ngx_worker_process_cycle()</literal> function. |
2569 Worker processes are started by master and handle client connections. | 2569 Worker processes are started by master and handle client connections. |
2570 They also respond to signals and channel commands, sent from master | 2570 They also respond to signals and channel commands, sent from master |
2571 </para> | 2571 </para> |
2572 | 2572 |
2574 </listitem> | 2574 </listitem> |
2575 | 2575 |
2576 <listitem> | 2576 <listitem> |
2577 | 2577 |
2578 <para> | 2578 <para> |
2579 <literal>NGX_PROCESS_SINGLE</literal> - single process is the only type | 2579 <literal>NGX_PROCESS_SINGLE</literal> — single process is the only type |
2580 of processes which exist in the <literal>master_process off</literal> mode. | 2580 of processes which exist in the <literal>master_process off</literal> mode. |
2581 The cycle function for this process is | 2581 The cycle function for this process is |
2582 <literal>ngx_single_process_cycle()</literal>. | 2582 <literal>ngx_single_process_cycle()</literal>. |
2583 This process creates cycles and handles client connections | 2583 This process creates cycles and handles client connections |
2584 </para> | 2584 </para> |
2587 </listitem> | 2587 </listitem> |
2588 | 2588 |
2589 <listitem> | 2589 <listitem> |
2590 | 2590 |
2591 <para> | 2591 <para> |
2592 <literal>NGX_PROCESS_HELPER</literal> - currently, there are two types of | 2592 <literal>NGX_PROCESS_HELPER</literal> — currently, there are two types of |
2593 helper processes: cache manager and cache loader. | 2593 helper processes: cache manager and cache loader. |
2594 Both of them share the same cycle function | 2594 Both of them share the same cycle function |
2595 <literal>ngx_cache_manager_process_cycle()</literal>. | 2595 <literal>ngx_cache_manager_process_cycle()</literal>. |
2596 </para> | 2596 </para> |
2597 | 2597 |
2607 <list type="bullet"> | 2607 <list type="bullet"> |
2608 | 2608 |
2609 <listitem> | 2609 <listitem> |
2610 | 2610 |
2611 <para> | 2611 <para> |
2612 <literal>NGX_SHUTDOWN_SIGNAL</literal> (<literal>SIGQUIT</literal>) - graceful | 2612 <literal>NGX_SHUTDOWN_SIGNAL</literal> (<literal>SIGQUIT</literal>) — graceful |
2613 shutdown. | 2613 shutdown. |
2614 Upon receiving this signal master process sends shutdown signal to all child | 2614 Upon receiving this signal master process sends shutdown signal to all child |
2615 processes. | 2615 processes. |
2616 When no child processes are left, master destroys cycle pool and exits. | 2616 When no child processes are left, master destroys cycle pool and exits. |
2617 A worker process which received this signal, closes all listening sockets and | 2617 A worker process which received this signal, closes all listening sockets and |
2674 </listitem> | 2674 </listitem> |
2675 | 2675 |
2676 <listitem> | 2676 <listitem> |
2677 | 2677 |
2678 <para> | 2678 <para> |
2679 <literal>NGX_REOPEN_SIGNAL</literal> (<literal>SIGUSR1</literal>) - reopen | 2679 <literal>NGX_REOPEN_SIGNAL</literal> (<literal>SIGUSR1</literal>) — reopen |
2680 files. | 2680 files. |
2681 Master process passes this signal to workers. | 2681 Master process passes this signal to workers. |
2682 Worker processes reopen all <literal>open_files</literal> from the cycle | 2682 Worker processes reopen all <literal>open_files</literal> from the cycle |
2683 </para> | 2683 </para> |
2684 | 2684 |
2686 </listitem> | 2686 </listitem> |
2687 | 2687 |
2688 <listitem> | 2688 <listitem> |
2689 | 2689 |
2690 <para> | 2690 <para> |
2691 <literal>NGX_CHANGEBIN_SIGNAL</literal> (<literal>SIGUSR2</literal>) - change | 2691 <literal>NGX_CHANGEBIN_SIGNAL</literal> (<literal>SIGUSR2</literal>) — change |
2692 nginx binary. | 2692 nginx binary. |
2693 Master process starts a new nginx binary and passes there a list of all listen | 2693 Master process starts a new nginx binary and passes there a list of all listen |
2694 sockets. | 2694 sockets. |
2695 The list is passed in the environment variable <literal>"NGINX"</literal> in | 2695 The list is passed in the environment variable <literal>"NGINX"</literal> in |
2696 text format, where descriptor numbers separated with semicolons. | 2696 text format, where descriptor numbers separated with semicolons. |
2749 The file is a POSIX shell script and it can set (or access) the | 2749 The file is a POSIX shell script and it can set (or access) the |
2750 following variables: | 2750 following variables: |
2751 <list type="bullet"> | 2751 <list type="bullet"> |
2752 | 2752 |
2753 <listitem> | 2753 <listitem> |
2754 <literal>ngx_module_type</literal> - the type of module to build. | 2754 <literal>ngx_module_type</literal> — the type of module to build. |
2755 Possible options are <literal>CORE</literal>, <literal>HTTP</literal>, | 2755 Possible options are <literal>CORE</literal>, <literal>HTTP</literal>, |
2756 <literal>HTTP_FILTER</literal>, <literal>HTTP_INIT_FILTER</literal>, | 2756 <literal>HTTP_FILTER</literal>, <literal>HTTP_INIT_FILTER</literal>, |
2757 <literal>HTTP_AUX_FILTER</literal>, <literal>MAIL</literal>, | 2757 <literal>HTTP_AUX_FILTER</literal>, <literal>MAIL</literal>, |
2758 <literal>STREAM</literal>, or <literal>MISC</literal> | 2758 <literal>STREAM</literal>, or <literal>MISC</literal> |
2759 </listitem> | 2759 </listitem> |
2760 | 2760 |
2761 <listitem> | 2761 <listitem> |
2762 <literal>ngx_module_name</literal> - the name of the module. | 2762 <literal>ngx_module_name</literal> — the name of the module. |
2763 A whitespace separated values list is accepted and may be used to build | 2763 A whitespace separated values list is accepted and may be used to build |
2764 multiple modules from a single set of source files. | 2764 multiple modules from a single set of source files. |
2765 The first name indicates the name of the output binary for a dynamic module. | 2765 The first name indicates the name of the output binary for a dynamic module. |
2766 The names in this list should match the names used in the module. | 2766 The names in this list should match the names used in the module. |
2767 </listitem> | 2767 </listitem> |
2768 | 2768 |
2769 <listitem> | 2769 <listitem> |
2770 <literal>ngx_addon_name</literal> - supplies the name of the module in the | 2770 <literal>ngx_addon_name</literal> — supplies the name of the module in the |
2771 console output text of the configure script. | 2771 console output text of the configure script. |
2772 </listitem> | 2772 </listitem> |
2773 | 2773 |
2774 <listitem> | 2774 <listitem> |
2775 <literal>ngx_module_srcs</literal> - a whitespace separated list of source | 2775 <literal>ngx_module_srcs</literal> — a whitespace separated list of source |
2776 files used to compile the module. | 2776 files used to compile the module. |
2777 The $ngx_addon_dir variable can be used as a placeholder for the path of the | 2777 The $ngx_addon_dir variable can be used as a placeholder for the path of the |
2778 module source. | 2778 module source. |
2779 </listitem> | 2779 </listitem> |
2780 | 2780 |
2781 <listitem> | 2781 <listitem> |
2782 <literal>ngx_module_incs</literal> - include paths required to build the module | 2782 <literal>ngx_module_incs</literal> — include paths required to build the module |
2783 </listitem> | 2783 </listitem> |
2784 | 2784 |
2785 <listitem> | 2785 <listitem> |
2786 <literal>ngx_module_deps</literal> - a list of module's header files. | 2786 <literal>ngx_module_deps</literal> — a list of module's header files. |
2787 </listitem> | 2787 </listitem> |
2788 | 2788 |
2789 <listitem> | 2789 <listitem> |
2790 <literal>ngx_module_libs</literal> - a list of libraries to link with the | 2790 <literal>ngx_module_libs</literal> — a list of libraries to link with the |
2791 module. | 2791 module. |
2792 For example, libpthread would be linked using | 2792 For example, libpthread would be linked using |
2793 <literal>ngx_module_libs=-lpthread</literal>. | 2793 <literal>ngx_module_libs=-lpthread</literal>. |
2794 The following macros can be used to link against the same libraries as | 2794 The following macros can be used to link against the same libraries as |
2795 nginx: | 2795 nginx: |
2797 <literal>PCRE</literal>, <literal>OPENSSL</literal>, <literal>MD5</literal>, | 2797 <literal>PCRE</literal>, <literal>OPENSSL</literal>, <literal>MD5</literal>, |
2798 <literal>SHA1</literal>, <literal>ZLIB</literal>, and <literal>PERL</literal> | 2798 <literal>SHA1</literal>, <literal>ZLIB</literal>, and <literal>PERL</literal> |
2799 </listitem> | 2799 </listitem> |
2800 | 2800 |
2801 <listitem> | 2801 <listitem> |
2802 <literal>ngx_module_link</literal> - set by the build system to | 2802 <literal>ngx_module_link</literal> — set by the build system to |
2803 <literal>DYNAMIC</literal> for a dynamic module or <literal>ADDON</literal> | 2803 <literal>DYNAMIC</literal> for a dynamic module or <literal>ADDON</literal> |
2804 for a static module and used to perform different actions depending on | 2804 for a static module and used to perform different actions depending on |
2805 linking type. | 2805 linking type. |
2806 </listitem> | 2806 </listitem> |
2807 | 2807 |
2808 <listitem> | 2808 <listitem> |
2809 <literal>ngx_module_order</literal> - sets the load order for the module which | 2809 <literal>ngx_module_order</literal> — sets the load order for the module which |
2810 is useful for <literal>HTTP_FILTER</literal> and | 2810 is useful for <literal>HTTP_FILTER</literal> and |
2811 <literal>HTTP_AUX_FILTER</literal> module types. | 2811 <literal>HTTP_AUX_FILTER</literal> module types. |
2812 The order is stored in a reverse list. | 2812 The order is stored in a reverse list. |
2813 | 2813 |
2814 <para> | 2814 <para> |
3104 Arguments flags: | 3104 Arguments flags: |
3105 | 3105 |
3106 <list type="bullet"> | 3106 <list type="bullet"> |
3107 | 3107 |
3108 <listitem> | 3108 <listitem> |
3109 <literal>NGX_CONF_NOARGS</literal> - directive without arguments | 3109 <literal>NGX_CONF_NOARGS</literal> — directive without arguments |
3110 </listitem> | 3110 </listitem> |
3111 | 3111 |
3112 <listitem><literal>NGX_CONF_1MORE</literal> - one required argument</listitem> | 3112 <listitem><literal>NGX_CONF_1MORE</literal> — one required argument</listitem> |
3113 | 3113 |
3114 <listitem><literal>NGX_CONF_2MORE</literal> - two required arguments</listitem> | 3114 <listitem><literal>NGX_CONF_2MORE</literal> — two required arguments</listitem> |
3115 | 3115 |
3116 <listitem> | 3116 <listitem> |
3117 <literal>NGX_CONF_TAKE1..7</literal> - exactly 1..7 arguments | 3117 <literal>NGX_CONF_TAKE1..7</literal> — exactly 1..7 arguments |
3118 </listitem> | 3118 </listitem> |
3119 | 3119 |
3120 <listitem> | 3120 <listitem> |
3121 <literal>NGX_CONF_TAKE12, 13, 23, 123, 1234</literal> - one or two arguments, | 3121 <literal>NGX_CONF_TAKE12, 13, 23, 123, 1234</literal> — one or two arguments, |
3122 or other combinations | 3122 or other combinations |
3123 </listitem> | 3123 </listitem> |
3124 | 3124 |
3125 </list> | 3125 </list> |
3126 | 3126 |
3127 Directive types: | 3127 Directive types: |
3128 | 3128 |
3129 <list type="bullet"> | 3129 <list type="bullet"> |
3130 | 3130 |
3131 <listitem> | 3131 <listitem> |
3132 <literal>NGX_CONF_BLOCK</literal> - the directive is a block, i.e. it may | 3132 <literal>NGX_CONF_BLOCK</literal> — the directive is a block, i.e. it may |
3133 contain other directives in curly braces, or even implement its own parser | 3133 contain other directives in curly braces, or even implement its own parser |
3134 to handle contents inside. | 3134 to handle contents inside. |
3135 </listitem> | 3135 </listitem> |
3136 | 3136 |
3137 <listitem> | 3137 <listitem> |
3138 <literal>NGX_CONF_FLAG</literal> - the directive value is a flag, a boolean | 3138 <literal>NGX_CONF_FLAG</literal> — the directive value is a flag, a boolean |
3139 value represented by “<literal>on</literal>” or “<literal>off</literal>” | 3139 value represented by “<literal>on</literal>” or “<literal>off</literal>” |
3140 strings. | 3140 strings. |
3141 </listitem> | 3141 </listitem> |
3142 </list> | 3142 </list> |
3143 | 3143 |
3144 Context of a directive defines where in the configuration it may appear | 3144 Context of a directive defines where in the configuration it may appear |
3145 and how to access module context to store corresponding values: | 3145 and how to access module context to store corresponding values: |
3146 <list type="bullet"> | 3146 <list type="bullet"> |
3147 | 3147 |
3148 <listitem> | 3148 <listitem> |
3149 <literal>NGX_MAIN_CONF</literal> - top level configuration | 3149 <literal>NGX_MAIN_CONF</literal> — top level configuration |
3150 </listitem> | 3150 </listitem> |
3151 | 3151 |
3152 <listitem> | 3152 <listitem> |
3153 <literal>NGX_HTTP_MAIN_CONF</literal> - in the http block | 3153 <literal>NGX_HTTP_MAIN_CONF</literal> — in the http block |
3154 </listitem> | 3154 </listitem> |
3155 | 3155 |
3156 <listitem> | 3156 <listitem> |
3157 <literal>NGX_HTTP_SRV_CONF</literal> - in the http server block | 3157 <literal>NGX_HTTP_SRV_CONF</literal> — in the http server block |
3158 </listitem> | 3158 </listitem> |
3159 | 3159 |
3160 <listitem> | 3160 <listitem> |
3161 <literal>NGX_HTTP_LOC_CONF</literal> - in the http location | 3161 <literal>NGX_HTTP_LOC_CONF</literal> — in the http location |
3162 </listitem> | 3162 </listitem> |
3163 | 3163 |
3164 <listitem> | 3164 <listitem> |
3165 <literal>NGX_HTTP_UPS_CONF</literal> - in the http upstream block | 3165 <literal>NGX_HTTP_UPS_CONF</literal> — in the http upstream block |
3166 </listitem> | 3166 </listitem> |
3167 | 3167 |
3168 <listitem> | 3168 <listitem> |
3169 <literal>NGX_HTTP_SIF_CONF</literal> - in the http server “if” | 3169 <literal>NGX_HTTP_SIF_CONF</literal> — in the http server “if” |
3170 </listitem> | 3170 </listitem> |
3171 | 3171 |
3172 <listitem> | 3172 <listitem> |
3173 <literal>NGX_HTTP_LIF_CONF</literal> - in the http location “if” | 3173 <literal>NGX_HTTP_LIF_CONF</literal> — in the http location “if” |
3174 </listitem> | 3174 </listitem> |
3175 | 3175 |
3176 <listitem> | 3176 <listitem> |
3177 <literal>NGX_HTTP_LMT_CONF</literal> - in the http “limit_except” | 3177 <literal>NGX_HTTP_LMT_CONF</literal> — in the http “limit_except” |
3178 </listitem> | 3178 </listitem> |
3179 | 3179 |
3180 <listitem> | 3180 <listitem> |
3181 <literal>NGX_STREAM_MAIN_CONF</literal> - in the stream block | 3181 <literal>NGX_STREAM_MAIN_CONF</literal> — in the stream block |
3182 </listitem> | 3182 </listitem> |
3183 | 3183 |
3184 <listitem> | 3184 <listitem> |
3185 <literal>NGX_STREAM_SRV_CONF</literal> - in the stream server block | 3185 <literal>NGX_STREAM_SRV_CONF</literal> — in the stream server block |
3186 </listitem> | 3186 </listitem> |
3187 | 3187 |
3188 <listitem> | 3188 <listitem> |
3189 <literal>NGX_STREAM_UPS_CONF</literal> - in the stream upstream block | 3189 <literal>NGX_STREAM_UPS_CONF</literal> — in the stream upstream block |
3190 </listitem> | 3190 </listitem> |
3191 | 3191 |
3192 <listitem> | 3192 <listitem> |
3193 <literal>NGX_MAIL_MAIN_CONF</literal> - in the the mail block | 3193 <literal>NGX_MAIL_MAIN_CONF</literal> — in the the mail block |
3194 </listitem> | 3194 </listitem> |
3195 | 3195 |
3196 <listitem> | 3196 <listitem> |
3197 <literal>NGX_MAIL_SRV_CONF</literal> - in the mail server block | 3197 <literal>NGX_MAIL_SRV_CONF</literal> — in the mail server block |
3198 </listitem> | 3198 </listitem> |
3199 | 3199 |
3200 <listitem> | 3200 <listitem> |
3201 <literal>NGX_EVENT_CONF</literal> - in the event block | 3201 <literal>NGX_EVENT_CONF</literal> — in the event block |
3202 </listitem> | 3202 </listitem> |
3203 | 3203 |
3204 <listitem> | 3204 <listitem> |
3205 <literal>NGX_DIRECT_CONF</literal> - used by modules that don't | 3205 <literal>NGX_DIRECT_CONF</literal> — used by modules that don't |
3206 create a hierarchy of contexts and store module configuration directly in ctx | 3206 create a hierarchy of contexts and store module configuration directly in ctx |
3207 </listitem> | 3207 </listitem> |
3208 </list> | 3208 </list> |
3209 The configuration parser uses this flags to throw an error in case of | 3209 The configuration parser uses this flags to throw an error in case of |
3210 a misplaced directive and calls directive handlers supplied with a proper | 3210 a misplaced directive and calls directive handlers supplied with a proper |
3218 Nginx offers a convenient set of functions that perform common conversions: | 3218 Nginx offers a convenient set of functions that perform common conversions: |
3219 | 3219 |
3220 <list type="bullet"> | 3220 <list type="bullet"> |
3221 | 3221 |
3222 <listitem> | 3222 <listitem> |
3223 <literal>ngx_conf_set_flag_slot</literal> - converts literal | 3223 <literal>ngx_conf_set_flag_slot</literal> — converts literal |
3224 “<literal>on</literal>” or “<literal>off</literal>” strings into | 3224 “<literal>on</literal>” or “<literal>off</literal>” strings into |
3225 <literal>ngx_flag_t</literal> type with values 1 or 0 | 3225 <literal>ngx_flag_t</literal> type with values 1 or 0 |
3226 </listitem> | 3226 </listitem> |
3227 | 3227 |
3228 <listitem> | 3228 <listitem> |
3229 <literal>ngx_conf_set_str_slot</literal> - stores string as a value of the | 3229 <literal>ngx_conf_set_str_slot</literal> — stores string as a value of the |
3230 <literal>ngx_str_t</literal> type | 3230 <literal>ngx_str_t</literal> type |
3231 </listitem> | 3231 </listitem> |
3232 | 3232 |
3233 <listitem> | 3233 <listitem> |
3234 <literal>ngx_conf_set_str_array_slot</literal> - appends | 3234 <literal>ngx_conf_set_str_array_slot</literal> — appends |
3235 <literal>ngx_array_t</literal> of <literal>ngx_str_t</literal> with a new value. | 3235 <literal>ngx_array_t</literal> of <literal>ngx_str_t</literal> with a new value. |
3236 The array is created if not yet exists | 3236 The array is created if not yet exists |
3237 </listitem> | 3237 </listitem> |
3238 | 3238 |
3239 <listitem> | 3239 <listitem> |
3240 <literal>ngx_conf_set_keyval_slot</literal> - appends | 3240 <literal>ngx_conf_set_keyval_slot</literal> — appends |
3241 <literal>ngx_array_t</literal> of <literal>ngx_keyval_t</literal> with | 3241 <literal>ngx_array_t</literal> of <literal>ngx_keyval_t</literal> with |
3242 a new value, where key is the first string and value is second. | 3242 a new value, where key is the first string and value is second. |
3243 The array is created if not yet exists | 3243 The array is created if not yet exists |
3244 </listitem> | 3244 </listitem> |
3245 | 3245 |
3246 <listitem> | 3246 <listitem> |
3247 <literal>ngx_conf_set_num_slot</literal> - converts directive argument | 3247 <literal>ngx_conf_set_num_slot</literal> — converts directive argument |
3248 to a <literal>ngx_int_t</literal> value | 3248 to a <literal>ngx_int_t</literal> value |
3249 </listitem> | 3249 </listitem> |
3250 | 3250 |
3251 <listitem> | 3251 <listitem> |
3252 <literal>ngx_conf_set_size_slot</literal> - converts | 3252 <literal>ngx_conf_set_size_slot</literal> — converts |
3253 <link doc="../syntax.xml">size</link> to <literal>size_t</literal> value | 3253 <link doc="../syntax.xml">size</link> to <literal>size_t</literal> value |
3254 in bytes | 3254 in bytes |
3255 </listitem> | 3255 </listitem> |
3256 | 3256 |
3257 <listitem> | 3257 <listitem> |
3258 <literal>ngx_conf_set_off_slot</literal> - converts | 3258 <literal>ngx_conf_set_off_slot</literal> — converts |
3259 <link doc="../syntax.xml">offset</link> to <literal>off_t</literal> value | 3259 <link doc="../syntax.xml">offset</link> to <literal>off_t</literal> value |
3260 in bytes | 3260 in bytes |
3261 </listitem> | 3261 </listitem> |
3262 | 3262 |
3263 <listitem> | 3263 <listitem> |
3264 <literal>ngx_conf_set_msec_slot</literal> - converts | 3264 <literal>ngx_conf_set_msec_slot</literal> — converts |
3265 <link doc="../syntax.xml">time</link> to <literal>ngx_msec_t</literal> value | 3265 <link doc="../syntax.xml">time</link> to <literal>ngx_msec_t</literal> value |
3266 in milliseconds | 3266 in milliseconds |
3267 </listitem> | 3267 </listitem> |
3268 | 3268 |
3269 <listitem> | 3269 <listitem> |
3270 <literal>ngx_conf_set_sec_slot</literal> - converts | 3270 <literal>ngx_conf_set_sec_slot</literal> — converts |
3271 <link doc="../syntax.xml">time</link> to <literal>time_t</literal> value | 3271 <link doc="../syntax.xml">time</link> to <literal>time_t</literal> value |
3272 in seconds | 3272 in seconds |
3273 </listitem> | 3273 </listitem> |
3274 | 3274 |
3275 <listitem> | 3275 <listitem> |
3276 <literal>ngx_conf_set_bufs_slot</literal> - converts two arguments | 3276 <literal>ngx_conf_set_bufs_slot</literal> — converts two arguments |
3277 into <literal>ngx_bufs_t</literal> that holds <literal>ngx_int_t</literal> | 3277 into <literal>ngx_bufs_t</literal> that holds <literal>ngx_int_t</literal> |
3278 number and <link doc="../syntax.xml">size</link> of buffers | 3278 number and <link doc="../syntax.xml">size</link> of buffers |
3279 </listitem> | 3279 </listitem> |
3280 | 3280 |
3281 <listitem> | 3281 <listitem> |
3282 <literal>ngx_conf_set_enum_slot</literal> - converts argument | 3282 <literal>ngx_conf_set_enum_slot</literal> — converts argument |
3283 into <literal>ngx_uint_t</literal> value. | 3283 into <literal>ngx_uint_t</literal> value. |
3284 The null-terminated array of <literal>ngx_conf_enum_t</literal> passed in the | 3284 The null-terminated array of <literal>ngx_conf_enum_t</literal> passed in the |
3285 <literal>post</literal> field defines acceptable strings and corresponding | 3285 <literal>post</literal> field defines acceptable strings and corresponding |
3286 integer values | 3286 integer values |
3287 </listitem> | 3287 </listitem> |
3288 | 3288 |
3289 <listitem> | 3289 <listitem> |
3290 <literal>ngx_conf_set_bitmask_slot</literal> - arguments are converted to | 3290 <literal>ngx_conf_set_bitmask_slot</literal> — arguments are converted to |
3291 <literal>ngx_uint_t</literal> value and OR'ed with the resulting value, | 3291 <literal>ngx_uint_t</literal> value and OR'ed with the resulting value, |
3292 forming a bitmask. | 3292 forming a bitmask. |
3293 The null-terminated array of <literal>ngx_conf_bitmask_t</literal> passed in | 3293 The null-terminated array of <literal>ngx_conf_bitmask_t</literal> passed in |
3294 the <literal>post</literal> field defines acceptable strings and corresponding | 3294 the <literal>post</literal> field defines acceptable strings and corresponding |
3295 mask values | 3295 mask values |
3296 </listitem> | 3296 </listitem> |
3297 | 3297 |
3298 <listitem> | 3298 <listitem> |
3299 <literal>set_path_slot</literal> - converts arguments to | 3299 <literal>set_path_slot</literal> — converts arguments to |
3300 <literal>ngx_path_t</literal> type and performs all required initializations. | 3300 <literal>ngx_path_t</literal> type and performs all required initializations. |
3301 See the | 3301 See the |
3302 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_temp_path">proxy_temp_path</link> | 3302 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_temp_path">proxy_temp_path</link> |
3303 directive description for details | 3303 directive description for details |
3304 </listitem> | 3304 </listitem> |
3305 | 3305 |
3306 <listitem> | 3306 <listitem> |
3307 <literal>set_access_slot</literal> - converts arguments to file permissions | 3307 <literal>set_access_slot</literal> — converts arguments to file permissions |
3308 mask. | 3308 mask. |
3309 See the | 3309 See the |
3310 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_store_access">proxy_store_access</link> | 3310 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_store_access">proxy_store_access</link> |
3311 directive description for details | 3311 directive description for details |
3312 </listitem> | 3312 </listitem> |
3328 Please refer to corresponding modules description to understand how | 3328 Please refer to corresponding modules description to understand how |
3329 they manage their configuration. | 3329 they manage their configuration. |
3330 | 3330 |
3331 <list type="bullet"> | 3331 <list type="bullet"> |
3332 <listitem> | 3332 <listitem> |
3333 <literal>NGX_HTTP_MAIN_CONF_OFFSET</literal> - http block configuration | 3333 <literal>NGX_HTTP_MAIN_CONF_OFFSET</literal> — http block configuration |
3334 </listitem> | 3334 </listitem> |
3335 | 3335 |
3336 <listitem> | 3336 <listitem> |
3337 <literal>NGX_HTTP_SRV_CONF_OFFSET</literal> - http server configuration | 3337 <literal>NGX_HTTP_SRV_CONF_OFFSET</literal> — http server configuration |
3338 </listitem> | 3338 </listitem> |
3339 | 3339 |
3340 <listitem> | 3340 <listitem> |
3341 <literal>NGX_HTTP_LOC_CONF_OFFSET</literal> - http location configuration | 3341 <literal>NGX_HTTP_LOC_CONF_OFFSET</literal> — http location configuration |
3342 </listitem> | 3342 </listitem> |
3343 | 3343 |
3344 <listitem> | 3344 <listitem> |
3345 <literal>NGX_STREAM_MAIN_CONF_OFFSET</literal> - stream block configuration | 3345 <literal>NGX_STREAM_MAIN_CONF_OFFSET</literal> — stream block configuration |
3346 </listitem> | 3346 </listitem> |
3347 | 3347 |
3348 <listitem> | 3348 <listitem> |
3349 <literal>NGX_STREAM_SRV_CONF_OFFSET</literal> - stream server configuration | 3349 <literal>NGX_STREAM_SRV_CONF_OFFSET</literal> — stream server configuration |
3350 </listitem> | 3350 </listitem> |
3351 | 3351 |
3352 <listitem> | 3352 <listitem> |
3353 <literal>NGX_MAIL_MAIN_CONF_OFFSET</literal> - mail block configuration | 3353 <literal>NGX_MAIL_MAIN_CONF_OFFSET</literal> — mail block configuration |
3354 </listitem> | 3354 </listitem> |
3355 | 3355 |
3356 <listitem> | 3356 <listitem> |
3357 <literal>NGX_MAIL_SRV_CONF_OFFSET</literal> - mail server configuration | 3357 <literal>NGX_MAIL_SRV_CONF_OFFSET</literal> — mail server configuration |
3358 </listitem> | 3358 </listitem> |
3359 | 3359 |
3360 </list> | 3360 </list> |
3361 | 3361 |
3362 </para> | 3362 </para> |
3489 <list type="bullet"> | 3489 <list type="bullet"> |
3490 | 3490 |
3491 <listitem> | 3491 <listitem> |
3492 | 3492 |
3493 <para> | 3493 <para> |
3494 <literal>connection</literal> - pointer to a <literal>ngx_connection_t</literal> | 3494 <literal>connection</literal> — pointer to a <literal>ngx_connection_t</literal> |
3495 client connection object. | 3495 client connection object. |
3496 Several requests may reference the same connection object at the same time - | 3496 Several requests may reference the same connection object at the same time - |
3497 one main request and its subrequests. | 3497 one main request and its subrequests. |
3498 After a request is deleted, a new request may be created on the same connection. | 3498 After a request is deleted, a new request may be created on the same connection. |
3499 </para> | 3499 </para> |
3512 </listitem> | 3512 </listitem> |
3513 | 3513 |
3514 <listitem> | 3514 <listitem> |
3515 | 3515 |
3516 <para> | 3516 <para> |
3517 <literal>ctx</literal> - array of HTTP module contexts. | 3517 <literal>ctx</literal> — array of HTTP module contexts. |
3518 Each module of type <literal>NGX_HTTP_MODULE</literal> can store any value | 3518 Each module of type <literal>NGX_HTTP_MODULE</literal> can store any value |
3519 (normally, a pointer to a structure) in the request. | 3519 (normally, a pointer to a structure) in the request. |
3520 The value is stored in the <literal>ctx</literal> array at the module's | 3520 The value is stored in the <literal>ctx</literal> array at the module's |
3521 <literal>ctx_index</literal> position. | 3521 <literal>ctx_index</literal> position. |
3522 The following macros provide a convenient way to get and set request contexts: | 3522 The following macros provide a convenient way to get and set request contexts: |
3523 </para> | 3523 </para> |
3524 | 3524 |
3525 <list type="bullet"> | 3525 <list type="bullet"> |
3526 | 3526 |
3527 <listitem> | 3527 <listitem> |
3528 <literal>ngx_http_get_module_ctx(r, module)</literal> - returns | 3528 <literal>ngx_http_get_module_ctx(r, module)</literal> — returns |
3529 <literal>module</literal>'s context | 3529 <literal>module</literal>'s context |
3530 </listitem> | 3530 </listitem> |
3531 | 3531 |
3532 <listitem> | 3532 <listitem> |
3533 <literal>ngx_http_set_ctx(r, c, module)</literal> - sets <literal>c</literal> | 3533 <literal>ngx_http_set_ctx(r, c, module)</literal> — sets <literal>c</literal> |
3534 as <literal>module</literal>'s context | 3534 as <literal>module</literal>'s context |
3535 </listitem> | 3535 </listitem> |
3536 | 3536 |
3537 </list> | 3537 </list> |
3538 | 3538 |
3539 </listitem> | 3539 </listitem> |
3540 | 3540 |
3541 <listitem> | 3541 <listitem> |
3542 <literal>main_conf, srv_conf, loc_conf</literal> - arrays of current request | 3542 <literal>main_conf, srv_conf, loc_conf</literal> — arrays of current request |
3543 configurations. | 3543 configurations. |
3544 Configurations are stored at module's <literal>ctx_index</literal> positions | 3544 Configurations are stored at module's <literal>ctx_index</literal> positions |
3545 </listitem> | 3545 </listitem> |
3546 | 3546 |
3547 <listitem> | 3547 <listitem> |
3552 This function calls <literal>read_event_handler</literal> and | 3552 This function calls <literal>read_event_handler</literal> and |
3553 <literal>write_event_handler</literal> handlers of the currently active request | 3553 <literal>write_event_handler</literal> handlers of the currently active request |
3554 </listitem> | 3554 </listitem> |
3555 | 3555 |
3556 <listitem> | 3556 <listitem> |
3557 <literal>cache</literal> - request cache object for caching upstream response | 3557 <literal>cache</literal> — request cache object for caching upstream response |
3558 </listitem> | 3558 </listitem> |
3559 | 3559 |
3560 <listitem> | 3560 <listitem> |
3561 <literal>upstream</literal> - request upstream object for proxying | 3561 <literal>upstream</literal> — request upstream object for proxying |
3562 </listitem> | 3562 </listitem> |
3563 | 3563 |
3564 <listitem> | 3564 <listitem> |
3565 <literal>pool</literal> - request pool. | 3565 <literal>pool</literal> — request pool. |
3566 This pool is destroyed when the request is deleted. | 3566 This pool is destroyed when the request is deleted. |
3567 The request object itself is allocated in this pool. | 3567 The request object itself is allocated in this pool. |
3568 For allocations which should be available throughout the client connection's | 3568 For allocations which should be available throughout the client connection's |
3569 lifetime, <literal>ngx_connection_t</literal>'s pool should be used instead | 3569 lifetime, <literal>ngx_connection_t</literal>'s pool should be used instead |
3570 </listitem> | 3570 </listitem> |
3571 | 3571 |
3572 <listitem> | 3572 <listitem> |
3573 <literal>header_in</literal> - buffer where client HTTP request header in read | 3573 <literal>header_in</literal> — buffer where client HTTP request header in read |
3574 </listitem> | 3574 </listitem> |
3575 | 3575 |
3576 <listitem> | 3576 <listitem> |
3577 <literal>headers_in, headers_out</literal> - input and output HTTP headers | 3577 <literal>headers_in, headers_out</literal> — input and output HTTP headers |
3578 objects. | 3578 objects. |
3579 Both objects contain the <literal>headers</literal> field of type | 3579 Both objects contain the <literal>headers</literal> field of type |
3580 <literal>ngx_list_t</literal> keeping the raw list of headers. | 3580 <literal>ngx_list_t</literal> keeping the raw list of headers. |
3581 In addition to that, specific headers are available for getting and setting as | 3581 In addition to that, specific headers are available for getting and setting as |
3582 separate fields, for example <literal>content_length_n</literal>, | 3582 separate fields, for example <literal>content_length_n</literal>, |
3583 <literal>status</literal> etc | 3583 <literal>status</literal> etc |
3584 </listitem> | 3584 </listitem> |
3585 | 3585 |
3586 <listitem> | 3586 <listitem> |
3587 <literal>request_body</literal> - client request body object | 3587 <literal>request_body</literal> — client request body object |
3588 </listitem> | 3588 </listitem> |
3589 | 3589 |
3590 <listitem> | 3590 <listitem> |
3591 <literal>start_sec, start_msec</literal> - time point when the request was | 3591 <literal>start_sec, start_msec</literal> — time point when the request was |
3592 created. | 3592 created. |
3593 Used for tracking request duration | 3593 Used for tracking request duration |
3594 </listitem> | 3594 </listitem> |
3595 | 3595 |
3596 <listitem> | 3596 <listitem> |
3597 <literal>method, method_name</literal> - numeric and textual representation of | 3597 <literal>method, method_name</literal> — numeric and textual representation of |
3598 client HTTP request method. | 3598 client HTTP request method. |
3599 Numeric values for methods are defined in | 3599 Numeric values for methods are defined in |
3600 <literal>src/http/ngx_http_request.h</literal> with macros | 3600 <literal>src/http/ngx_http_request.h</literal> with macros |
3601 <literal>NGX_HTTP_GET, NGX_HTTP_HEAD, NGX_HTTP_POST</literal> etc | 3601 <literal>NGX_HTTP_GET, NGX_HTTP_HEAD, NGX_HTTP_POST</literal> etc |
3602 </listitem> | 3602 </listitem> |
3608 <literal>NGX_HTTP_VERSION_11</literal> etc) and separate major and minor | 3608 <literal>NGX_HTTP_VERSION_11</literal> etc) and separate major and minor |
3609 versions | 3609 versions |
3610 </listitem> | 3610 </listitem> |
3611 | 3611 |
3612 <listitem> | 3612 <listitem> |
3613 <literal>request_line, unparsed_uri</literal> - client original request line | 3613 <literal>request_line, unparsed_uri</literal> — client original request line |
3614 and URI | 3614 and URI |
3615 </listitem> | 3615 </listitem> |
3616 | 3616 |
3617 <listitem> | 3617 <listitem> |
3618 <literal>uri, args, exten</literal> - current request URI, arguments and file | 3618 <literal>uri, args, exten</literal> — current request URI, arguments and file |
3619 extention. | 3619 extention. |
3620 The URI value here might differ from the original URI sent by the client due to | 3620 The URI value here might differ from the original URI sent by the client due to |
3621 normalization. | 3621 normalization. |
3622 Throughout request processing, these value can change while performing internal | 3622 Throughout request processing, these value can change while performing internal |
3623 redirects | 3623 redirects |
3624 </listitem> | 3624 </listitem> |
3625 | 3625 |
3626 <listitem> | 3626 <listitem> |
3627 <literal>main</literal> - pointer to a main request object. | 3627 <literal>main</literal> — pointer to a main request object. |
3628 This object is created to process client HTTP request, as opposed to | 3628 This object is created to process client HTTP request, as opposed to |
3629 subrequests, created to perform a specific sub-task within the main request | 3629 subrequests, created to perform a specific sub-task within the main request |
3630 </listitem> | 3630 </listitem> |
3631 | 3631 |
3632 <listitem> | 3632 <listitem> |
3633 <literal>parent</literal> - pointer to a parent request of a subrequest | 3633 <literal>parent</literal> — pointer to a parent request of a subrequest |
3634 </listitem> | 3634 </listitem> |
3635 | 3635 |
3636 <listitem> | 3636 <listitem> |
3637 <literal>postponed</literal> - list of output buffers and subrequests in the | 3637 <literal>postponed</literal> — list of output buffers and subrequests in the |
3638 order they are sent and created. | 3638 order they are sent and created. |
3639 The list is used by the postpone filter to provide consistent request output, | 3639 The list is used by the postpone filter to provide consistent request output, |
3640 when parts of it are created by subrequests | 3640 when parts of it are created by subrequests |
3641 </listitem> | 3641 </listitem> |
3642 | 3642 |
3643 <listitem> | 3643 <listitem> |
3644 <literal>post_subrequest</literal> - pointer to a handler with context to be | 3644 <literal>post_subrequest</literal> — pointer to a handler with context to be |
3645 called when a subrequest gets finalized. | 3645 called when a subrequest gets finalized. |
3646 Unused for main requests | 3646 Unused for main requests |
3647 </listitem> | 3647 </listitem> |
3648 | 3648 |
3649 <listitem> | 3649 <listitem> |
3650 | 3650 |
3651 <para> | 3651 <para> |
3652 <literal>posted_requests</literal> - list of requests to be started or | 3652 <literal>posted_requests</literal> — list of requests to be started or |
3653 resumed. | 3653 resumed. |
3654 Starting or resuming is done by calling the request's | 3654 Starting or resuming is done by calling the request's |
3655 <literal>write_event_handler</literal>. | 3655 <literal>write_event_handler</literal>. |
3656 Normally, this handler holds the request main function, which at first runs | 3656 Normally, this handler holds the request main function, which at first runs |
3657 request phases and then produces the output. | 3657 request phases and then produces the output. |
3669 </para> | 3669 </para> |
3670 | 3670 |
3671 </listitem> | 3671 </listitem> |
3672 | 3672 |
3673 <listitem> | 3673 <listitem> |
3674 <literal>phase_handler</literal> - index of current request phase | 3674 <literal>phase_handler</literal> — index of current request phase |
3675 </listitem> | 3675 </listitem> |
3676 | 3676 |
3677 <listitem> | 3677 <listitem> |
3678 <literal>ncaptures, captures, captures_data</literal> - regex captures produced | 3678 <literal>ncaptures, captures, captures_data</literal> — regex captures produced |
3679 by the last regex match of the request. | 3679 by the last regex match of the request. |
3680 While processing a request, there's a number of places where a regex match can | 3680 While processing a request, there's a number of places where a regex match can |
3681 happen: map lookup, server lookup by SNI or HTTP Host, rewrite, proxy_redirect | 3681 happen: map lookup, server lookup by SNI or HTTP Host, rewrite, proxy_redirect |
3682 etc. | 3682 etc. |
3683 Captures produced by a lookup are stored in the above mentioned fields. | 3683 Captures produced by a lookup are stored in the above mentioned fields. |
3687 matched and which should be used to extract captures. | 3687 matched and which should be used to extract captures. |
3688 After each new regex match request captures are reset to hold new values | 3688 After each new regex match request captures are reset to hold new values |
3689 </listitem> | 3689 </listitem> |
3690 | 3690 |
3691 <listitem> | 3691 <listitem> |
3692 <literal>count</literal> - request reference counter. | 3692 <literal>count</literal> — request reference counter. |
3693 The field only makes sense for the main request. | 3693 The field only makes sense for the main request. |
3694 Increasing the counter is done by simple <literal>r->main->count++</literal>. | 3694 Increasing the counter is done by simple <literal>r->main->count++</literal>. |
3695 To decrease the counter <literal>ngx_http_finalize_request(r, rc)</literal> | 3695 To decrease the counter <literal>ngx_http_finalize_request(r, rc)</literal> |
3696 should be called. | 3696 should be called. |
3697 Creation of a subrequest or running request body read process increase the | 3697 Creation of a subrequest or running request body read process increase the |
3698 counter | 3698 counter |
3699 </listitem> | 3699 </listitem> |
3700 | 3700 |
3701 <listitem> | 3701 <listitem> |
3702 <literal>subrequests</literal> - current subrequest nesting level. | 3702 <literal>subrequests</literal> — current subrequest nesting level. |
3703 Each subrequest gets the nesting level of its parent decreased by one. | 3703 Each subrequest gets the nesting level of its parent decreased by one. |
3704 Once the value reaches zero an error is generated. | 3704 Once the value reaches zero an error is generated. |
3705 The value for the main request is defined by the | 3705 The value for the main request is defined by the |
3706 <literal>NGX_HTTP_MAX_SUBREQUESTS</literal> constant | 3706 <literal>NGX_HTTP_MAX_SUBREQUESTS</literal> constant |
3707 </listitem> | 3707 </listitem> |
3708 | 3708 |
3709 <listitem> | 3709 <listitem> |
3710 <literal>uri_changes</literal> - number of URI changes left for the request. | 3710 <literal>uri_changes</literal> — number of URI changes left for the request. |
3711 The total number of times a request can change its URI is limited by the | 3711 The total number of times a request can change its URI is limited by the |
3712 <literal>NGX_HTTP_MAX_URI_CHANGES</literal> constant. | 3712 <literal>NGX_HTTP_MAX_URI_CHANGES</literal> constant. |
3713 With each change the value is decreased until it reaches zero. | 3713 With each change the value is decreased until it reaches zero. |
3714 In the latter case an error is generated. | 3714 In the latter case an error is generated. |
3715 The actions considered as URI changes are rewrites and internal redirects to | 3715 The actions considered as URI changes are rewrites and internal redirects to |
3716 normal or named locations | 3716 normal or named locations |
3717 </listitem> | 3717 </listitem> |
3718 | 3718 |
3719 <listitem> | 3719 <listitem> |
3720 <literal>blocked</literal> - counter of blocks held on the request. | 3720 <literal>blocked</literal> — counter of blocks held on the request. |
3721 While this value is non-zero, request cannot be terminated. | 3721 While this value is non-zero, request cannot be terminated. |
3722 Currently, this value is increased by pending AIO operations (POSIX AIO and | 3722 Currently, this value is increased by pending AIO operations (POSIX AIO and |
3723 thread operations) and active cache lock | 3723 thread operations) and active cache lock |
3724 </listitem> | 3724 </listitem> |
3725 | 3725 |
3726 <listitem> | 3726 <listitem> |
3727 <literal>buffered</literal> - bitmask showing which modules have buffered the | 3727 <literal>buffered</literal> — bitmask showing which modules have buffered the |
3728 output produced by the request. | 3728 output produced by the request. |
3729 A number of filters can buffer output, for example sub_filter can buffer data | 3729 A number of filters can buffer output, for example sub_filter can buffer data |
3730 due to a partial string match, copy filter can buffer data because of the lack | 3730 due to a partial string match, copy filter can buffer data because of the lack |
3731 of free output_buffers etc. | 3731 of free output_buffers etc. |
3732 As long as this value is non-zero, request is not finalized, expecting the flush | 3732 As long as this value is non-zero, request is not finalized, expecting the flush |
3733 </listitem> | 3733 </listitem> |
3734 | 3734 |
3735 <listitem> | 3735 <listitem> |
3736 <literal>header_only</literal> - flag showing that output does not require body. | 3736 <literal>header_only</literal> — flag showing that output does not require body. |
3737 For example, this flag is used by HTTP HEAD requests | 3737 For example, this flag is used by HTTP HEAD requests |
3738 </listitem> | 3738 </listitem> |
3739 | 3739 |
3740 <listitem> | 3740 <listitem> |
3741 <para> | 3741 <para> |
3742 <literal>keepalive</literal> - flag showing if client connection keepalive is | 3742 <literal>keepalive</literal> — flag showing if client connection keepalive is |
3743 supported. | 3743 supported. |
3744 The value is inferred from HTTP version and <header>Connection</header> header | 3744 The value is inferred from HTTP version and <header>Connection</header> header |
3745 value | 3745 value |
3746 </para> | 3746 </para> |
3747 </listitem> | 3747 </listitem> |
3748 | 3748 |
3749 <listitem> | 3749 <listitem> |
3750 <literal>header_sent</literal> - flag showing that output header has already | 3750 <literal>header_sent</literal> — flag showing that output header has already |
3751 been sent by the request | 3751 been sent by the request |
3752 </listitem> | 3752 </listitem> |
3753 | 3753 |
3754 <listitem> | 3754 <listitem> |
3755 <literal>internal</literal> - flag showing that current request is internal. | 3755 <literal>internal</literal> — flag showing that current request is internal. |
3756 To enter the internal state, a request should pass through an internal | 3756 To enter the internal state, a request should pass through an internal |
3757 redirect or be a subrequest. | 3757 redirect or be a subrequest. |
3758 Internal requests are allowed to enter internal locations | 3758 Internal requests are allowed to enter internal locations |
3759 </listitem> | 3759 </listitem> |
3760 | 3760 |
3761 <listitem> | 3761 <listitem> |
3762 <literal>allow_ranges</literal> - flag showing that partial response can be | 3762 <literal>allow_ranges</literal> — flag showing that partial response can be |
3763 sent to client, if requested by the HTTP Range header | 3763 sent to client, if requested by the HTTP Range header |
3764 </listitem> | 3764 </listitem> |
3765 | 3765 |
3766 <listitem> | 3766 <listitem> |
3767 <literal>subrequest_ranges</literal> - flag showing that a partial response is | 3767 <literal>subrequest_ranges</literal> — flag showing that a partial response is |
3768 allowed to be sent while processing a subrequest | 3768 allowed to be sent while processing a subrequest |
3769 </listitem> | 3769 </listitem> |
3770 | 3770 |
3771 <listitem> | 3771 <listitem> |
3772 <literal>single_range</literal> - flag showing that only a single continuous | 3772 <literal>single_range</literal> — flag showing that only a single continuous |
3773 range of output data can be sent to the client. | 3773 range of output data can be sent to the client. |
3774 This flag is usually set when sending a stream of data, for example from a | 3774 This flag is usually set when sending a stream of data, for example from a |
3775 proxied server, and the entire response is not available at once | 3775 proxied server, and the entire response is not available at once |
3776 </listitem> | 3776 </listitem> |
3777 | 3777 |
3778 <listitem> | 3778 <listitem> |
3779 <literal>main_filter_need_in_memory, filter_need_in_memory</literal> - flags | 3779 <literal>main_filter_need_in_memory, filter_need_in_memory</literal> — flags |
3780 showing that the output should be produced in memory buffers but not in files. | 3780 showing that the output should be produced in memory buffers but not in files. |
3781 This is a signal to the copy filter to read data from file buffers even if | 3781 This is a signal to the copy filter to read data from file buffers even if |
3782 sendfile is enabled. | 3782 sendfile is enabled. |
3783 The difference between these two flags is the location of filter modules which | 3783 The difference between these two flags is the location of filter modules which |
3784 set them. | 3784 set them. |
3789 <literal>main_filter_need_in_memory</literal> requiring that both the main | 3789 <literal>main_filter_need_in_memory</literal> requiring that both the main |
3790 request and all the subrequest read files in memory while sending output | 3790 request and all the subrequest read files in memory while sending output |
3791 </listitem> | 3791 </listitem> |
3792 | 3792 |
3793 <listitem> | 3793 <listitem> |
3794 <literal>filter_need_temporary</literal> - flag showing that the request output | 3794 <literal>filter_need_temporary</literal> — flag showing that the request output |
3795 should be produced in temporary buffers, but not in readonly memory buffers or | 3795 should be produced in temporary buffers, but not in readonly memory buffers or |
3796 file buffers. | 3796 file buffers. |
3797 This is used by filters which may change output directly in the buffers, where | 3797 This is used by filters which may change output directly in the buffers, where |
3798 it's sent </listitem> | 3798 it's sent </listitem> |
3799 | 3799 |
4045 <link doc="../http/ngx_http_rewrite_module.xml">ngx_http_rewrite_module</link> | 4045 <link doc="../http/ngx_http_rewrite_module.xml">ngx_http_rewrite_module</link> |
4046 installs its handler at this phase | 4046 installs its handler at this phase |
4047 </listitem> | 4047 </listitem> |
4048 | 4048 |
4049 <listitem> | 4049 <listitem> |
4050 <literal>NGX_HTTP_FIND_CONFIG_PHASE</literal> - a special phase used to choose a | 4050 <literal>NGX_HTTP_FIND_CONFIG_PHASE</literal> — a special phase used to choose a |
4051 location based on request URI. | 4051 location based on request URI. |
4052 This phase does not allow installing any handlers. | 4052 This phase does not allow installing any handlers. |
4053 It only performs the default action of choosing a location. | 4053 It only performs the default action of choosing a location. |
4054 Before this phase, the server default location is assigned to the request. | 4054 Before this phase, the server default location is assigned to the request. |
4055 Any module requesting a location configuration, will receive the default server | 4055 Any module requesting a location configuration, will receive the default server |
4056 location configuration. | 4056 location configuration. |
4057 After this phase a new location is assigned to the request | 4057 After this phase a new location is assigned to the request |
4058 </listitem> | 4058 </listitem> |
4059 | 4059 |
4060 <listitem> | 4060 <listitem> |
4061 <literal>NGX_HTTP_REWRITE_PHASE</literal> - same as | 4061 <literal>NGX_HTTP_REWRITE_PHASE</literal> — same as |
4062 <literal>NGX_HTTP_SERVER_REWRITE_PHASE</literal>, but for a new location, | 4062 <literal>NGX_HTTP_SERVER_REWRITE_PHASE</literal>, but for a new location, |
4063 chosen at the prevous phase | 4063 chosen at the prevous phase |
4064 </listitem> | 4064 </listitem> |
4065 | 4065 |
4066 <listitem> | 4066 <listitem> |
4067 <literal>NGX_HTTP_POST_REWRITE_PHASE</literal> - a special phase, used to | 4067 <literal>NGX_HTTP_POST_REWRITE_PHASE</literal> — a special phase, used to |
4068 redirect the request to a new location, if the URI was changed during rewrite. | 4068 redirect the request to a new location, if the URI was changed during rewrite. |
4069 The redirect is done by going back to | 4069 The redirect is done by going back to |
4070 <literal>NGX_HTTP_FIND_CONFIG_PHASE</literal>. | 4070 <literal>NGX_HTTP_FIND_CONFIG_PHASE</literal>. |
4071 No handlers are allowed at this phase | 4071 No handlers are allowed at this phase |
4072 </listitem> | 4072 </listitem> |
4073 | 4073 |
4074 <listitem> | 4074 <listitem> |
4075 <literal>NGX_HTTP_PREACCESS_PHASE</literal> - a common phase for different | 4075 <literal>NGX_HTTP_PREACCESS_PHASE</literal> — a common phase for different |
4076 types of handlers, not associated with access check. | 4076 types of handlers, not associated with access check. |
4077 Standard nginx modules | 4077 Standard nginx modules |
4078 <link doc="../http/ngx_http_limit_conn_module.xml">ngx_http_limit_conn_module | 4078 <link doc="../http/ngx_http_limit_conn_module.xml">ngx_http_limit_conn_module |
4079 </link> and | 4079 </link> and |
4080 <link doc="../http/ngx_http_limit_req_module.xml"> | 4080 <link doc="../http/ngx_http_limit_req_module.xml"> |
4081 ngx_http_limit_req_module</link> register their handlers at this phase | 4081 ngx_http_limit_req_module</link> register their handlers at this phase |
4082 </listitem> | 4082 </listitem> |
4083 | 4083 |
4084 <listitem> | 4084 <listitem> |
4085 <literal>NGX_HTTP_ACCESS_PHASE</literal> - used to check access permissions | 4085 <literal>NGX_HTTP_ACCESS_PHASE</literal> — used to check access permissions |
4086 for the request. | 4086 for the request. |
4087 Standard nginx modules such as | 4087 Standard nginx modules such as |
4088 <link doc="../http/ngx_http_access_module.xml">ngx_http_access_module</link> and | 4088 <link doc="../http/ngx_http_access_module.xml">ngx_http_access_module</link> and |
4089 <link doc="../http/ngx_http_auth_basic_module.xml">ngx_http_auth_basic_module | 4089 <link doc="../http/ngx_http_auth_basic_module.xml">ngx_http_auth_basic_module |
4090 </link> register their handlers at this phase. | 4090 </link> register their handlers at this phase. |
4093 of access phase handlers may allow access to the request in order to confinue | 4093 of access phase handlers may allow access to the request in order to confinue |
4094 processing | 4094 processing |
4095 </listitem> | 4095 </listitem> |
4096 | 4096 |
4097 <listitem> | 4097 <listitem> |
4098 <literal>NGX_HTTP_POST_ACCESS_PHASE</literal> - a special phase for the | 4098 <literal>NGX_HTTP_POST_ACCESS_PHASE</literal> — a special phase for the |
4099 <link doc="../http/ngx_http_core_module.xml" id="satisfy">satisfy any</link> | 4099 <link doc="../http/ngx_http_core_module.xml" id="satisfy">satisfy any</link> |
4100 case. | 4100 case. |
4101 If some access phase handlers denied the access and none of them allowed, the | 4101 If some access phase handlers denied the access and none of them allowed, the |
4102 request is finalized. | 4102 request is finalized. |
4103 No handlers are supported at this phase | 4103 No handlers are supported at this phase |
4104 </listitem> | 4104 </listitem> |
4105 | 4105 |
4106 <listitem> | 4106 <listitem> |
4107 <literal>NGX_HTTP_TRY_FILES_PHASE</literal> - a special phase, for the | 4107 <literal>NGX_HTTP_TRY_FILES_PHASE</literal> — a special phase, for the |
4108 <link doc="../http/ngx_http_core_module.xml" id="try_files"/> feature. | 4108 <link doc="../http/ngx_http_core_module.xml" id="try_files"/> feature. |
4109 No handlers are allowed at this phase | 4109 No handlers are allowed at this phase |
4110 </listitem> | 4110 </listitem> |
4111 | 4111 |
4112 <listitem> | 4112 <listitem> |
4113 <literal>NGX_HTTP_CONTENT_PHASE</literal> - a phase, at which the response | 4113 <literal>NGX_HTTP_CONTENT_PHASE</literal> — a phase, at which the response |
4114 is supposed to be generated. | 4114 is supposed to be generated. |
4115 Multiple nginx standard modules register their handers at this phase, for | 4115 Multiple nginx standard modules register their handers at this phase, for |
4116 example | 4116 example |
4117 <link doc="../http/ngx_http_index_module.xml">ngx_http_index_module</link> or | 4117 <link doc="../http/ngx_http_index_module.xml">ngx_http_index_module</link> or |
4118 <literal>ngx_http_static_module</literal>. | 4118 <literal>ngx_http_static_module</literal>. |
4201 </para> | 4201 </para> |
4202 | 4202 |
4203 <list type="bullet"> | 4203 <list type="bullet"> |
4204 | 4204 |
4205 <listitem> | 4205 <listitem> |
4206 <literal>NGX_OK</literal> - proceed to the next phase | 4206 <literal>NGX_OK</literal> — proceed to the next phase |
4207 </listitem> | 4207 </listitem> |
4208 | 4208 |
4209 <listitem> | 4209 <listitem> |
4210 <literal>NGX_DECLINED</literal> - proceed to the next handler of the current | 4210 <literal>NGX_DECLINED</literal> — proceed to the next handler of the current |
4211 phase. | 4211 phase. |
4212 If current handler is the last in current phase, move to the next phase | 4212 If current handler is the last in current phase, move to the next phase |
4213 </listitem> | 4213 </listitem> |
4214 | 4214 |
4215 <listitem> | 4215 <listitem> |
4216 <literal>NGX_AGAIN, NGX_DONE</literal> - suspend phase handling until some | 4216 <literal>NGX_AGAIN, NGX_DONE</literal> — suspend phase handling until some |
4217 future event. | 4217 future event. |
4218 This can be for example asynchronous I/O operation or just a delay. | 4218 This can be for example asynchronous I/O operation or just a delay. |
4219 It is supposed, that phase handling will be resumed later by calling | 4219 It is supposed, that phase handling will be resumed later by calling |
4220 <literal>ngx_http_core_run_phases()</literal> | 4220 <literal>ngx_http_core_run_phases()</literal> |
4221 </listitem> | 4221 </listitem> |