request.c revision fa21815c2fce84c8a6f56bccd3ad4c0537c6f1fd
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Licensed to the Apache Software Foundation (ASF) under one or more
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * contributor license agreements. See the NOTICE file distributed with
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * this work for additional information regarding copyright ownership.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * The ASF licenses this file to You under the Apache License, Version 2.0
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * (the "License"); you may not use this file except in compliance with
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the License. You may obtain a copy of the License at
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Unless required by applicable law or agreed to in writing, software
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * distributed under the License is distributed on an "AS IS" BASIS,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * See the License for the specific language governing permissions and
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * limitations under the License.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantztypedef char* (*req_field_string_f) (request_rec* r);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzvoid rstack_dump(lua_State* L, request_rec* r, const char* msg) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Lua Stack Dump: [%s]", msg);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz int t = lua_type(L, i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "%d: userdata", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "%d: lightuserdata", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "%d: NIL", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "%d: None", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "%d: %s", i, lua_toboolean(L, i) ? "true" : "false");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "%d: <table>", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "%d: <function>", i);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Verify that the thing at index is a request_rec wrapping
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * userdata thingamajig and return it if it is. if it is not
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * lua will enter its error handling routine.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic request_rec* apl_check_request_rec(lua_State* L, int index) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz request_rec* r = (request_rec*)lua_unboxpointer(L, index);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* ------------------ request methods -------------------- */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* helper callback for req_parseargs */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_aprtable2luatable_cb(void *l, const char *key, const char *value) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_State* L = (lua_State*)l; /* [table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* rstack_dump(L, RRR, "start of cb"); */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* L is [table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* build complex */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_getfield(L, -1, key); /* [VALUE, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* rstack_dump(L, RRR, "after getfield"); */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_newtable(L); /* [array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushnumber(L, 1); /* [1, array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushstring(L, value); /* [string, 1, array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_setfield(L, -2, key); /* [table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* [array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushstring(L, value); /* [string, #, array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_setfield(L, -2, key); /* [table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* L is [table<s,t>, table<s,s>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* build simple */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_getfield(L, -2, key); /* [VALUE, table<s,s>, table<s,t>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (lua_isnoneornil(L, -1)) { /* only set if not already set */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushstring(L, value); /* [string, table<s,s>, table<s,t>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_setfield(L, -3, key); /* [table<s,s>, table<s,t>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* r:parseargs() returning a lua table */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_do(req_aprtable2luatable_cb, L, form_table, NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return 2; /* [table<string, string>, table<string, array<string>>] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* wrap ap_rputs as r:puts(String) */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* wrap ap_rwrite as r:write(String) */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* r:parsebody() */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (ap_body_to_table(r, &form_table) == APR_SUCCESS) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_table_do(req_aprtable2luatable_cb, L, form_table, NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* r:addoutputfilter(name|function) */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "adding output filter %s", name);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_add_output_filter(name, L, r, r->connection);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz char* doc_root = apr_pstrdup(r->pool, ap_document_root(r));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* BEGIN dispatch mathods for request_rec fields */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_method_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_hostname_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_args_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_path_info_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_canonical_filename_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_filename_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_user_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_unparsed_uri_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_ap_auth_type_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_content_encoding_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_content_type_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_range_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_protocol_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const char* req_the_request_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_assbackwards_field(request_rec* r) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* END dispatch mathods for request_rec fields */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_getfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz req_fun_t* rft = apr_hash_get(dispatch, name, APR_HASH_KEY_STRING);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "request_rec->dispatching %s -> apr table (NOT IMPLEMENTED YET)", name);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "request_rec->dispatching %s -> lua_CFunction", name);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz "request_rec->dispatching %s -> boolean", name);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* helper function for the logging functions below */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_log_rerror(dbg.source, dbg.currentline, level, 0, r, msg);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* r:debug(String) and friends which use apache logging */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_emerg(lua_State* L) { req_log_at(L, APLOG_EMERG); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_alert(lua_State* L) { req_log_at(L, APLOG_ALERT); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_crit(lua_State* L) { req_log_at(L, APLOG_CRIT); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_err(lua_State* L) { req_log_at(L, APLOG_ERR); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_warn(lua_State* L) { req_log_at(L, APLOG_WARNING); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_notice(lua_State* L) { req_log_at(L, APLOG_NOTICE); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_info(lua_State* L) { req_log_at(L, APLOG_INFO); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int req_debug(lua_State* L) { req_log_at(L, APLOG_DEBUG); return 0; }
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* handle r.status = 201 */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* const char* key = luaL_checkstring(L, -2); */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_pushstring(L, apr_psprintf(r->pool, "Property [%s] may not be set on a request_rec", key));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const struct luaL_Reg request_methods[] = {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* {"__newindex", req_set_field}, */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const struct luaL_Reg connection_methods[] = {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic const struct luaL_Reg server_methods[] = {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic req_fun_t* makefun(void* fun, int type, apr_pool_t* pool) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz req_fun_t* rft = apr_palloc(pool, sizeof(req_fun_t));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzvoid apl_load_request_lmodule(lua_State *L, apr_pool_t *p) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "puts", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_puts, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "write", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_write, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "document_root", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_document_root, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "parseargs", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_parseargs, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "parsebody", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_parsebody, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_debug, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "info", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_info, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "notice", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_notice, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "warn", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "err", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "crit", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_crit, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "alert", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_alert, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "emerg", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_emerg, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "add_output_filter", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_add_output_filter, APL_REQ_FUNTYPE_LUACFUN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_status_field, APL_REQ_FUNTYPE_INT, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "protocol", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_protocol_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "range", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_range_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "content_type", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_content_type_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "content_encoding", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_content_encoding_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "ap_auth_type", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_ap_auth_type_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "unparsed_uri", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_unparsed_uri_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "user", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_user_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "filename", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_filename_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "canonical_filename", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_canonical_filename_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "path_info", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_path_info_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "args", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_args_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "hostname", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_hostname_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "uri", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_uri_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "the_request", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_the_request_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz apr_hash_set(dispatch, "method", APR_HASH_KEY_STRING,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz makefun(&req_method_field, APL_REQ_FUNTYPE_STRING, p));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_newmetatable(L, "Apache2.Request"); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_register(L, NULL, request_methods); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_newmetatable(L, "Apache2.Connection"); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_register(L, NULL, connection_methods); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_newmetatable(L, "Apache2.Server"); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz luaL_register(L, NULL, server_methods); /* [metatable] */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzvoid apl_push_connection(lua_State* L, conn_rec* c) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzvoid apl_push_server(lua_State* L, server_rec* s) {