httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1187743 - in /httpd/httpd/trunk: CHANGES modules/lua/lua_request.c
Date Sat, 22 Oct 2011 18:07:43 GMT
Author: covener
Date: Sat Oct 22 18:07:43 2011
New Revision: 1187743

URL: http://svn.apache.org/viewvc?rev=1187743&view=rev
Log:
expose ap_construct_url to lua scripts


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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1187743&r1=1187742&r2=1187743&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Oct 22 18:07:43 2011
@@ -12,6 +12,9 @@ Changes with Apache 2.3.15
      PR 51714. [Stefan Fritsch, Jim Jagielski, Ruediger Pluem, Eric Covener,
      <lowprio20 gmail.com>]
 
+  *) mod_lua: add r:construct_url as a wrapper for ap_construct_url.
+     [Eric Covener]
+ 
   *) mod_remote_ip: Fix configuration of internal proxies. PR 49272.
      [Jim Riggs <jim riggs me>]
 

Modified: httpd/httpd/trunk/modules/lua/lua_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=1187743&r1=1187742&r2=1187743&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_request.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_request.c Sat Oct 22 18:07:43 2011
@@ -200,6 +200,14 @@ static int req_add_output_filter(lua_Sta
     return 0;
 }
 
+/* wrap ap_construct_url as r:construct_url(String) */
+static int req_construct_url(lua_State *L)
+{
+    request_rec *r = ap_lua_check_request_rec(L, 1);
+    const char *name = luaL_checkstring(L, 2);
+    lua_pushstring(L, ap_construct_url(r->pool, name, r));
+    return 1;
+}
 /* BEGIN dispatch mathods for request_rec fields */
 
 /* not really a field, but we treat it like one */
@@ -549,6 +557,8 @@ AP_LUA_DECLARE(void) ap_lua_load_request
                  makefun(&req_emerg, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "add_output_filter", APR_HASH_KEY_STRING,
                  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, "assbackwards", APR_HASH_KEY_STRING,
                  makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p));
     apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,



Mime
View raw message