]> granicus.if.org Git - apache/commitdiff
mod_lua: Add a few missing request_rec fields. Rename remote_ip to
authorStefan Fritsch <sf@apache.org>
Sat, 16 Jun 2012 22:41:01 +0000 (22:41 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 16 Jun 2012 22:41:01 +0000 (22:41 +0000)
client_ip to match conn_rec

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351014 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_lua.xml
modules/lua/lua_request.c

diff --git a/CHANGES b/CHANGES
index 1fdfecd8a1ef725ae48bc4f6f07108ba0022f3a0..e584188ba5b4e917b9ed960955de12d2db17864e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ Changes with Apache 2.5.0
      possible XSS for a site where untrusted users can upload files to
      a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
 
+  *) mod_lua: Add a few missing request_rec fields. Rename remote_ip to
+     client_ip to match conn_rec. [Stefan Fritsch]
+
   *) mod_lua: Change prototype of vm_construct, to work around gcc bug which
      causes a segfault. PR 52779. [Dick Snippe <Dick Snippe tech omroep nl>]
 
index 265137697e940d1fa9b3a83382a9cc5100e70d3f..fe3b0b8f13b9d2e8e2dff0c9671f2343c04c3344 100644 (file)
@@ -233,6 +233,16 @@ end
           <td>string</td>
           <td>yes</td>
         </tr>
+        <tr>
+          <td><code>context_prefix</code></td>
+          <td>string</td>
+          <td>no</td>
+        </tr>
+        <tr>
+          <td><code>context_document_root</code></td>
+          <td>string</td>
+          <td>no</td>
+        </tr>
 
         <tr>
           <td><code>document_root</code></td>
@@ -270,6 +280,11 @@ end
           <td>string</td>
           <td>no</td>
         </tr>
+        <tr>
+          <td><code>log_id</code></td>
+          <td>string</td>
+          <td>no</td>
+        </tr>
         <tr>
           <td><code>method</code></td>
           <td>string</td>
@@ -330,6 +345,11 @@ end
           <td>string</td>
           <td>yes</td>
         </tr>
+        <tr>
+          <td><code>useragent_ip</code></td>
+          <td>string</td>
+          <td>no</td>
+        </tr>
         </table>
 
         <p>The request_rec has (at least) the following methods:</p>
index c62baccf3e41880560ba143c5829c33de57beac3..380d8b6b3972b51d52bb14efb2040a1090a72aae 100644 (file)
@@ -235,6 +235,16 @@ static const char *req_document_root(request_rec *r)
     return ap_document_root(r);
 }
 
+static const char *req_context_prefix(request_rec *r)
+{
+    return ap_context_prefix(r);
+}
+
+static const char *req_context_document_root(request_rec *r)
+{
+    return ap_context_document_root(r);
+}
+
 static char *req_uri_field(request_rec *r)
 {
     return r->uri;
@@ -323,6 +333,16 @@ static const char *req_the_request_field(request_rec *r)
     return r->the_request;
 }
 
+static const char *req_log_id_field(request_rec *r)
+{
+    return r->log_id;
+}
+
+static const char *req_useragent_ip_field(request_rec *r)
+{
+    return r->useragent_ip;
+}
+
 static int req_status_field(request_rec *r)
 {
     return r->status;
@@ -599,6 +619,10 @@ AP_LUA_DECLARE(void) ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
                  makefun(&req_write, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING,
                  makefun(&req_document_root, APL_REQ_FUNTYPE_STRING, p));
+    apr_hash_set(dispatch, "context_prefix", APR_HASH_KEY_STRING,
+                 makefun(&req_context_prefix, APL_REQ_FUNTYPE_STRING, p));
+    apr_hash_set(dispatch, "context_document_root", APR_HASH_KEY_STRING,
+                 makefun(&req_context_document_root, APL_REQ_FUNTYPE_STRING, p));
     apr_hash_set(dispatch, "parseargs", APR_HASH_KEY_STRING,
                  makefun(&req_parseargs, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING,
@@ -679,6 +703,10 @@ AP_LUA_DECLARE(void) ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
                  makefun(&req_uri_field, APL_REQ_FUNTYPE_STRING, p));
     apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING,
                  makefun(&req_the_request_field, APL_REQ_FUNTYPE_STRING, p));
+    apr_hash_set(dispatch, "log_id", APR_HASH_KEY_STRING,
+                 makefun(&req_log_id_field, APL_REQ_FUNTYPE_STRING, p));
+    apr_hash_set(dispatch, "useragent_ip", APR_HASH_KEY_STRING,
+                 makefun(&req_useragent_ip_field, APL_REQ_FUNTYPE_STRING, p));
     apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING,
                  makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p));
     apr_hash_set(dispatch, "proxyreq", APR_HASH_KEY_STRING,
@@ -735,7 +763,7 @@ AP_LUA_DECLARE(void) ap_lua_push_connection(lua_State *L, conn_rec *c)
     lua_setfield(L, -2, "notes");
 
     lua_pushstring(L, c->client_ip);
-    lua_setfield(L, -2, "remote_ip");
+    lua_setfield(L, -2, "client_ip");
 
     lua_pop(L, 1);
 }