httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r1200475 - in /httpd/httpd/trunk/modules/lua: lua_config.c lua_vmprep.c mod_lua.c test/test.lua
Date Thu, 10 Nov 2011 18:48:50 GMT
Author: brianm
Date: Thu Nov 10 18:48:50 2011
New Revision: 1200475

URL: http://svn.apache.org/viewvc?rev=1200475&view=rev
Log:
fix issue with incorrect munging of the lua package path -- LuaPackagePath directives were
not working

Modified:
    httpd/httpd/trunk/modules/lua/lua_config.c
    httpd/httpd/trunk/modules/lua/lua_vmprep.c
    httpd/httpd/trunk/modules/lua/mod_lua.c
    httpd/httpd/trunk/modules/lua/test/test.lua

Modified: httpd/httpd/trunk/modules/lua/lua_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_config.c?rev=1200475&r1=1200474&r2=1200475&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_config.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_config.c Thu Nov 10 18:48:50 2011
@@ -155,7 +155,6 @@ static const struct luaL_Reg cfg_methods
 };
 
 
-
 static int cmd_foo(lua_State *L)
 {
     cmd_parms *cmd = check_cmd_parms(L, 1);

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=1200475&r1=1200474&r2=1200475&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Thu Nov 10 18:48:50 2011
@@ -245,6 +245,23 @@ static apr_status_t cleanup_lua(void *l)
     return APR_SUCCESS;
 }
 
+/*
+        munge_path(L, 
+                   "path", 
+                   "?.lua", 
+                   "./?.lua", 
+                   lifecycle_pool,
+                   spec->package_paths, 
+                   spec->file);
+*/
+/**
+ * field -> "path" or "cpath"
+ * sub_pat -> "?.lua"
+ * rep_pat -> "./?.lua"
+ * pool -> lifecycle pool for allocations
+ * paths -> things to add
+ * file -> ???
+ */
 static void munge_path(lua_State *L,
                        const char *field,
                        const char *sub_pat,
@@ -261,17 +278,22 @@ static void munge_path(lua_State *L,
 
     lua_getglobal(L, "package");
     lua_getfield(L, -1, field);
+    
     current = lua_tostring(L, -1);
+
     parent_dir = ap_make_dirstr_parent(pool, file);
     pattern = apr_pstrcat(pool, parent_dir, sub_pat, NULL);
     luaL_gsub(L, current, rep_pat, pattern);
     lua_setfield(L, -3, field);
     lua_getfield(L, -2, field);
     modified = lua_tostring(L, -1);
+
+
     lua_pop(L, 2);
 
-    part = apr_pstrcat(pool, modified, apr_array_pstrcat(pool, paths, ';'),
+    part = apr_pstrcat(pool, modified, ";", apr_array_pstrcat(pool, paths, ';'),
                        NULL);
+
     lua_pushstring(L, part);
     lua_setfield(L, -2, field);
     lua_pop(L, 1);              /* pop "package" off the stack     */
@@ -308,8 +330,11 @@ static apr_status_t vm_construct(void **
 #endif
     luaL_openlibs(L);
     if (spec->package_paths) {
-        munge_path(L, "path", "?.lua", "./?.lua", lifecycle_pool,
-            spec->package_paths, spec->file);
+        munge_path(L, 
+                   "path", "?.lua", "./?.lua", 
+                   lifecycle_pool,
+                   spec->package_paths, 
+                   spec->file);
     }
     if (spec->package_cpaths) {
         munge_path(L, "cpath", "?.so", "./?.so", lifecycle_pool,

Modified: httpd/httpd/trunk/modules/lua/mod_lua.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/mod_lua.c?rev=1200475&r1=1200474&r2=1200475&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/mod_lua.c (original)
+++ httpd/httpd/trunk/modules/lua/mod_lua.c Thu Nov 10 18:48:50 2011
@@ -863,16 +863,22 @@ static const char *register_quick_block(
 
 
 
-static const char *register_package_helper(cmd_parms *cmd, const char *arg,
+static const char *register_package_helper(cmd_parms *cmd, 
+                                           const char *arg,
                                            apr_array_header_t *dir_array)
 {
     apr_status_t rv;
 
     ap_lua_server_cfg *server_cfg =
         ap_get_module_config(cmd->server->module_config, &lua_module);
+
     char *fixed_filename;
-    rv = apr_filepath_merge(&fixed_filename, server_cfg->root_path, arg,
-                            APR_FILEPATH_NOTRELATIVE, cmd->pool);
+    rv = apr_filepath_merge(&fixed_filename, 
+                            server_cfg->root_path, 
+                            arg,
+                            APR_FILEPATH_NOTRELATIVE, 
+                            cmd->pool);
+
     if (rv != APR_SUCCESS) {
         return apr_psprintf(cmd->pool,
                             "Unable to build full path to file, %s", arg);

Modified: httpd/httpd/trunk/modules/lua/test/test.lua
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/test/test.lua?rev=1200475&r1=1200474&r2=1200475&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/test/test.lua (original)
+++ httpd/httpd/trunk/modules/lua/test/test.lua Thu Nov 10 18:48:50 2011
@@ -18,7 +18,7 @@
 local mu = require "moonunit" 
 local http = require "helpers"
 
-http.base_url = "http://localhost:8000"
+http.base_url = "http://localhost:8008"
 
 local test = mu.TestCase:new{}
 



Mime
View raw message