Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fa3eeb0
Adding directive rewrite_no_postpone
Mar 20, 2012
2ee6f46
Adding trace to errors
Mar 20, 2012
a12d72f
Adding "variable" $ngx_prefix to lua_package_path
Mar 21, 2012
b80b502
Adding ngx.req.init_body() ngx.req.append_body() ngx.req.finish_body()
Mar 30, 2012
e0eea53
Fix issues with POST using http 1.1 (test for expect)
Apr 21, 2012
776f499
Merge remote-tracking branch 'upstream/master'
Apr 26, 2012
1901199
Adding log_by_lua and log_by_lua_file and documentation
May 3, 2012
77eb003
Adding README.markdown
May 3, 2012
2db0ae3
Merge remote-tracking branch 'upstream/master'
May 3, 2012
ef8e2bf
Adding test for inclusive mode
May 9, 2012
20b3395
Adding logic for the receiveuntil option { inclusive = true }
May 10, 2012
34a36af
Adding documentation for the receiveuntil option { inclusive = true }
May 10, 2012
d4b111b
Merge remote-tracking branch 'upstream/master'
May 11, 2012
8cd749f
Adding failing test
May 14, 2012
9144d24
Fix receiveuntil("pattern", { inclusive = false })
May 14, 2012
8e24cd1
Merge remote-tracking branch 'upstream/master'
May 15, 2012
4174f0c
fixed minor coding styles
zhuzhaoyuan May 16, 2012
54f5a70
deleted a reduntant blank line
zhuzhaoyuan May 16, 2012
c465d2b
Add ngx.decode_args()
May 16, 2012
f8e612a
changed the chunk name of set_by_lua from "set_by_lua_inline" to "set…
agentzh May 21, 2012
f75f20d
feature: ngx.log() and print() now output more debugging info, i.e., …
agentzh May 21, 2012
2cd7586
feature: added the "[lua]" prefix to the log messages produced by ngx…
agentzh May 21, 2012
fd0fa3e
Merge branch 'master' of https://github.com/chaoslawful/lua-nginx-module
zhuzhaoyuan May 21, 2012
5f1c7c3
lua -> Lua
zhuzhaoyuan May 21, 2012
77c715d
fixed some minor grammatical errors
zhuzhaoyuan May 21, 2012
0538286
Merge pull request #117 from zhuzhaoyuan/master
chaoslawful May 21, 2012
227b9c3
Merge remote-tracking branch 'upstream/master'
May 21, 2012
932a748
Merge remote-tracking branch 'upstream/logging'
May 21, 2012
33b3d45
modified the message prefix of print() from "[lua] print: " to just "…
agentzh May 22, 2012
1e6de3d
optimize: eliminated unnecessary lua-side operations in ngx.log() and…
agentzh May 22, 2012
849ca03
Merge remote-tracking branch 'upstream/logging'
May 22, 2012
d0f5ed3
Merge remote-tracking branch 'upstream/prefix-var'
May 22, 2012
50f47a9
Merge branch 'devel'
May 22, 2012
886792c
Adding documentation for ngx.decode_args()
May 22, 2012
c5016c1
Fixing incorrect merge from prefix-var branch
May 22, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 94 additions & 14 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,69 @@ Directives
lua_code_cache "off" in "nginx.conf" to avoid repeatedly reloading
Nginx.

log_by_lua
syntax: *log_by_lua <lua-script-str>*

context: *http, server, location, location if*

phase: *log_phase*

Uses Lua code specified in "<lua-script-str>" to create a lua log handler
This does not replace the current access logs, but runs after.

Note that similarly to header_filter_by_lua, the following API
functions are currently disabled within this context:

* Output API functions (e.g., ngx.say and ngx.send_headers)

* Control API functions (e.g., ngx.exit)

* Subrequest API functions (e.g., ngx.location.capture and
ngx.location.capture_multi)

Here is an example of gathering average data for
$upstream_response_time :

lua_shared_dict log_dict 5M;

location / {

proxy_pass http://mybackend;

log_by_lua '
local upstream_time = tonumber(ngx.var.upstream_response_time)

local sum = ngx.shared.log_dict:get("upstream_time-sum")
sum = sum + upstream_time
ngx.shared.log_dict:set("upstream_time-sum", sum)
ngx.shared.log_dict:incr("upstream_time-nb", 1)
';
}

location /status {
content_by_lua '
local sum = ngx.shared.log_dict:get("upstream_time-sum")
local nb = ngx.shared.log_dict:get("upstream_time-nb")

if nb and sum then
ngx.say("average upstream response time: ", sum / nb)
end
';
}


log_by_lua_file

syntax: *log_by_lua <lua-script-str>*

context: *http, server, location, location if*

phase: *log_phase*

Equivalent to log_by_blua, except that the file specified by
"<path-to-lua-script-file>" contains the lua code to be executed.


header_filter_by_lua
syntax: *header_filter_by_lua <lua-script-str>*

Expand Down Expand Up @@ -1300,9 +1363,9 @@ Nginx API for Lua
This option is set to "false" by default

location /other {
set $dog "$dog world";
echo "$uri dog: $dog";
}
set $dog "$dog world";
echo "$uri dog: $dog";
}

location /lua {
set $dog 'hello';
Expand All @@ -1312,7 +1375,7 @@ Nginx API for Lua

ngx.print(res.body)
ngx.say(ngx.var.uri, ": ", ngx.var.dog)
';
';
}

Accessing location "/lua" gives
Expand Down Expand Up @@ -1383,23 +1446,23 @@ Nginx API for Lua
the ngx.ctx table for the subrequest.

location /sub {
content_by_lua '
ngx.ctx.foo = "bar";
content_by_lua '
ngx.ctx.foo = "bar";
';
}
}
location /lua {
content_by_lua '
local ctx = {}
local ctx = {}
res = ngx.location.capture("/sub", { ctx = ctx })

ngx.say(ctx.foo);
ngx.say(ngx.ctx.foo);
';
ngx.say(ngx.ctx.foo);
';
}

Then request "GET /lua" gives

bar
bar
nil

It is also possible to use this "ctx" option to share the same ngx.ctx
Expand Down Expand Up @@ -1760,7 +1823,7 @@ Nginx API for Lua
different from arguments taking empty string values. "GET
/test?foo=&bar=" will give something like

foo:
foo:
bar:

Empty key arguments are discarded. "GET /test?=hello&=world" will yield
Expand Down Expand Up @@ -1855,7 +1918,7 @@ Nginx API for Lua
different from arguments taking empty string values. "POST /test" with
request body "foo=&bar=" will return something like

foo:
foo:
bar:

Empty key arguments are discarded. "POST /test" with body
Expand Down Expand Up @@ -2524,6 +2587,16 @@ Nginx API for Lua

This method was first introduced in the "v0.3.1rc27" release.

ngx.decode_args
syntax: *table = ngx.decode_args(str)*

context: *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*,
header_filter_by_lua**

Decode a URI encoded string into a Lua table.

This is the inverse function of ngx.encode_args.

ngx.encode_base64
syntax: *newstr = ngx.encode_base64(str)*

Expand Down Expand Up @@ -2823,7 +2896,7 @@ Nginx API for Lua

j enable PCRE JIT compilation, this requires PCRE 8.21+ which
must be built with the --enable-jit option.
for optimum performance, this option should always be used
for optimum performance, this option should always be used
together with the 'o' option.
first introduced in ngx_lua v0.3.1rc30.

Expand Down Expand Up @@ -3479,6 +3552,13 @@ Nginx API for Lua
This method returns an iterator Lua function that can be called to read
the data stream until it sees the specified pattern or an error occurs.

An optional option table can be given as a second argument, which
support the options:

* "inclusive" specify wether the pattern itself should be returned
as part of the matched data.


Here is an example for using this method to read a data stream with the
boundary sequence "--abcedhb":

Expand Down
28 changes: 19 additions & 9 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ This module embeds Lua, via the standard interpreter or LuaJIT, into Nginx and b
Unlike [Apache's mod_lua](http://httpd.apache.org/docs/2.3/mod/mod_lua.html) and [Lighttpd's mod_magnet](http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet), Lua code executed using this module can be *100% non-blocking* on network traffic as long as either of the [ngx.location.capture](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture) or [ngx.location.capture_multi](http://wiki.nginx.org/HttpLuaModule#ngx.location.capture_multi) interfaces are used to handle
requests to upstream services such as mysql, postgresql, memcached, redis, or upstream http web services. (see [HttpDrizzleModule](http://wiki.nginx.org/HttpDrizzleModule), [ngx_postgres](http://github.com/FRiCKLE/ngx_postgres/), [HttpMemcModule](http://wiki.nginx.org/HttpMemcModule), [HttpRedis2Module](http://wiki.nginx.org/HttpRedis2Module) and [HttpProxyModule](http://wiki.nginx.org/HttpProxyModule) modules for details).

The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
Loaded Lua modules persist at the nginx worker process level resulting in a small memory footprint even when under heavy loads.
The Lua interpreter or LuaJIT instance is shared across all requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines.
Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint even when under heavy loads.

Directives
==========
Expand Down Expand Up @@ -339,7 +339,7 @@ set_by_lua_file

Equivalent to [set_by_lua](http://wiki.nginx.org/HttpLuaModule#set_by_lua), except that the file specified by `<path-to-lua-script-file>` contains the lua code to be executed.

When the Lua code cache is on (default state), the user code is loaded once at the first request and cached
When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached
and the Nginx config must be reloaded each time the Lua source file is modified.
The Lua code cache can be temporarily disabled during development by
switching [lua_code_cache](http://wiki.nginx.org/HttpLuaModule#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx.
Expand All @@ -355,8 +355,8 @@ content_by_lua

**phase:** *content*

Acts as a "content handler" and executes lua code string specified in `<lua-script-str>` for every request.
The lua code may make [API calls](http://wiki.nginx.org/HttpLuaModule#Nginx_API_for_Lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
Acts as a "content handler" and executes Lua code string specified in `<lua-script-str>` for every request.
The Lua code may make [API calls](http://wiki.nginx.org/HttpLuaModule#Nginx_API_for_Lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).

Do not use this directive and other content handler directives in the same location. For example, this directive and the [proxy_pass](http://wiki.nginx.org/HttpProxyModule#proxy_pass) directive should not be used in the same location.

Expand All @@ -373,7 +373,7 @@ Equivalent to [content_by_lua](http://wiki.nginx.org/HttpLuaModule#content_by_lu

Nginx variables can be used in the `<path-to-lua-script-file>` string to provide flexibility. This however carries some risks and is not ordinarily recommended.

When the Lua code cache is on (default state), the user code is loaded once at the first request and cached
When the Lua code cache is on (by default), the user code is loaded once at the first request and cached
and the Nginx config must be reloaded each time the Lua source file is modified.
The Lua code cache can be temporarily disabled during development by
switching [lua_code_cache](http://wiki.nginx.org/HttpLuaModule#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx.
Expand Down Expand Up @@ -588,7 +588,7 @@ Equivalent to [access_by_lua](http://wiki.nginx.org/HttpLuaModule#access_by_lua)

Nginx variables can be used in the `<path-to-lua-script-file>` string to provide flexibility. This however carries some risks and is not ordinarily recommended.

When the Lua code cache is on (default state), the user code is loaded once at the first request and cached
When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached
and the Nginx config must be reloaded each time the Lua source file is modified.
The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](http://wiki.nginx.org/HttpLuaModule#lua_code_cache) `off` in `nginx.conf` to avoid repeatedly reloading Nginx.

Expand Down Expand Up @@ -2428,6 +2428,16 @@ If the argument value is `false`, then the effect is equivalent to the `nil` val

This method was first introduced in the `v0.3.1rc27` release.

ngx.decode_args
---------------
**syntax:** *table = ngx.decode_args(str)*

**context:** *set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua**

Decode a URI encoded string into a Lua table.

This is the inverse function of ngx.encode_args.

ngx.encode_base64
-----------------
**syntax:** *newstr = ngx.encode_base64(str)*
Expand Down Expand Up @@ -3621,7 +3631,7 @@ To avoid this, *double* escape the backslash:

Here, `\\\\d+` is stripped down to `\\d+` by the Nginx config file parser and this is further stripped down to `\d+` by the Lua language parser before running.

Alternatively, the regex pattern can be presented as a long-bracketed lua string literal by encasing it in "long brackets", `[[...]]`, in which case backslashes have to only be escaped once for the Nginx config file parser.
Alternatively, the regex pattern can be presented as a long-bracketed Lua string literal by encasing it in "long brackets", `[[...]]`, in which case backslashes have to only be escaped once for the Nginx config file parser.


# nginx.conf
Expand Down Expand Up @@ -3663,7 +3673,7 @@ With this approach, the backslashes are only stripped by the Lua language parser
-- evaluates to "1234"


Within external script files, PCRE sequences presented as long-bracketed lua string literals do not require modification.
Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification.


-- test.lua
Expand Down
4 changes: 2 additions & 2 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ fi

ngx_addon_name=ngx_http_lua_module
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_lua_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_lua_script.c $ngx_addon_dir/src/ngx_http_lua_log.c $ngx_addon_dir/src/ngx_http_lua_subrequest.c $ngx_addon_dir/src/ngx_http_lua_ndk.c $ngx_addon_dir/src/ngx_http_lua_control.c $ngx_addon_dir/src/ngx_http_lua_time.c $ngx_addon_dir/src/ngx_http_lua_misc.c $ngx_addon_dir/src/ngx_http_lua_variable.c $ngx_addon_dir/src/ngx_http_lua_string.c $ngx_addon_dir/src/ngx_http_lua_output.c $ngx_addon_dir/src/ngx_http_lua_headers.c $ngx_addon_dir/src/ngx_http_lua_req_body.c $ngx_addon_dir/src/ngx_http_lua_uri.c $ngx_addon_dir/src/ngx_http_lua_args.c $ngx_addon_dir/src/ngx_http_lua_ctx.c $ngx_addon_dir/src/ngx_http_lua_regex.c $ngx_addon_dir/src/ngx_http_lua_module.c $ngx_addon_dir/src/ngx_http_lua_headers_out.c $ngx_addon_dir/src/ngx_http_lua_headers_in.c $ngx_addon_dir/src/ngx_http_lua_directive.c $ngx_addon_dir/src/ngx_http_lua_consts.c $ngx_addon_dir/src/ngx_http_lua_exception.c $ngx_addon_dir/src/ngx_http_lua_util.c $ngx_addon_dir/src/ngx_http_lua_cache.c $ngx_addon_dir/src/ngx_http_lua_conf.c $ngx_addon_dir/src/ngx_http_lua_contentby.c $ngx_addon_dir/src/ngx_http_lua_rewriteby.c $ngx_addon_dir/src/ngx_http_lua_accessby.c $ngx_addon_dir/src/ngx_http_lua_setby.c $ngx_addon_dir/src/ngx_http_lua_capturefilter.c $ngx_addon_dir/src/ngx_http_lua_clfactory.c $ngx_addon_dir/src/ngx_http_lua_pcrefix.c $ngx_addon_dir/src/ngx_http_lua_headerfilterby.c $ngx_addon_dir/src/ngx_http_lua_shdict.c $ngx_addon_dir/src/ngx_http_lua_socket.c $ngx_addon_dir/src/ngx_http_lua_api.c"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_lua_script.h $ngx_addon_dir/src/ngx_http_lua_log.h $ngx_addon_dir/src/ngx_http_lua_subrequest.h $ngx_addon_dir/src/ngx_http_lua_ndk.h $ngx_addon_dir/src/ngx_http_lua_control.h $ngx_addon_dir/src/ngx_http_lua_time.h $ngx_addon_dir/src/ngx_http_lua_string.h $ngx_addon_dir/src/ngx_http_lua_misc.h $ngx_addon_dir/src/ngx_http_lua_variable.h $ngx_addon_dir/src/ngx_http_lua_output.h $ngx_addon_dir/src/ngx_http_lua_headers.h $ngx_addon_dir/src/ngx_http_lua_uri.h $ngx_addon_dir/src/ngx_http_lua_req_body.h $ngx_addon_dir/src/ngx_http_lua_args.h $ngx_addon_dir/src/ngx_http_lua_ctx.h $ngx_addon_dir/src/ngx_http_lua_regex.h $ngx_addon_dir/src/ngx_http_lua_common.h $ngx_addon_dir/src/ngx_http_lua_directive.h $ngx_addon_dir/src/ngx_http_lua_headers_out.h $ngx_addon_dir/src/ngx_http_lua_headers_in.h $ngx_addon_dir/src/ngx_http_lua_consts.h $ngx_addon_dir/src/ngx_http_lua_exception.h $ngx_addon_dir/src/ngx_http_lua_util.h $ngx_addon_dir/src/ngx_http_lua_cache.h $ngx_addon_dir/src/ngx_http_lua_conf.h $ngx_addon_dir/src/ngx_http_lua_contentby.h $ngx_addon_dir/src/ngx_http_lua_rewriteby.h $ngx_addon_dir/src/ngx_http_lua_accessby.h $ngx_addon_dir/src/ngx_http_lua_setby.h $ngx_addon_dir/src/ngx_http_lua_capturefilter.h $ngx_addon_dir/src/ngx_http_lua_clfactory.h $ngx_addon_dir/src/ngx_http_lua_pcrefix.h $ngx_addon_dir/src/ngx_http_lua_headerfilterby.h $ngx_addon_dir/src/ngx_http_lua_shdict.h $ngx_addon_dir/src/ngx_http_lua_socket.h $ngx_addon_dir/src/api/ngx_http_lua_api.h"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_lua_script.c $ngx_addon_dir/src/ngx_http_lua_log.c $ngx_addon_dir/src/ngx_http_lua_subrequest.c $ngx_addon_dir/src/ngx_http_lua_ndk.c $ngx_addon_dir/src/ngx_http_lua_control.c $ngx_addon_dir/src/ngx_http_lua_time.c $ngx_addon_dir/src/ngx_http_lua_misc.c $ngx_addon_dir/src/ngx_http_lua_variable.c $ngx_addon_dir/src/ngx_http_lua_string.c $ngx_addon_dir/src/ngx_http_lua_output.c $ngx_addon_dir/src/ngx_http_lua_headers.c $ngx_addon_dir/src/ngx_http_lua_req_body.c $ngx_addon_dir/src/ngx_http_lua_uri.c $ngx_addon_dir/src/ngx_http_lua_args.c $ngx_addon_dir/src/ngx_http_lua_ctx.c $ngx_addon_dir/src/ngx_http_lua_regex.c $ngx_addon_dir/src/ngx_http_lua_module.c $ngx_addon_dir/src/ngx_http_lua_headers_out.c $ngx_addon_dir/src/ngx_http_lua_headers_in.c $ngx_addon_dir/src/ngx_http_lua_directive.c $ngx_addon_dir/src/ngx_http_lua_consts.c $ngx_addon_dir/src/ngx_http_lua_exception.c $ngx_addon_dir/src/ngx_http_lua_util.c $ngx_addon_dir/src/ngx_http_lua_cache.c $ngx_addon_dir/src/ngx_http_lua_conf.c $ngx_addon_dir/src/ngx_http_lua_contentby.c $ngx_addon_dir/src/ngx_http_lua_rewriteby.c $ngx_addon_dir/src/ngx_http_lua_accessby.c $ngx_addon_dir/src/ngx_http_lua_setby.c $ngx_addon_dir/src/ngx_http_lua_capturefilter.c $ngx_addon_dir/src/ngx_http_lua_clfactory.c $ngx_addon_dir/src/ngx_http_lua_pcrefix.c $ngx_addon_dir/src/ngx_http_lua_headerfilterby.c $ngx_addon_dir/src/ngx_http_lua_shdict.c $ngx_addon_dir/src/ngx_http_lua_socket.c $ngx_addon_dir/src/ngx_http_lua_api.c $ngx_addon_dir/src/ngx_http_lua_logby.c"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_lua_script.h $ngx_addon_dir/src/ngx_http_lua_log.h $ngx_addon_dir/src/ngx_http_lua_subrequest.h $ngx_addon_dir/src/ngx_http_lua_ndk.h $ngx_addon_dir/src/ngx_http_lua_control.h $ngx_addon_dir/src/ngx_http_lua_time.h $ngx_addon_dir/src/ngx_http_lua_string.h $ngx_addon_dir/src/ngx_http_lua_misc.h $ngx_addon_dir/src/ngx_http_lua_variable.h $ngx_addon_dir/src/ngx_http_lua_output.h $ngx_addon_dir/src/ngx_http_lua_headers.h $ngx_addon_dir/src/ngx_http_lua_uri.h $ngx_addon_dir/src/ngx_http_lua_req_body.h $ngx_addon_dir/src/ngx_http_lua_args.h $ngx_addon_dir/src/ngx_http_lua_ctx.h $ngx_addon_dir/src/ngx_http_lua_regex.h $ngx_addon_dir/src/ngx_http_lua_common.h $ngx_addon_dir/src/ngx_http_lua_directive.h $ngx_addon_dir/src/ngx_http_lua_headers_out.h $ngx_addon_dir/src/ngx_http_lua_headers_in.h $ngx_addon_dir/src/ngx_http_lua_consts.h $ngx_addon_dir/src/ngx_http_lua_exception.h $ngx_addon_dir/src/ngx_http_lua_util.h $ngx_addon_dir/src/ngx_http_lua_cache.h $ngx_addon_dir/src/ngx_http_lua_conf.h $ngx_addon_dir/src/ngx_http_lua_contentby.h $ngx_addon_dir/src/ngx_http_lua_rewriteby.h $ngx_addon_dir/src/ngx_http_lua_accessby.h $ngx_addon_dir/src/ngx_http_lua_setby.h $ngx_addon_dir/src/ngx_http_lua_capturefilter.h $ngx_addon_dir/src/ngx_http_lua_clfactory.h $ngx_addon_dir/src/ngx_http_lua_pcrefix.h $ngx_addon_dir/src/ngx_http_lua_headerfilterby.h $ngx_addon_dir/src/ngx_http_lua_shdict.h $ngx_addon_dir/src/ngx_http_lua_socket.h $ngx_addon_dir/src/api/ngx_http_lua_api.h $ngx_addon_dir/src/ngx_http_lua_logby.h"
CFLAGS="$CFLAGS -DNDK_SET_VAR"

ngx_feature="export symbols by default"
Expand Down
6 changes: 3 additions & 3 deletions src/ngx_http_lua_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "ngx_http_lua_util.h"


static int ngx_http_lua_parse_args(ngx_http_request_t *r, lua_State *L,
u_char *buf, u_char *last, int max);
static int ngx_http_lua_ngx_req_set_uri_args(lua_State *L);
static int ngx_http_lua_ngx_req_get_uri_args(lua_State *L);
static int ngx_http_lua_ngx_req_get_post_args(lua_State *L);
Expand Down Expand Up @@ -214,7 +212,9 @@ ngx_http_lua_ngx_req_get_post_args(lua_State *L)
}


static int


int
ngx_http_lua_parse_args(ngx_http_request_t *r, lua_State *L, u_char *buf,
u_char *last, int max)
{
Expand Down
2 changes: 2 additions & 0 deletions src/ngx_http_lua_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

void ngx_http_lua_inject_req_args_api(lua_State *L);

int ngx_http_lua_parse_args(ngx_http_request_t *r, lua_State *L,
u_char *buf, u_char *last, int max);

#endif /* NGX_HTTP_LUA_ARGS */

8 changes: 8 additions & 0 deletions src/ngx_http_lua_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct {
ngx_http_handler_pt rewrite_handler;
ngx_http_handler_pt access_handler;
ngx_http_handler_pt content_handler;
ngx_http_handler_pt log_handler;
ngx_http_handler_pt header_filter_handler;

ngx_http_complex_value_t rewrite_src; /* rewrite_by_lua
Expand All @@ -121,6 +122,13 @@ typedef struct {

u_char *content_src_key; /* cached key for content_src */


/* log_by_lua inline script/script file path */
ngx_http_complex_value_t log_src;
/* cached key for log_src */
u_char *log_src_key;


ngx_http_complex_value_t header_filter_src; /* header_filter_by_lua
inline script/script
file path */
Expand Down
Loading