You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2009/03/01 02:25:27 UTC

svn commit: r748946 - in /httpd/httpd/trunk/modules/lua: lua_request.c lua_vmprep.c test/htdocs/simple.lua

Author: brianm
Date: Sun Mar  1 01:25:27 2009
New Revision: 748946

URL: http://svn.apache.org/viewvc?rev=748946&view=rev
Log:
change r.content_type = "something" to use ap_set_content_type, which it should as was pointed out by Bertrand Mansion

Modified:
    httpd/httpd/trunk/modules/lua/lua_request.c
    httpd/httpd/trunk/modules/lua/lua_vmprep.c
    httpd/httpd/trunk/modules/lua/test/htdocs/simple.lua

Modified: httpd/httpd/trunk/modules/lua/lua_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=748946&r1=748945&r2=748946&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_request.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_request.c Sun Mar  1 01:25:27 2009
@@ -450,46 +450,29 @@
     /* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */
     /* const char* key = luaL_checkstring(L, -2); */
     request_rec *r = apl_check_request_rec(L, 1);
-    apl_rstack_dump(L, r, "req_newindex");
     key = luaL_checkstring(L, 2);
     apl_rstack_dump(L, r, "req_newindex");
     if (0 == apr_strnatcmp("status", key)) {
         int code = luaL_checkinteger(L, 3);
         r->status = code;
-        luaL_getmetatable(L, "Apache2.Request");
-        lua_pushinteger(L, code);
-        lua_setfield(L, -2, "status");
-        lua_pop(L, 1);
         return 0;
     }
 
     if (0 == apr_strnatcmp("content_type", key)) {
         const char *value = luaL_checkstring(L, 3);
-        r->content_type = apr_pstrdup(r->pool, value);
-        luaL_getmetatable(L, "Apache2.Request");
-        lua_pushstring(L, value);
-        lua_setfield(L, -2, "content_type");
-        lua_pop(L, 1);
+        ap_set_content_type(r, apr_pstrdup(r->pool, value));
         return 0;
     }
 
     if (0 == apr_strnatcmp("filename", key)) {
         const char *value = luaL_checkstring(L, 3);
         r->filename = apr_pstrdup(r->pool, value);
-        luaL_getmetatable(L, "Apache2.Request");
-        lua_pushstring(L, value);
-        lua_setfield(L, -2, "filename");
-        lua_pop(L, 1);
         return 0;
     }
 
     if (0 == apr_strnatcmp("uri", key)) {
         const char *value = luaL_checkstring(L, 3);
         r->uri = apr_pstrdup(r->pool, value);
-        luaL_getmetatable(L, "Apache2.Request");
-        lua_pushstring(L, value);
-        lua_setfield(L, -2, "uri");
-        lua_pop(L, 1);
         return 0;
     }
 

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=748946&r1=748945&r2=748946&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Mar  1 01:25:27 2009
@@ -236,7 +236,8 @@
                        const char *sub_pat,
                        const char *rep_pat,
                        apr_pool_t *pool,
-                       apr_array_header_t *paths, const char *file)
+                       apr_array_header_t *paths, 
+                       const char *file)
 {
     const char *current;
     const char *parent_dir;

Modified: httpd/httpd/trunk/modules/lua/test/htdocs/simple.lua
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/test/htdocs/simple.lua?rev=748946&r1=748945&r2=748946&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/test/htdocs/simple.lua (original)
+++ httpd/httpd/trunk/modules/lua/test/htdocs/simple.lua Sun Mar  1 01:25:27 2009
@@ -1,3 +1,4 @@
 function handle(r)
-   r:puts("Hi!")
+   r.content_type = "text/plain"
+   r:puts("Hi there!")
 end