httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r729194 - /httpd/httpd/trunk/modules/lua/lua_request.c
Date Wed, 24 Dec 2008 02:22:39 GMT
Author: pquerna
Date: Tue Dec 23 18:22:38 2008
New Revision: 729194

URL: http://svn.apache.org/viewvc?rev=729194&view=rev
Log:
Add in the ability to fetch from headers_in.

Modified:
    httpd/httpd/trunk/modules/lua/lua_request.c

Modified: httpd/httpd/trunk/modules/lua/lua_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=729194&r1=729193&r2=729194&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_request.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_request.c Tue Dec 23 18:22:38 2008
@@ -428,6 +428,25 @@
     return 0;
 }
 
+static int req_headers_in(lua_State *L)
+{
+    const char *key;
+    const char *value;
+    request_rec *r = apl_check_request_rec(L, 1);
+
+    key = luaL_checkstring(L, 2);
+
+    value = apr_table_get(r->headers_in, key);
+    if (value) {
+        lua_pushstring(L, value);
+    }
+    else {
+        lua_pushnil(L);
+    }
+
+    return 1;
+}
+
 /* handle r.status = 201 */
 static int req_newindex(lua_State *L)
 {
@@ -534,7 +553,7 @@
     apr_hash_set(dispatch, "notice", APR_HASH_KEY_STRING,
                  makefun(&req_notice, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "warn", APR_HASH_KEY_STRING,
-                 makefun(req_warn, APL_REQ_FUNTYPE_LUACFUN, p));
+                 makefun(&req_warn, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "err", APR_HASH_KEY_STRING,
                  makefun(&req_err, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "crit", APR_HASH_KEY_STRING,
@@ -583,6 +602,9 @@
     apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING,
                  makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p));
 
+    apr_hash_set(dispatch, "headers_in", APR_HASH_KEY_STRING,
+                 makefun(&req_headers_in, APL_REQ_FUNTYPE_LUACFUN, p));
+
     lua_pushlightuserdata(L, dispatch);
     lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
 



Mime
View raw message