]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
- Define LUA_COMPAT_ALL so mod_lua will be compatible with Lua 5.2
authorDaniel Gruno <humbedooh@apache.org>
Fri, 13 Jul 2012 16:59:07 +0000 (16:59 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Fri, 13 Jul 2012 16:59:07 +0000 (16:59 +0000)
- 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

modules/lua/lua_request.c
modules/lua/mod_lua.h

index 5dc6f940607c18feba4eb6cb253350d853bee5be..9a1cdf8cc18da36342c1fe2ce4a1bf837bd99e16 100644 (file)
@@ -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);
index 77020ab16fa121499411326be03766615ff06aa6..717b9d4f7f40cab9f34fc833ace2ce8be7fcf6e4 100644 (file)
@@ -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)