You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* added a note on possible uninitialized variables for short-circuited
requests. thanks Simon Eskildsen for the patch in openresty#456.
* renamed the section "Special PCRE Sequences" to "Special Escaping
Sequences".
* [Mixing with SSI Not Supported](#mixing-with-ssi-not-supported)
43
43
* [SPDY Mode Not Fully Supported](#spdy-mode-not-fully-supported)
44
+
* [Missing data on short circuited requests](#missing-data-on-short-circuited-requests)
44
45
* [TODO](#todo)
45
46
* [Changes](#changes)
46
47
* [Test Suite](#test-suite)
@@ -747,8 +748,8 @@ There exists a work-around, however, when the original context does *not* need t
747
748
748
749
[Back to TOC](#table-of-contents)
749
750
750
-
Special PCRE Sequences
751
-
----------------------
751
+
Special Escaping Sequences
752
+
--------------------------
752
753
PCRE sequences such as `\d`, `\s`, or `\w`, require special attention because in string literals, the backslash character, `\`, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected:
753
754
754
755
```nginx
@@ -853,6 +854,27 @@ Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [ngx.
853
854
854
855
[Back to TOC](#table-of-contents)
855
856
857
+
Missing data on short circuited requests
858
+
----------------------------------------
859
+
860
+
Nginx may terminate a request early with (at least):
861
+
862
+
* 400 (Bad Request)
863
+
* 405 (Not Allowed)
864
+
* 408 (Request Timeout)
865
+
* 414 (Request URI Too Large)
866
+
* 494 (Request Headers Too Large)
867
+
* 499 (Client Closed Request)
868
+
* 500 (Internal Server Error)
869
+
* 501 (Not Implemented)
870
+
871
+
This means that phases that normally run are skipped, such as the rewrite or
872
+
access phase. This also means that later phases that are run regardless, e.g.
873
+
[log_by_lua](#log_by_lua), will not have access to information that is normally set in those
874
+
phases.
875
+
876
+
[Back to TOC](#table-of-contents)
877
+
856
878
TODO
857
879
====
858
880
@@ -5094,7 +5116,7 @@ The `ctx` table argument combined with the `a` regex modifier can be used to con
5094
5116
5095
5117
Note that, the `options` argument is not optional when the `ctx` argument is specified and that the empty Lua string (`""`) must be used as placeholder for `options` if no meaningful regex options are required.
5096
5118
5097
-
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special PCRE Sequences](#special-pcre-sequences)).
5119
+
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special Escaping Sequences](#special-escaping-sequences)).
5098
5120
5099
5121
To confirm that PCRE JIT is enabled, activate the Nginx debug log by adding the `--with-debug` option to Nginx or ngx_openresty's `./configure` script. Then, enable the "debug" error log level in `error_log` directive. The following message will be generated if PCRE JIT is enabled:
5100
5122
@@ -5234,7 +5256,7 @@ The optional `options` argument takes exactly the same semantics as the [ngx.re.
5234
5256
5235
5257
The current implementation requires that the iterator returned should only be used in a single request. That is, one should *not* assign it to a variable belonging to persistent namespace like a Lua package.
5236
5258
5237
-
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special PCRE Sequences](#special-pcre-sequences)).
5259
+
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special Escaping Sequences](#special-escaping-sequences)).
5238
5260
5239
5261
This feature was first introduced in the `v0.2.1rc12` release.
5240
5262
@@ -5300,7 +5322,7 @@ When the `replace` argument is of type "function", then it will be invoked with
5300
5322
5301
5323
The dollar sign characters in the return value of the `replace` function argument are not special at all.
5302
5324
5303
-
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special PCRE Sequences](#special-pcre-sequences)).
5325
+
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special Escaping Sequences](#special-escaping-sequences)).
5304
5326
5305
5327
This feature was first introduced in the `v0.2.1rc13` release.
5306
5328
@@ -5338,7 +5360,7 @@ Here is some examples:
5338
5360
-- n == 2
5339
5361
```
5340
5362
5341
-
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special PCRE Sequences](#special-pcre-sequences)).
5363
+
This method requires the PCRE library enabled in Nginx. ([Known Issue With Special Escaping Sequences](#special-escaping-sequences)).
5342
5364
5343
5365
This feature was first introduced in the `v0.2.1rc15` release.
Copy file name to clipboardExpand all lines: doc/HttpLuaModule.wiki
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -609,7 +609,7 @@ The cosockets are currently also disabled in the [[#init_by_lua|init_by_lua*]] a
609
609
610
610
There exists a work-around, however, when the original context does *not* need to wait for the cosocket results. That is, creating a 0-delay timer via the [[#ngx.timer.at|ngx.timer.at]] API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer.
611
611
612
-
== Special PCRE Sequences ==
612
+
== Special Escaping Sequences ==
613
613
PCRE sequences such as <code>\d</code>, <code>\s</code>, or <code>\w</code>, require special attention because in string literals, the backslash character, <code>\</code>, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected:
614
614
615
615
<geshi lang="nginx">
@@ -700,6 +700,24 @@ Mixing SSI with ngx_lua in the same Nginx request is not supported at all. Just
700
700
701
701
Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [[#ngx.location.capture|ngx.location.capture]], [[#ngx.location.capture_multi|ngx.location.capture_multi]], and [[#ngx.req.socket|ngx.req.socket]].
702
702
703
+
== Missing data on short circuited requests ==
704
+
705
+
Nginx may terminate a request early with (at least):
706
+
707
+
* 400 (Bad Request)
708
+
* 405 (Not Allowed)
709
+
* 408 (Request Timeout)
710
+
* 414 (Request URI Too Large)
711
+
* 494 (Request Headers Too Large)
712
+
* 499 (Client Closed Request)
713
+
* 500 (Internal Server Error)
714
+
* 501 (Not Implemented)
715
+
716
+
This means that phases that normally run are skipped, such as the rewrite or
717
+
access phase. This also means that later phases that are run regardless, e.g.
718
+
[[#log_by_lua|log_by_lua]], will not have access to information that is normally set in those
719
+
phases.
720
+
703
721
= TODO =
704
722
705
723
* add <code>*_by_lua_block</code> directives for existing <code>*_by_lua</code> directives so that we put literal Lua code directly in curly braces instead of an nginx literal string. For example,
@@ -4244,7 +4262,7 @@ The <code>ctx</code> table argument combined with the <code>a</code> regex modif
4244
4262
4245
4263
Note that, the <code>options</code> argument is not optional when the <code>ctx</code> argument is specified and that the empty Lua string (<code>""</code>) must be used as placeholder for <code>options</code> if no meaningful regex options are required.
4246
4264
4247
-
This method requires the PCRE library enabled in Nginx. ([[#Special PCRE Sequences|Known Issue With Special PCRE Sequences]]).
4265
+
This method requires the PCRE library enabled in Nginx. ([[#Special Escaping Sequences|Known Issue With Special Escaping Sequences]]).
4248
4266
4249
4267
To confirm that PCRE JIT is enabled, activate the Nginx debug log by adding the <code>--with-debug</code> option to Nginx or ngx_openresty's <code>./configure</code> script. Then, enable the "debug" error log level in <code>error_log</code> directive. The following message will be generated if PCRE JIT is enabled:
4250
4268
@@ -4374,7 +4392,7 @@ The optional <code>options</code> argument takes exactly the same semantics as t
4374
4392
4375
4393
The current implementation requires that the iterator returned should only be used in a single request. That is, one should ''not'' assign it to a variable belonging to persistent namespace like a Lua package.
4376
4394
4377
-
This method requires the PCRE library enabled in Nginx. ([[#Special PCRE Sequences|Known Issue With Special PCRE Sequences]]).
4395
+
This method requires the PCRE library enabled in Nginx. ([[#Special Escaping Sequences|Known Issue With Special Escaping Sequences]]).
4378
4396
4379
4397
This feature was first introduced in the <code>v0.2.1rc12</code> release.
4380
4398
@@ -4433,7 +4451,7 @@ When the <code>replace</code> argument is of type "function", then it will be in
4433
4451
4434
4452
The dollar sign characters in the return value of the <code>replace</code> function argument are not special at all.
4435
4453
4436
-
This method requires the PCRE library enabled in Nginx. ([[#Special PCRE Sequences|Known Issue With Special PCRE Sequences]]).
4454
+
This method requires the PCRE library enabled in Nginx. ([[#Special Escaping Sequences|Known Issue With Special Escaping Sequences]]).
4437
4455
4438
4456
This feature was first introduced in the <code>v0.2.1rc13</code> release.
4439
4457
@@ -4466,7 +4484,7 @@ Here is some examples:
4466
4484
-- n == 2
4467
4485
</geshi>
4468
4486
4469
-
This method requires the PCRE library enabled in Nginx. ([[#Special PCRE Sequences|Known Issue With Special PCRE Sequences]]).
4487
+
This method requires the PCRE library enabled in Nginx. ([[#Special Escaping Sequences|Known Issue With Special Escaping Sequences]]).
4470
4488
4471
4489
This feature was first introduced in the <code>v0.2.1rc15</code> release.
0 commit comments