1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_lua: Add a few missing request_rec fields. Rename remote_ip to

client_ip to match conn_rec


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351014 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2012-06-16 22:41:01 +00:00
parent eca6d64df0
commit 32f5f54c25
3 changed files with 52 additions and 1 deletions

View File

@@ -6,6 +6,9 @@ Changes with Apache 2.5.0
possible XSS for a site where untrusted users can upload files to possible XSS for a site where untrusted users can upload files to
a location with MultiViews enabled. [Niels Heinen <heinenn google.com>] 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 *) 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>] causes a segfault. PR 52779. [Dick Snippe <Dick Snippe tech omroep nl>]

View File

@@ -233,6 +233,16 @@ end
<td>string</td> <td>string</td>
<td>yes</td> <td>yes</td>
</tr> </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> <tr>
<td><code>document_root</code></td> <td><code>document_root</code></td>
@@ -270,6 +280,11 @@ end
<td>string</td> <td>string</td>
<td>no</td> <td>no</td>
</tr> </tr>
<tr>
<td><code>log_id</code></td>
<td>string</td>
<td>no</td>
</tr>
<tr> <tr>
<td><code>method</code></td> <td><code>method</code></td>
<td>string</td> <td>string</td>
@@ -330,6 +345,11 @@ end
<td>string</td> <td>string</td>
<td>yes</td> <td>yes</td>
</tr> </tr>
<tr>
<td><code>useragent_ip</code></td>
<td>string</td>
<td>no</td>
</tr>
</table> </table>
<p>The request_rec has (at least) the following methods:</p> <p>The request_rec has (at least) the following methods:</p>

View File

@@ -235,6 +235,16 @@ static const char *req_document_root(request_rec *r)
return ap_document_root(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) static char *req_uri_field(request_rec *r)
{ {
return r->uri; return r->uri;
@@ -323,6 +333,16 @@ static const char *req_the_request_field(request_rec *r)
return r->the_request; 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) static int req_status_field(request_rec *r)
{ {
return r->status; 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)); makefun(&req_write, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING,
makefun(&req_document_root, APL_REQ_FUNTYPE_STRING, p)); 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, apr_hash_set(dispatch, "parseargs", APR_HASH_KEY_STRING,
makefun(&req_parseargs, APL_REQ_FUNTYPE_LUACFUN, p)); makefun(&req_parseargs, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING, 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)); makefun(&req_uri_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING, apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING,
makefun(&req_the_request_field, APL_REQ_FUNTYPE_STRING, p)); 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, apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING,
makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p)); makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "proxyreq", APR_HASH_KEY_STRING, 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_setfield(L, -2, "notes");
lua_pushstring(L, c->client_ip); lua_pushstring(L, c->client_ip);
lua_setfield(L, -2, "remote_ip"); lua_setfield(L, -2, "client_ip");
lua_pop(L, 1); lua_pop(L, 1);
} }