diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index c829682114..f97aedf9d4 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -211,15 +211,14 @@ static int req_add_output_filter(lua_State *L) return 0; } -static int req_document_root(lua_State *L) -{ - request_rec *r = apl_check_request_rec(L, 1); - lua_pushstring(L, ap_document_root(r)); - return 1; -} - /* BEGIN dispatch mathods for request_rec fields */ +/* not really a field, but we treat it like one */ +static char *req_document_root(request_rec *r) +{ + return ap_document_root(r); +} + static char *req_uri_field(request_rec *r) { return r->uri; @@ -520,7 +519,7 @@ void apl_load_request_lmodule(lua_State *L, apr_pool_t *p) apr_hash_set(dispatch, "write", APR_HASH_KEY_STRING, 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_LUACFUN, p)); + makefun(&req_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, "parsebody", APR_HASH_KEY_STRING, @@ -544,8 +543,7 @@ void apl_load_request_lmodule(lua_State *L, apr_pool_t *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, "assbackwards", APR_HASH_KEY_STRING, - makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, - p)); + makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p)); apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING, makefun(&req_status_field, APL_REQ_FUNTYPE_INT, p)); apr_hash_set(dispatch, "protocol", APR_HASH_KEY_STRING,