mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
More mod_lua compat for Lua 5.1, 5.2, 5.3.
One last use of luaL_register() with a non-NULL "name" argument remaining. Not tested yet. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1800815 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
-*- mode:org -*-
|
-*- mode:org -*-
|
||||||
* Requirements:
|
* Requirements:
|
||||||
** lua 5.1, 5.2 ( http://www.lua.org/ ) or LuaJIT 2.x ( http://www.luajit.org/ )
|
** lua 5.1, 5.2, 5.3 ( http://www.lua.org/ ) or LuaJIT 2.x ( http://www.luajit.org/ )
|
||||||
** Does NOT work with Lua 5.3 yet
|
|
||||||
** Apache HTTPD 2.4 ( http://httpd.apache.org/ ) or higher
|
** Apache HTTPD 2.4 ( http://httpd.apache.org/ ) or higher
|
||||||
|
|
||||||
* Documentation
|
* Documentation
|
||||||
@@ -24,6 +23,9 @@
|
|||||||
** TODO: document or remove block sections
|
** TODO: document or remove block sections
|
||||||
** TODO: test per-dir behavior of block sections
|
** TODO: test per-dir behavior of block sections
|
||||||
** TODO: Suppress internal details (fs path to scripts, etc) in error responses
|
** TODO: Suppress internal details (fs path to scripts, etc) in error responses
|
||||||
|
** TODO: Check whether we can tighten the mode flag in lua_load(),
|
||||||
|
luaL_loadfile() an dluaL_loadbuffer() from NULL (="bt")
|
||||||
|
to e.g. "t".
|
||||||
|
|
||||||
* License
|
* License
|
||||||
Apache License, Version 2.0,
|
Apache License, Version 2.0,
|
||||||
|
@@ -265,13 +265,13 @@ void ap_lua_load_config_lmodule(lua_State *L)
|
|||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
|
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
luaL_register(L, NULL, cfg_methods); /* [metatable] */
|
luaL_setfuncs(L, cfg_methods); /* [metatable] */
|
||||||
|
|
||||||
|
|
||||||
luaL_newmetatable(L, "Apache2.CommandParameters");
|
luaL_newmetatable(L, "Apache2.CommandParameters");
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
|
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
luaL_register(L, NULL, cmd_methods); /* [metatable] */
|
luaL_setfuncs(L, cmd_methods); /* [metatable] */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2959,7 +2959,7 @@ void ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
|
|||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
|
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
luaL_register(L, NULL, request_methods); /* [metatable] */
|
luaL_setfuncs(L, request_methods); /* [metatable] */
|
||||||
|
|
||||||
lua_pop(L, 2);
|
lua_pop(L, 2);
|
||||||
|
|
||||||
@@ -2967,7 +2967,7 @@ void ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
|
|||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
|
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
luaL_register(L, NULL, connection_methods); /* [metatable] */
|
luaL_setfuncs(L, connection_methods); /* [metatable] */
|
||||||
|
|
||||||
lua_pop(L, 2);
|
lua_pop(L, 2);
|
||||||
|
|
||||||
@@ -2975,7 +2975,7 @@ void ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
|
|||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
|
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
luaL_register(L, NULL, server_methods); /* [metatable] */
|
luaL_setfuncs(L, server_methods); /* [metatable] */
|
||||||
|
|
||||||
lua_pop(L, 2);
|
lua_pop(L, 2);
|
||||||
|
|
||||||
|
@@ -1080,11 +1080,7 @@ static const char *register_named_block_function_hook(const char *name,
|
|||||||
else {
|
else {
|
||||||
luaL_Buffer b;
|
luaL_Buffer b;
|
||||||
luaL_buffinit(lvm, &b);
|
luaL_buffinit(lvm, &b);
|
||||||
#if LUA_VERSION_NUM >= 503
|
|
||||||
lua_dump(lvm, ldump_writer, &b, 0);
|
|
||||||
#else
|
|
||||||
lua_dump(lvm, ldump_writer, &b);
|
lua_dump(lvm, ldump_writer, &b);
|
||||||
#endif
|
|
||||||
luaL_pushresult(&b);
|
luaL_pushresult(&b);
|
||||||
spec->bytecode_len = lua_rawlen(lvm, -1);
|
spec->bytecode_len = lua_rawlen(lvm, -1);
|
||||||
spec->bytecode = apr_pstrmemdup(cmd->pool, lua_tostring(lvm, -1),
|
spec->bytecode = apr_pstrmemdup(cmd->pool, lua_tostring(lvm, -1),
|
||||||
|
@@ -41,23 +41,23 @@
|
|||||||
#include "apr_hooks.h"
|
#include "apr_hooks.h"
|
||||||
#include "apr_reslist.h"
|
#include "apr_reslist.h"
|
||||||
|
|
||||||
/* Allow for Lua 5.2 backwards compatibility */
|
|
||||||
#define LUA_COMPAT_ALL
|
|
||||||
/* Allow for Lua 5.3 backwards compatibility */
|
|
||||||
#define LUA_COMPAT_5_2
|
|
||||||
#define LUA_COMPAT_5_1
|
|
||||||
#define LUA_COMPAT_MODULE
|
|
||||||
|
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
#include "lualib.h"
|
#include "lualib.h"
|
||||||
|
|
||||||
#if LUA_VERSION_NUM > 501
|
#if LUA_VERSION_NUM > 501
|
||||||
/* Load mode for lua_load() */
|
/* Load mode for lua_load() */
|
||||||
#define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)
|
#define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)
|
||||||
#define lua_resume(a,b) lua_resume(a, NULL, b)
|
#define lua_resume(a,b) lua_resume(a, NULL, b)
|
||||||
|
#define luaL_loadfile(a,b) luaL_loadfilex(a,b,NULL)
|
||||||
|
#define luaL_loadbuffer(a,b,c,d) luaL_loadbufferx(a,b,c,d,NULL)
|
||||||
|
#define luaL_setfuncs(a,b) luaL_setfuncs(a,b,0)
|
||||||
#else
|
#else
|
||||||
#define lua_rawlen(L,i) lua_objlen(L, (i))
|
#define lua_rawlen(L,i) lua_objlen(L, (i))
|
||||||
|
#define luaL_setfuncs(a,b) luaL_register(a,NULL,b)
|
||||||
|
#endif
|
||||||
|
#if LUA_VERSION_NUM > 502
|
||||||
|
#define lua_dump(a,b,c,d) lua_dump(a,b,c,d,0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
|
/* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and
|
||||||
|
Reference in New Issue
Block a user