On 13 October 2011 04:34, agentzh [email protected] wrote:
BTW, you could have written the Lua code like this:
local m = ngx.re.match(ngx.var.request_method, “GET|POST|HEAD”, “io”)
if not m then
ngx.exit(400)
end
Does ngx_lua support the appropriate “501 Not Implemented” for this?
A search took me to ngx_http_lua_consts.c but it doesn’t seem to be
there.
Also didn’t realise I could use the actual code instead of a constant.
Is it possible to issue any status code or are we limited to those in
ngx_http_lua_consts.c?
Cheers.
On Sun, Oct 16, 2011 at 12:15 AM, Nginx U. [email protected]
wrote:
On 13 October 2011 04:34, agentzh [email protected] wrote:
BTW, you could have written the Lua code like this:
local m = ngx.re.match(ngx.var.request_method, “GET|POST|HEAD”, “io”)
if not m then
ngx.exit(400)
end
Does ngx_lua support the appropriate “501 Not Implemented” for this?
Sure. Just use ngx.exit(501) for it.
A search took me to ngx_http_lua_consts.c but it doesn’t seem to be there.
The constants defined there are just for improving Lua code readability.
Also didn’t realise I could use the actual code instead of a constant.
Is it possible to issue any status code or are we limited to those in
ngx_http_lua_consts.c?
You can use any status code. See
http://wiki.nginx.org/HttpLuaModule#ngx.exit
BTW, I’ve already added constant ngx.HTTP_METHOD_NOT_IMPLEMENTED to
ngx_lua v0.3.1rc12:
https://github.com/chaoslawful/lua-nginx-module/tags
Regards,
-agentzh
On 16 October 2011 02:02, agentzh [email protected] wrote:
Sure. Just use ngx.exit(501) for it.
You can use any status code. See
Lua | NGINX
BTW, I’ve already added constant ngx.HTTP_METHOD_NOT_IMPLEMENTED to
ngx_lua v0.3.1rc12:
Tags · openresty/lua-nginx-module · GitHub
Cheers!