Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 33519 invoked from network); 24 Dec 2008 02:23:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Dec 2008 02:23:01 -0000 Received: (qmail 8448 invoked by uid 500); 24 Dec 2008 02:23:00 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 8386 invoked by uid 500); 24 Dec 2008 02:23:00 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 8355 invoked by uid 99); 24 Dec 2008 02:23:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Dec 2008 18:23:00 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Dec 2008 02:22:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 53DD1238896F; Tue, 23 Dec 2008 18:22:39 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r729194 - /httpd/httpd/trunk/modules/lua/lua_request.c Date: Wed, 24 Dec 2008 02:22:39 -0000 To: cvs@httpd.apache.org From: pquerna@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081224022239.53DD1238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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");