# Ngx\_lua v0.2.0 is now released with lots of bug fixes

**URL:** <https://www.ruby-forum.com/t/ngx-lua-v0-2-0-is-now-released-with-lots-of-bug-fixes/209067>\
**Category:** NGINX\
**Created:** [July 5, 2011, 7:33am UTC](https://www.ruby-forum.com/t/ngx-lua-v0-2-0-is-now-released-with-lots-of-bug-fixes/209067 "2011-07-05T07:33:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 5, 2011, 7:33am UTC](https://www.ruby-forum.com/t/ngx-lua-v0-2-0-is-now-released-with-lots-of-bug-fixes/209067/1 "2011-07-05T07:33:34Z")

</div>

Hi, folks!

After 5 months’ active development, the ngx\_lua module v0.2.0 release  
is now finally released:

[https://github.com/chaoslawful/lua-nginx-module/downloads](https://github.com/chaoslawful/lua-nginx-module/downloads)

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:

[GitHub - openresty/lua-nginx-module: Embed the Power of Lua into NGINX HTTP servers](https://github.com/chaoslawful/lua-nginx-module/)

This module is now included in our ngx\_openresty bundle:  
[http://openresty.org/](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 C. 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 K.  
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  
Kearsley.

- 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 C…

- applied a patch from moodydeath to introduce the “ngx.is\_subrequest”  
attribute.

- 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.

Enjoy!  
-agentzh

---

<div class="post-metadata">

**Author:** ![agentzh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@agentzh](https://www.ruby-forum.com/u/agentzh)\
**Post date:** [July 5, 2011, 7:45am UTC](https://www.ruby-forum.com/t/ngx-lua-v0-2-0-is-now-released-with-lots-of-bug-fixes/209067/2 "2011-07-05T07:45:54Z")

</div>

Cheers!

On Tue, Jul 5, 2011 at 1:33 PM, agentzh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://openresty.org/](http://openresty.org/)  
> built-in variables that are not changeable (like $arg\_PARAMETER) will  
> with size\_t on 32-bit systems can cause Bad Things. this fixed github  
> moodydeath for reporting it in the discussion of github issue #41.
> 
> by a non-nil value for ngx.location.capture(). thanks Richard  
> ngx.req.clear\_header(name). thanks moodydeath.  
> calls, which is much more natural than the old broken way.
> 
> Enjoy!  
> -agentzh
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–

Ф  
վƷ  
ֻ8214  
ֱ010 82558214  
䣺ypxiao [http://goog\_1029224550](http://goog_1029224550)@corp.netease.com  
ַкйش嶫·廪Ƽ԰ƼD27  
ʱࣺ100084
