]> granicus.if.org Git - apache/commitdiff
provide ap_escape_html as r:escape_html()
authorEric Covener <covener@apache.org>
Sat, 5 Nov 2011 00:16:36 +0000 (00:16 +0000)
committerEric Covener <covener@apache.org>
Sat, 5 Nov 2011 00:16:36 +0000 (00:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1197838 13f79535-47bb-0310-9956-ffa450edef68

modules/lua/lua_request.c

index aadda4d491a9ba47e27fc500d8012248143e8d08..a4a3a4ece97f13252bef887f15de3af93ff996c7 100644 (file)
@@ -208,6 +208,15 @@ static int req_construct_url(lua_State *L)
     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_lmodule(lua_State *L, apr_pool_t *p)
                  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,