Index: request.c
===================================================================
--- request.c	(revision 533104)
+++ request.c	(working copy)
@@ -175,6 +175,28 @@
     return 0;
 }
 
+static int req_table_set(lua_State *L) {
+    request_rec* r = check_request_rec(L, 1);
+    apr_table_t *table = (apr_table_t *)lua_unboxpointer(L, 2);
+    const char *key = luaL_checkstring(L, 3);
+    const char *val = luaL_checkstring(L, 4);
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "setting %s to %s", key, val);
+    apr_table_set(table, key, val);
+    return 0;
+}
+
+
+static int req_table_get(lua_State *L) {
+    const char* val;
+    request_rec* r = check_request_rec(L, 1);
+    apr_table_t *table = (apr_table_t *)lua_unboxpointer(L, 2);
+    const char *key = luaL_checkstring(L, 3);
+    val = apr_table_get(table, key);
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "getting %s = %s", key, val);
+    lua_pushstring(L, val);
+    return 1;
+}
+
 // helper function for the logging functions below
 static int req_log_at(lua_State* L, int level) {
     request_rec* r = check_request_rec(L, 1);
@@ -332,6 +354,18 @@
     lua_pushcfunction(L, &req_add_output_filter);
     lua_setfield(L, -2, "addoutputfilter");
 
+    lua_boxpointer(L, r->headers_out);
+    lua_setfield(L, -2, "headers_out");
+
+    lua_boxpointer(L, r->headers_in);
+    lua_setfield(L, -2, "headers_in");
+
+    lua_pushcfunction(L, &req_table_set);
+    lua_setfield(L, -2, "table_set");
+
+    lua_pushcfunction(L, &req_table_get);
+    lua_setfield(L, -2, "table_get");
+
     lua_pushlightuserdata(L, r);
     lua_pushcclosure(L, &req_newindex, 1);
     lua_setfield(L, -2, "__newindex");
