[ANN] ngx_lua v0.2.0 is now released with lots of bug fixes

agentzh agentzh at gmail.com
Tue Jul 5 09:33:05 MSD 2011

Hi, folks!

After 5 months' active development, the ngx_lua module v0.2.0 release
is now finally released:


This release contains lots of bug fixes as well as some new features.
Many many thanks go to all our users and contributors worldwide,
especially moodydeath :)

The ngx_lua module embeds the Lua/LuaJIT interpreter into the nginx
core and integrates the powerful Lua threads (aka Lua coroutines) into
the nginx event model by means of nginx subrequests.

You can get the latest source code and full documentation from the
ngx_lua's project page:


This module is now included in our ngx_openresty bundle: http://openresty.org/

Here goes the complete change log for this release:

* now we support ngx.var[1], ngx.var[2], and etc to refer to the nginx
regex capturing variables \$1, \$2, and etc in Lua. this resolved
github issue #43. thanks Tobia Conforto for reporting it.

* now we use the same value overriding mechanism as ngx_rewrite's set
command for ngx.var.VAR = new_value. Assigning values to special
variables like $limit_rate and $args should now work; also writing to
built-in variables that are not changeable (like $arg_PARAMETER) will
result in a 500 error page, as expected, now. thanks Richard Kearsley
for reporting it.

* fixed the lua_code_cache off warning when the lua_code_cache is
explicitly on. thanks Feng Xingguo.

* applied the patch from cyberty to add ngx.http_time() function to
expose the nginx core function ngx_http_time to the Lua land.

* fixed an issue on i386: we now use off_t consistently. mixing it
with size_t on 32-bit systems can cause Bad Things. this fixed github
issue #42. thanks moodydeath.

* fixed an issue on i386: fixed a formatter mismatch issue in
ngx_http_echo_adjust_subrequest. thanks Wang Bin. This caused
incorrect subrequest Content-Length header when a body is specified.

* now in the subrequest capturing processor, we worked around an issue
in ngx_http_static_module that when it issues 301 redirect for
directory access w/o a trailing slash, it does not inject
r->headers_out.location into the r->headers_out.headers list. thanks
moodydeath for reporting it in the discussion of github issue #41.

* fixed a bug in ngx.location.capture() and
ngx.location.capture_multi() that we could not capture locations with
internal redirections in them. thanks moodydeath for reporting it in
github issue #41.

* fixed redundant last chunk issue for ngx.exec() invocation at
rewrite and access phases: we should quit the current core_run_phases
cycle; this also fixed github issue #40: 2 Subrequest calls when using
access_by_lua, ngx.exec and echo_location.

* fixed ngx.exit(status) where status >= 200 and status < 300 for
access_by_lua* and rewrite_by_lua*: it should quit the whole request
altegother and skip all those subsequent phase handlers (if any).
thanks moodydeath for reporting it.

* fixed github issue #39: setting differnt response headers in Lua
with common prefix might interfere with each other. thanks moodydeath.

* fixed GitHub issue #38: request headers did not forward to
subrequests when the "method" or "body" option is explicitly specified
by a non-nil value for ngx.location.capture(). thanks Richard

* fixed a bug in output header set; we should always set the
header->hash to 1. thanks moodydeath for reporting it.

* fixed spots that trigger the "variable set but not used" warning
issued by gcc 4.6.0.

* now we turn the ngx.req.header table into an ngx.req.get_headers()
function; we also added ngx.req.set_header(name, value) and
ngx.req.clear_header(name). thanks moodydeath.

* now we make ngx_devel_kit (NDK) optional. thanks Kirill A. Korinskiy.

* removed a duplicate definition of the ngx_str_set macro caught by
ctags; also fixed a warning thrown by gcc -O3 on Mac OS X 10.6.

* added patch to use PCRE related Lua extensions in ngx_lua (chaoslawful)

* now we change the way we process HTTP 1.0 requests by automatically
buffering all the user outputs generated by ngx.print()/ngx.say()
calls, which is much more natural than the old broken way.

* fixed the "ngx.exec() after ngx.location.capture() hanging" bug for
rewrite_by_lua* and access_by_lua* as well. thanks Wendal Chen.

* applied a patch from moodydeath to introduce the "ngx.is_subrequest"

* now we encourage use of the client_body_in_single_buffer directive
instead of big client_body_buffer_size when lua_need_request_body is
turned on.

* fixed the config script and added extra linking options needed by
LuaJIT in 64-bit Mac OS X.

* fixed the zero size alert caused by ngx.print("") in Lua.

* now we always allocate r->request_body for subrequests when the
method option is specified for ngx.location.capture*. this prevents
accidental inheritance of parent request's request body when
client_body_buffer_size < client_max_body_size.


More information about the nginx mailing list