Thanks for the RC2. I really like by_block {}
There seem to be a bug in content_by_lua_block. If you look at the below code, like marked in red ( -- local msg_test = "test") is commented out. If I uncomment, I get following error.
content_by_lua_block {
local file_name = "rules.json"
local file, err = io.open(file_name, "r")
if not file then
ngx.log(ngx.ERR, "Failed to open file:" .. file_name)
ngx.status = ngx.HTTP_NOT_FOUND
ngx.header["Content-type"] = "text/html"
ngx.say("Failed to open file: " .. file_name .. ". Error:" .. err)
ngx.exit(0)
end
local data, err = file:read("*a")
file:close()
if data then
-- ngx.log(ngx.DEBUG, data)
ngx.say(data)
else
ngx.log(ngx.ERR, "Failed to read data from file:" .. file_name .. ". Error:" .. err)
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.header["Content-type"] = "text/html"
-- local msg_test = "test"
ngx.say("Failed to open file:" .. file_name .. ". Error:" .. err)
ngx.exit(0)
end
}
On Wednesday, 4 November 2015 23:14:55 UTC-5, agentzh wrote:
Hi guys,
I've just kicked out OpenResty 1.9.3.2 RC2 for testing:
https://openresty.org/download/ngx_openresty-1.9.3.2rc2.tar.gz
The highlight of this release is the new (experimental) support for
Windows using the MinGW gcc toolchain. You can try the pre-built Win32
binaries from this zip package:
https://openresty.org/download/ngx_openresty-1.9.3.2rc2-win32.zip
For detailed usage on Windows, please check out the following document:
https://github.com/openresty/ngx_openresty/blob/master/doc/README-win32.md
If you want to build on Windows yourself, then this document contains
detailed instructions as well.
We will release a corresponding Win32 binary package for every formal
and RC release of the OpenResty source package from now on.
We have plans to migrate to the Microsoft Visual Studio compiler
toolchain and resolve existing limitations on Windows in the near
future.
Changes since the last (RC) release, 1.9.3.2 RC1:
* feature: added support for compiling on Windows using the MinGW
gcc toolchain to the build system. See the document for more
details:
https://github.com/openresty/ngx_openresty/blob/master/doc/README-win32.md
* upgraded the ngx_lua module to 0.9.18.
* feature: now we support LuaJIT 2 on Windows (in the form of
"lua51.dll").
* bugfix: fixed errors and warnings with C compilers without
variadic macro support.
* bugfix: *_by_lua_block: use line comments inside a pair of
long brackets might lead to parse failures. thanks Dejiang
Zhu for the patch.
* bugfix: subrequest response status codes between the range
100 .. 299 (inclusive) might get lost in the return values
of ngx.location.capture*() calls. thanks Igor Clark for the
report.
* bugfix: we might return the wrong shm zone in the public C
API function "ngx_http_lua_find_zone()". thanks qlee001 for
the report.
* upgraded the lua-resty-core library to 0.1.2.
* change: updated the implementation to reflect recent changes
in shared dictionary zones of the ngx_lua module. now we require
the ngx_lua module 0.9.17+.
* upgraded the lua-cjson library to 2.1.0.3.
* feature: now we allow up to 16 decimal places in JSON number
encoding via "cjson.encode_number_precision()". thanks
lordnynex for the patch.
* bugfix: fixed the warning "inline function ‘fpconv_init’
declared but never defined" from gcc.
* bugfix: Makefile: removed the slash ("/") after "$(DESTDIR)"
so as to support relative path values in make variable
"LUA_LIB_DIR".
* upgraded resty-cli to 0.04.
* feature: now the "resty" command-line utility looks for an
nginx under the directory of itself as well (for Win32
OpenResty).
* bugfix: worked around a bug regarding temp directory cleanup
in msys perl 5.8.8 (and possibly other versions of msys perl
as well).
* bugfix: ensure we append an appropriate executable file
extension when testing the existence of executables on
exotic systems like Win32.
* upgraded the lua-rds-parser library to 0.06.
* bugfix: fixed the "u_char" C data type for MinGW gcc which
lacks it.
* bugfix: Makefile: added an explicit ".c -> .o" rule to help
MinGW make.
* bugfix: Makefile: removed the slash ("/") after "$(DESTDIR)"
so as to support relative path values in make variable
"LUA_LIB_DIR".
* upgraded the lua-redis-parser library to 0.11.
* bugfix: Makefile: added an explicit ".c -> .o" rule to help
MinGW make.
* bugfix: Makefile: removed the slash ("/") after "$(DESTDIR)"
so as to support relative path values in make variable
"LUA_LIB_DIR".
* upgraded the ngx_rds_csv module to 0.07.
* bugfix: fixed compilation errors with MinGW gcc on Win32.
* bugfix: fixed errors and warnings with C compilers without
variadic macro support.
* upgraded the ngx_headers_more module to 0.28.
* bugfix: fixed errors and warnings with C compilers without
variadic macro support.
* bugfix: removed the useless code snippet enabled by the
unused "NGX_HTTP_HEADERS" macro. it might trigger a
compilation error with some 3rd-party NGINX modules or NGINX
forks. thanks Vadim A. Misbakh-Soloviov for the report.
Your trial and feedback are crucial for us to deliver a stable formal
release soon.
Thanks a lot in advance!
Best regards,
-agentzh