Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5F1309904 for ; Sat, 5 Nov 2011 00:16:58 +0000 (UTC) Received: (qmail 80869 invoked by uid 500); 5 Nov 2011 00:16:58 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 80825 invoked by uid 500); 5 Nov 2011 00:16:58 -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 80818 invoked by uid 99); 5 Nov 2011 00:16:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 00:16:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Sat, 05 Nov 2011 00:16:57 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F0242238889B; Sat, 5 Nov 2011 00:16:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1197838 - /httpd/httpd/trunk/modules/lua/lua_request.c Date: Sat, 05 Nov 2011 00:16:36 -0000 To: cvs@httpd.apache.org From: covener@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111105001636.F0242238889B@eris.apache.org> Author: covener Date: Sat Nov 5 00:16:36 2011 New Revision: 1197838 URL: http://svn.apache.org/viewvc?rev=1197838&view=rev Log: provide ap_escape_html as r:escape_html() 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=1197838&r1=1197837&r2=1197838&view=diff ============================================================================== --- httpd/httpd/trunk/modules/lua/lua_request.c (original) +++ httpd/httpd/trunk/modules/lua/lua_request.c Sat Nov 5 00:16:36 2011 @@ -208,6 +208,15 @@ static int req_construct_url(lua_State * lua_pushstring(L, ap_construct_url(r->pool, name, r)); return 1; } + +/* wrap ap_escape_html r:escape_html(String) */ +static char * req_escape_html(lua_State *L) +{ + request_rec *r = ap_lua_check_request_rec(L, 1); + const char *s = luaL_checkstring(L, 2); + lua_pushstring(L, ap_escape_html(r->pool, s)); + return 1; +} /* BEGIN dispatch mathods for request_rec fields */ /* not really a field, but we treat it like one */ @@ -591,6 +600,8 @@ AP_LUA_DECLARE(void) ap_lua_load_request makefun(&req_add_output_filter, APL_REQ_FUNTYPE_LUACFUN, p)); apr_hash_set(dispatch, "construct_url", APR_HASH_KEY_STRING, makefun(&req_construct_url, APL_REQ_FUNTYPE_LUACFUN, p)); + apr_hash_set(dispatch, "escape_html", APR_HASH_KEY_STRING, + makefun(&req_escape_html, APL_REQ_FUNTYPE_LUACFUN, p)); apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING, makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p)); apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,