From: Daniel Gruno Date: Fri, 13 Jul 2012 16:59:07 +0000 (+0000) Subject: - Define LUA_COMPAT_ALL so mod_lua will be compatible with Lua 5.2 X-Git-Tag: 2.5.0-alpha~6652 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f921f8cbdeb67e450a94b679d396b0be63acd714;p=thirdparty%2Fapache%2Fhttpd.git - Define LUA_COMPAT_ALL so mod_lua will be compatible with Lua 5.2 - Add an optional integer argument for parsebody, specifying the maximum size of POST that will be accepted. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361298 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index 5dc6f940607..9a1cdf8cc18 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -171,11 +171,13 @@ static int req_parsebody(lua_State *L) apr_off_t len; int res; apr_size_t size; + apr_size_t max_post_size; char *buffer; request_rec *r = ap_lua_check_request_rec(L, 1); + max_post_size = (apr_size_t) luaL_optint(L, 2, MAX_STRING_LEN); lua_newtable(L); lua_newtable(L); /* [table, table] */ - res = ap_parse_form_data(r, NULL, &pairs, -1, MAX_STRING_LEN); /*XXX: Maybe increase this value? */ + res = ap_parse_form_data(r, NULL, &pairs, -1, max_post_size); if (res == OK) { while(pairs && !apr_is_empty_array(pairs)) { ap_form_pair_t *pair = (ap_form_pair_t *) apr_array_pop(pairs); diff --git a/modules/lua/mod_lua.h b/modules/lua/mod_lua.h index 77020ab16fa..717b9d4f7f4 100644 --- a/modules/lua/mod_lua.h +++ b/modules/lua/mod_lua.h @@ -44,6 +44,8 @@ #include "lauxlib.h" #include "lualib.h" +/* Allow for Lua 5.2 backwards compatibility */ +#define LUA_COMPAT_ALL #if LUA_VERSION_NUM > 501 /* Load mode for lua_load() */ #define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL)