bugfix: assignment to ngx.status would always be overridden by the later ngx.exit() calls for HTTP 1.0 requests if lua_http10_buffering is on (the default setting). thanks chenshu for reporting this issue.
bugfix: there was a typo in the error message when accessing an Nginx variable that has not been defined.
bugfix: unexpected runtime exceptions would be thrown when resty.upload met a in-part header field line or a terminating boundary line that was too long. this bug had appeared in Lua Resty Upload Library 0.04 and OpenResty 126.96.36.199.
bugfix: resty.upload could not parse Content-Type request header values like boundary="simple boundary", that is, with double quotes around the boundary value.
optimize: marked internal auxiliary functions as Lua local functions.
The following components are bundled:
bugfix: ngx.req.set_body_file() might lead to memory issues because it directly used the storage of Lua strings allocated by the Lua GC (we should have allocated a new memory block on the Nginx side and copy the string data over).
feature: added ngx.req.start_time() to return the request starting time in seconds (the milliseconds part is the decimal part just as in ngx.now). thanks Matthieu Tourne for the patch.
feature: setting ngx.status or calling ngx.exit(N) (where N >= 300) after sending out response headers no longer yields a Lua exception but only leaves an error message in the error.log file, which is useful for Lua land debugging. thanks Matthieu Tourne for requesting this.
feature: the user can now call ngx.exit(444) to abort pending subrequests in other "light threads" from within a "light thread".
feature: added new dtrace static probe http-lua-user-thread-wait.
bugfix: the "light thread" object created by ngx.thread.spawn() or ngx.on_abort() might be prematurely collected by the Lua GC because we did not correctly register its coroutine object into the Lua regsitry table. this bug may crash the Lua VM and Nginx workers under load. thanks Zhu Dejiang for reporting this issue.
bugfix: ngx.thread.wait() might hang infinitely when more than 4 user "light threads" are created in the same request handler due to the incorrect use of ngx_array_t for ngx_list_t. thanks Junwei Shi for reporting this issue.
bugfix: when a user coroutine or user "light thread" dies with an error, our Lua backtrace dumper written in C may access one of its dead parent threads (if any) which could lead to segmentation faults.
bugfix: ngx.exit(N) incorrectly threw out Lua exceptions when N was 408, 499, or 444 and the response header was already sent. thanks Kindy Lin for reporting this issue.
bugfix: when the user callback function registered by ngx.on_abort() discarded the client abort event, the request would be aborted by force when the next client abort event happened.
bugfix: an English typo in the error message for init_by_lua*.
feature: added new directive lua_check_client_abort (default to off) for monitoring and processing the event that the client closes the (downstream) connection prematurely. thanks Zhu Dejiang for request this feature.
feature: added new Lua API ngx.on_abort() which is used to register user Lua function callback for the event that the client closes the (downstream) connection prematurely. thanks Matthieu Tourne for suggesting this feature.
feature: ngx.exit(N) can now abort pending subrequests when N = 408 (request time out) or N = 499 (client closed request) or N = -1 (error).
bugfix: The TCP/stream cosocket's connect() method could not detect errors like "connection refused" when kqueue was used (on FreeBSD or Mac OS X, for example). thanks smallfish for reporting this issue.
bugfix: reading operations on ngx.req.socket() did not return any errors when the request body got truncated; now we return the "client aborted" error.
optimize: we now use Lua's own table.concat() to do string concatenation for all the memcached requests instead of relying on the cosocket API (on the C level) because calling the Lua C API is much slower especially when LuaJIT is in use. now for simple test cases loaded by ab -k -c10, we get 11.3% overall performance boost.
feature: now we can automatically detect the vendor-provided LuaJIT-2.0 package on Gentoo. thanks Il'ya V. Yesin for the patch. it is still recommended, however, to explicitly set the environments LUAJIT_INC and LUAJIT_LIB.
feature: implemented the "light threads" API, which allows asynchronous concurrent processing within a single Nginx request handler, based on automatically-scheduled Lua coroutines. thanks Lee Holloway for requesting this feature.
bugfix: ngx.re.gsub() might throw out the exception attempt to call a string value when the replace argument was a Lua function and the subject string was large. thanks Zhu Maohai for reporting this issue.
bugfix: older gcc versions might issue warnings like variable 'nrets' might be clobbered by 'longjmp' or 'vfork', like gcc 3.4.3 (for Solaris 11) and gcc 4.1.2 (for Red Hat Linux). thanks Wenhua Zhang for reporting this issue.
docs: added a warning for ngx.var.VARIABLE that memory is allocated in the per-request memory pool. thanks lilydjwg.
docs: made it clear why return is recommended to be used with ngx.exit(). thanks Antoine.