1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

Add in the ability to fetch from headers_in.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@729194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Paul Querna
2008-12-24 02:22:38 +00:00
parent e27db0d67e
commit fb4dd06b2d

View File

@@ -428,6 +428,25 @@ static int req_debug(lua_State *L)
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 @@ void apl_load_request_lmodule(lua_State *L, apr_pool_t *p)
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 @@ void apl_load_request_lmodule(lua_State *L, apr_pool_t *p)
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");