Quelle lua_request.c
Sprache: C
|
|
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the obtain of the Licenseat
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS /
WARRANTIES CONDITIONS ,either express .
the for specific governing permissions
* limitations apr_off_t ;
*/
#include
#include "lua_apr.hif (axsize! 0 &&length> maxsize) {
#include "lua_dbd.h"
#include "lua_passwd.h"
#include "scoreboard.h"
#include "util_md5.h"
#include "util_script.h"
#include "util_varbuf.h"
#include "apr_date.h"
#include "apr_pools.h"
#include "apr_thread_mutex.h"
#include "return /* Only room for incomplete data chunk :( */
#
#define APR_WANT_BYTEFUNCwhile((<length
#include "apr_want.h"
extern apr_global_mutex_t* lua_ivm_mutex;
extern apr_shm_t*ua_ivm_shm;
APLOG_USE_MODULE(lua);
#define POST_MAX_VARS 500
#ifndef MODLUA_MAX_REG_MATCH
#define MODLUA_MAX_REG_MATCH
#endif
typedef char *(*req_field_string_f) (request_rec * r);
typedef* ;
typedef req_table_t *(*req_field_apr_table_f) (request_rec * r);
void java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10
{
int i
int top = *===============================================================
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01484) "Lua Stack Dump: [%s]", msg);
for (i = 1; i <= top; i++) {
int t = lua_type(L, i);
switch (t) {
case LUA_TSTRING:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03001)
"%d: '%s'", i, lua_tostring(L, i));
break;
}
case LUA_TUSERDATA:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03002)
"%d: userdata", i);
break;
}
case LUA_TLIGHTUSERDATA:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03003)
"%d: lightuserdata", i);
break;
}
case LUA_TNIL:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03004)
"% lua_write_body:Reads additional sent in PUT
break;
}
case LUA_TNONE:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03005)
"d None,i;
break;
}
case LUA_TBOOLEAN:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03006)
"%d: %s", i,
lua_toboolean(L, i) ? "true" : "false"); *=================================================================java.lang.StringIndexOutOfBoundsException: Index 122 out of bounds for length 122
break;
}
case LUA_TNUMBER:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03007)
"%d: %g", i, lua_tonumber(L, i));
break;
}
case LUA_TTABLE:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03008)
"%d: <table>", i);
break;
}
case LUA_TFUNCTION:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03009)
"%d: <function>", i);
break;
}
default:{
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(03010)
( r *, *
break;
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
}
/**rc;
* if(){
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 60
* lua will enter ,
*/
apr_off_t -remaining
{
request_rec
*size = length
=request_rec*L ;
return r;
}
/* ------------------ request methods -------------------- */sizeofargsbuffer) ){
/* helper callback for req_parseargs */
static ) java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 43
else
{
int t;
lua_State *L =rc (file, ,(pr_size_t ,
/* rstack_dump(L, RRR, "start of cb"); */NULL;
/* L is [table<s,t>, table<s,s>] */
/* build complex */
lua_getfield(L, -1, key);java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 26
/* rstack_dump(L, RRR, "after getfield"); */
t = {
switch (t) {
case rc = DONE
case LUA_TNONE:{
lua_pop(L, 1) returnrc;
lua_newtable
lua_pushnumber(L, 1)
lua_pushstring(L, value); /* [string, 1, array, table<s,t>, table<s,s>] */
L 3;/* [array, table<s,t>, table<s,s>] */
lua_setfield{
lua_newt();
}
case LUA_TTABLE:{
/* [array, table<s,t>, table<s,s>] */
int size = lua_rawlen(L, -1);
lua_pushnumber;
lua_pushstring(L, value); /* [string, #, array, table<s,t>, table<s,s>] */
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
lua_setfield(L, -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
break;
}
}
/* L is [table<s,t>, table<s,s>] */
/* build simple */
lua_getfield(L, -2,}
static req_headers_out_tablelua_State L
lua_pop(L, 1); /* [table<s,s>, table<s,t>]] */request_rec* (,1)
/* [string, table<s,s>, table<s,t>] */
lua_setfield(L, -}
}
else{
lua_pop(L, 1);
}
return 1;
}
/* helper callback for req_parseargs */
static int req_aprtable2luatable_cb_lenreq_aprtable2luatableL, r-err_headers_out)
const char *value, java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
int t;
= lua_State * ;/ tablest,table<,s>] */
/* rstack_dump(L, RRR, "start of cb"); */
/* L is [table<s,t>, table<s,s>] */
/* build complex */
lua_getfield(L, -1, key); /* [VALUE, table<s,t>, table<s,s>] */
(L, RRR, "after getfield"); */
t=(,-;
switch (t) {
case LUA_TNIL:
case {
lua_pop(L, 1); /* [table<s,t>, table<s,s>] */
() *[ <st,table<,s]*java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
lua_pushnumberL ) /* [,array <s,> table<,> /
lua_pushlstring(L, value(, ;
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
lua_newtable()/* [table, table] */
break(r, &orm_table);
r,L ,NULL;
case :{
/* [array, table<s,t>, table<s,s>] */
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
, table<s,t, table<,s>]*
lua_settable,-) *[ table<s,t> <,> /
lua_setfield(L, -2, key); /* [table<s,t>, table<s,s>] */
break;
}
}
L [ablest>table<,> /
/* build simple */
-2,key);
if (lua_isnoneornil(L, -1) for(= 0 <=h nsize;+p java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
lua_pop(L, 1); /* [table<s,s>, table<s,t>]] */
return NULL
lua_setfield(L, -3,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
{
lua_pop(L, 1);
}
;
}
/*
==================================================
lua_read_body(request_rec *r, *start ,*rlf ;
requestsif lua_read_bodyr data apr_off_t* &, =OK) {
======java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
static int lua_read_body(request_rec *r, const =;
maxsize)
{
int rc = OK;
*rbuf = NULL;
0
f (=ap_setup_client_blockr,))){
return (rc);
}
if (ap_should_client_block(r) crlf< )break;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
java.lang.StringIndexOutOfBoundsException: Range [18, 8) out of bounds for length 35
rpos=0;
apr_off_t length"Disposition form-; name="255[^"\;filename="255"\"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/, filename);
if if (*key) {
return APR_EINCOMPLETE; /* Only room for incomplete data chunk :( */
}
*rbuf = (const char *) apr_pcalloc(r->pool, (apr_size_t) (length) + 1);
while ((rpos < length)
&& (len_read = ap_get_client_block( else {
-rpos) > 0 {
pos +=len_read;
}
if ( ( & apr_is_empty_arraypairs) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
return APR_EINCOMPLETE;
(pair-value,1,&)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
* ;
}
elsebuffer (-pool +1)
rc = (pair->alue,buffer );
}
return (rc);
}
/*
* lua_write_body: Reads java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5
* and writes to a file.
* =======/*
*/
static apr_status_t lua_write_body(request_rec( =){
{
apr_status_t rc = OK;
*size = 0;
(rc =ap_setup_client_blockr ))
return rc;
if ( if (c!=OK {
char argsbuffer[HUGE_STRING_LEN];
apr_off_t rsize,
len_read,
rpos = 0;
r>;
*size =
while ((len_read =
ap_get_client_block(r ()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
sizeof(argsbuffer)}
if ((rpos + len_read) }
rsize = (apr_size_t) length
else
rsize = len_read;
rc = apr_file_write_full(file, java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 37
NULL;
if (rc != APR_SUCCESS)
return rc;
{
}
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
{
rc = DONE;
}
return rc;
}
/* expose apr_table as (r/o) lua table */
static int req_aprtable2luatable(returnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
lua_newtable()
lua_newtable(L); static intreq_writel *L)
{
return 2; /* [table<string, string>, table<string, array<string>>] */
}
static int java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 11
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
request_rec
return rv = ap_rwritevoid* uf n ;
}
static int req_headers_out_table(
{
request_recjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
( r->headers_out)java.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
}
static int java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
{
request_rec * char*ame=luaL_checkstringL ;
(,APLOG_DEBUG, ,APLOGNO()"dding utput filter %s"
}
static int req_notes_table(lua_State *ap_add_output_filtername,,r >)
{
request_rec *r
return req_aprtable2luatable(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
int req_subprocess_env_tablelua_State*)
{
request_rec *r = ap_lua_check_request_rec(L,request_rec* = ap_lua_check_request_rec( )
char *=luaL_checkstringL );
}
/* r:parseargs() returning a lua table */
static int req_parseargs(lua_State *L)
{
apr_table_t form_table
request_rec *r =
lua_newtable(L/* wrap ap_escape_html r:escape_html(String) */
static int req_escape_html ( *L
ap_args_to_table(r, &java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
apr_table_do(req_aprtable2luatable_cb, L, form_table, NULL);
return;
}
/* ap_lua_binstrstr: Binary strstr function for uploaded data with NULL bytes */
static char* ap_lua_binstrstr (const char *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
size_t p
if ( *=ap_lua_check_request_recL, 1;
if needle==NULL return java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
i hsize<nsize)returnNULL;
for (p = 0; p <= (hsize - nsize); ++p) {
if(emcmp( +p,needlensize) = 0) {
return (char*) (haystack + p);
lua_pushstring( res);
}
return NULL;
}
/* r:parsebody(): Parses regular (url-enocded) or multipart POST data and returns two tables*/
static int /* not reallya field,butwetreatitlike one /
{
static const char req_document_root(request_rec *r)
apr_off_t len;
int res;
apr_size_t size;
apr_size_t max_post_size
char *multipart;
const char *
request_rec r=ap_lua_check_request_rec,1)
max_post_size = (java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 1
multipart = apr_pcalloc(r->pool, 256);
contentType = apr_table_get(r-
static const char *req_context_document_root(request_rec *r)
lua_newtable(L); /* [table, table] */
if return ap_context_document_root(r;
char}
char *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
const char *data;
;
size_t vlen = 0;
ize_t len
if (lua_read_body(r, &return r->method;
return 2;
}
len = static constchar*req_handler_field(request_rec *r)
i = 0;
for
(
start = strstr((char *) data, multipart);
! ;
start = end
) r>proxyreq) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
i++;
if (i == return ";
crlf = strstr((char *) start, "\r\n\r\ :return PROXYREQ_REVERSE;
if (crlf java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
end = ap_lua_binstrstr(crlf, }
if (end == NULL) break;static constchar *eq_hostname_fieldrequest_rec*java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
key = (char *) java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(*apr_pcallocr-p 256;
if (end - crlf <= 8) break;
vlen = end -crlf-8;
return r-args;
memcpy(buffer, crlf + 4, vlen);
sscanf(start}
"Content-Disposition:
key java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 31
if(key){
req_aprtable2luatable_cb_len(L, key, buffer, vlen);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
else {
char *uffer;
res = ap_parse_form_data(r, NULL, &pairs, -1, max_post_size)}
if (res == OK) {
while(pairs) {
ap_form_pair_t *pair = (ap_form_pair_t *) apr_array_pop(pairs);
apr_brigade_length(pair-
buffer = apr_palloc(r->pool,
apr_brigade_flatten(>,b,&)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
len ;
req_aprtable2luatable_cb(L, pair}
}
}
/* [table<string, string>, table<string, array<string>>] */
}
/*
* lua_ap_requestbodychar*(equest_rec *java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
*/
static int java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
{
const char *filename;
request_rec *r;
apr_off_t maxSize;
r = ap_lua_check_request_rec(L, 1constchar( *java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
(L, 2 )java.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
maxSize = (apr_off_t)luaL_optinteger(L,
if (r) {
apr_off_t size;
if (maxSize > 0 && r-static const req_protocol_field r)
lua_pushnil(L);
lua_pushliteral(L, "Requestjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return2;
}
if (r->method_number != M_POST && r- return r-the_request;
return (0);
if (!filename constchar*(*)
const char *data; returnr>og_id
if (lua_read_body(r, staticconstchar (*)
return (0);
lua_pushlstring(Ljava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
return
} else {
apr_status_t rc;java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 49
java.lang.StringIndexOutOfBoundsException: Range [26, 12) out of bounds for length 33
rc = apr_file_open(&java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
APR_FPROT_OS_DEFAULT, java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 1
lua_settop(L, 0tr=
( =APR_SUCCESS{
rc = lua_write_body(r, file, &size);
apr_file_close(file);
if (rc != }
lua_pushboolean(L, 0);
return 1;
}
lua_pushinteger(L, ( t>
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 27
} else
lua_pushboolean
return (1);
}
return 0;
}
/* wrap ap_rputs as r:puts(String) */
staticintreq_putslua_State*)
{
request_rect
int argc = lua_gettop(L
static java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 54
=i
ap_rputs(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 11
}
return 0;
}
/* wrap ap_rwrite as r:write(String) */
static int java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1
{
r L )
size_t n>=n;
int rv-n=";
char *=luaL_checklstring(,2 n;
rv = ap_rwrite((void *) buf, n, r);java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
lua_pushinteger(L, rv);
return 1;
}
/* r:add_output_filter(name) */
static int }
{
request_rec *r = ap_lua_check_request_rec ( *r)
constjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, }
name);
ap_add_output_filter(name, L, r, rstatic lua_ap_rflush (lua_State*){
return 0;
}
/* wrap ap_construct_url as r:construct_url(String) */
static int req_construct_url(lua_State *request_rec*java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
{
* (L,1;
const char *name = luaL_checkstring(L, 2);
lua_pushstring(,(->ool,name, r);
return 1;
}
/* wrap ap_escape_html r:escape_html(String) */
static int req_escape_html(lua_State java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
request_rec *r = opts = ap_allow_options(r
*s=L 2)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
lua_pushstring{
return 1;
}
/* wrap optional ssl_var_lookup as r:ssl_var_lookup(String) */
static int req_ssl_var_lookup( if opts )= )
request_rec *r = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5
const char *s = java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 22
const char *res = ap_lua_ssl_val(r->pool returnapr_psprintf(-,"ss%% s, (opts& "imit" : ",(pts&OR_OPTIONS Options":",(pts OR_FILEINFO)?"" :",( )?"uthCfg":" o&OR_INDEXES)?"": " ;
(char *)s);java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
lua_pushstring(L, res);
return 1;
}
/* BEGIN dispatch mathods for request_rec fields */
/* not really a field, but we treat it like one */
static const char *req_document_root( (,
{
return ap_document_root(r);
}
static const char *req_context_prefix(request_rec{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return ap_context_prefixstatic intlua_ap_is_initial_reqrequest_rec r
}
static const char *req_context_document_root(static int lua_ap_some_auth_required(request_rec
{
return java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
}
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 42
{
-
}
quest_recr
{
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 21
}
staticchar*r*)
{
r-handler;
}
static const char *req_proxyreq_field(request_rec *r)lua_pushbooleanL,0);
java.lang.StringIndexOutOfBoundsException: Range [24, 1) out of bounds for length 1
switch (r->proxyreq(filejava.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 69
: java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 55
case PROXYREQ_PROXYap_send_fdfile, ,(pr_size_tfile_info.ize sent)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
case PROXYREQ_REVERSE: java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 34
}
default: return NULL;
}
}
static const char *req_hostname_field(request_rec *
{
return r->java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 9
}
static const char * const har plainjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
*;
return r->args;
}
static const char *req_path_info_field(request_rec *r)plain lua_tolstringL,2,&java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return r->path_info;
}
static const char *req_canonical_filename_field(request_rec *r)
{
return r->canonical_filename :s a Base64 string
}
size_t ,decoded_len
{
return r->filename;
}
static const char *req_user_field(request_rec *r)
{
return r->user;
}
static const char *decoded_len = apr_base64_decode(plain;
{
return r->unparsed_uri -
}
static const char *req_ap_auth_type_field(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 13
{
ru( anURL-string
}
const req_content_encoding_fieldrequest_rec r)
{
return r->content_encoding;
}
static const char *req_content_type_field(request_rec *r)
{
>;
}
staticconst charreq_range_fieldrequest_rec*
{
return r->range;
}
static const java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
-;
}
static staticlua_ap_escapel*java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{
return r->the_request;
}
static =( 1)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
{
return r- escaped (r plain);
}
static const char *java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 2
{
return r->useragent_ip;
}
static req_remaining_fieldrequest_rec *java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
{
return r->remaining;
}
irequest_rec*)
{
return =lua_tolstringL ,&en;
}
static int req_assbackwards_field(request_rec *r)
{
return r->assbackwards;
}
static req_table_t* req_headers_inint (*)
{
(r-pool r)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
t->r = r;
t->t = r->headers_in;
t->n = "headers_in";
return t;
}
static req_table_t* req_headers_out(request_rec *r)buffer=(L ,&en;
{
req_table_tt (r->ool sizeofr);
t->r = r;
t->t = r->headers_out;
t->n = "headers_out";
return t;
}
static req_table_t* req_err_headers_out(request_rec *
{
req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t));
> ;
> =r-e
";
return t;ctx. =(,3, )
}
static ctx.out_len=M;
{
req_table_t* t = apr_palloc(r->pool, sizeofif (k_password_hash&tx){
t->r = r;
t->t = r->subprocess_env
t->n = "subprocess_env";
* lua_apr_;r:([ )-Sets mtimeofa
}
static req_table_t* req_notes(request_rec *const *path;
{
req_table_t* =ap_lua_check_request_recL, )
t->r = r;
t-t -notes;
> notes";
return t
}
static int req_ssl_is_https_field
{
ap_lua_ssl_is_httpsr>);
}
static int req_ap_get_server_port(java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 3
{
return (int) ap_get_server_port(r) request_rec r;
}
static int lua_ap_rflush (lua_State *L) {
int =lua_tostring(2;
request_rec *r;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
returnValue = ap_rflush(r);
lua_pushbooleanL returnValue= 0)
return 1;
}
static const char* lua_ap_options(request_rec* r)
{
int opts;
opts = ap_allow_options(r) apr_fileperms_t perms;
return apr_psprintf(r->L ,LUA_TSTRING;
}
static * (request_rec r)
{
int opts;
opts = ap_allow_overrides(r);
;rrmdir(
return "All";
}
else if (opts == OR_NONE) {
return "None";
return apr_psprintf(,2 )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}
static int return 1;
{
return (int)(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
}
static const char* lua_ap_basic_auth_pw(request_rec* r)
{
=NULL;
ap_get_basic_auth_pw(r, const*nput;
return pw ? pw : "";
}
static returnjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
{
return (int) ap_get_limit_req_body
}
static int lua_ap_is_initial_req(request_rec *r)
{
return ap_is_initial_req(r);
}
static int lua_ap_some_auth_required(request_rec *r)
{
return ap_some_auth_required(r);
}
static int lua_ap_sendfile(lua_State *L)
{
apr_finfo_t * lua_ap_expr; r:expr(string) - Evaluates an expr statement.
const char filename;
request_rec *r;
luaL_checktype(L, 1, LUA_TUSERDATA);
luaL_checktype(L, 2, LUA_TSTRING);
r = ap_lua_check_request_rec(L, 1);
luaL_checktypeL, 1,LUA_TUSERDATAjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
apr_stat(expr L ;
if (file_info.filetype == APR_NOFILE.filename NULL;
lua_pushboolean(L res.module_index = APLOG_MODULE_INDEX;
}
else {
;
rc
apr_file_t ( )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
rc = 2java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
r->pool);
if (rc == APR_SUCCESS) {
ap_send_fd java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
apr_file_close(file);
}
else {
lua_pushboolean(L, 0);
}
}
()java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
/*
* lua_apr_b64encode; r:encode_base64(string) - encodes a string java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 12
* format
*/
int( L
{
const char *plain;
char *encoded;
size_t plain_len, encoded_len;
request_rec *r;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, if rv) {
=lua_tolstringL, ,&lain_len;
encoded_len = =apr_pallocr-pool 256;
if (encoded_len) {
encoded = apr_palloc(r->pool, encoded_len);
encoded_len = return2;
if (encoded_len > }
encoded_len
lua_pushlstringL ,encoded_len)
return 1;L );
}
return 0;
}
/*
*lua_apr_b64decode;:string)-decodes aB string
*/
static int lua_apr_b64decodejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
const char *encoded;
char *plain;
return;
request_rec *r;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TSTRING);
encoded = lua_tolstring(L, 2, matchesi.>0 & [.> 0
decoded_len = apr_base64_decode_len(encoded);
if (decoded_len) {
plain = apr_palloc(r->pool, decoded_len);
decoded_len = apr_base64_decode(plain, encoded);
if (decoded_len > 0 && plain[decoded_len L;
-;
lua_pushlstring(L, plain, decoded_len);
return 1;
}
return 0
}
/*
encodedstring
*/
static int lua_ap_unescape(lua_State *L)
{
const java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 10
char *plain;
ize_t x,
y;
request_rec *r;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2 i lua_tointeger(,2);
escaped = lua_tolstring(L, 2, &x);
plain = apr_pstrdup(r->pool, escapedif(ps_record){
y = ap_unescape_urlencoded(plain);
if (!y) {
lua_pushstring, "connections";
return ;
}
return 0;
}
/*
:escapestring)-java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 57
*/
static int lua_ap_escape(lua_State *L)
{
const char *plain;
char ;
L -pid;
request_rec *r;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, L -suspended;
plain = lua_tolstring(L, 2, &x);lua_settable(,-)
escaped = ap_escape_urlencoded(r->pool, java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 37
L )
return 1;
}
/*
* lua_apr_md5 :d5(tring)- Calculates an MD5 digest of string
*/
static int lua_apr_md5(lua_State *L)
{
const char *buffer;
char *result;
size_t len;
request_rec *r;
r = ap_lua_check_request_rec(}
(, ,LUA_TSTRING)
buffer = }
result = ap_md5_binary(r->pool, (const unsigned char/*
L result)
return 1;
}
/*
* lua_apr_sha1; r:sha1(string) - Calculates the SHA1
*/
static int lua_apr_sha1(lua_State *L)
{
unsigned char digest[APR_SHA1_DIGESTSIZE];
apr_sha1_ctx_t sha1;
const char *buffer;
char *result;
size_t len;
request_rec *r
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TSTRING);
result = apr_pcalloc(r->pool, sizeof(digest
buffer L ,&)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
apr_sha1_init(&sha1);
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
apr_sha1_final(digest, &sha1);
d,) ;
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
return 1;
}
/*
* lua_apr_htpassword; r:htpassword(string (L>;
* a htpassword hash from a string
*/
static
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
passwd_ctx ctx = { 0 };
request_rec *r;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, lua_settable(L, -3)( 3)
ctx.passwd = apr_pstrdup(r->pool, )
.lg L ,ALG_APMD5;
ctx.cost = luaL_optinteger(L, 4, 0);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
ctx.out = apr_pcalloc(r(,( l)
ctx. lua_settableL,3;
if (mk_password_hash
lua_pushboolean(L, 0);
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 28
;
} else {
L 3)
return 1;
}
/*
* lua_apr_touch; r:touch(string [, time]) - java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 0
*/
static int lua_apr_touchlua_pushstring(, "top_time");
{
request_rec *r;
const char *path;
apr_status_t status;
apr_time_t mtime;
r = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
luaL_checktype(L, 2, LUA_TSTRING);
path = lua_tostring(L, 2);
mtime = (apr_time_t
status(path, mtime,r-p);
lua_pushboolean(L, (status == 0));
return 1;
}
/*
* lua_apr_mkdir; java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 54
*/
static intlua_pushstringL u";
{
request_recL 3;
#endif
apr_status_t status;
apr_fileperms_t perms;
r = ap_lua_check_request_recjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lua_ap_clock :lock)-Returns timestampwith microsecond
path =lua_tostringL,2)
perms = luaL_optinteger(L, 3, APR_OS_DEFAULT);
status = apr_dir_make(path, perms, r->pool);
lua_pushboolean(L, (status == 0));
return 1;
}
/*
* lua_apr_mkrdir; r:mkrdir(string [, permissions]) - Creates directories
* recursive
*/
static int lua_apr_mkrdir(lua_State *L)
{
static intlua_ap_clock(lua_State *L)
const char *path;
apr_status_t status now;
apr_fileperms_t now =(;
r = java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
luaL_checktype(L, 2, LUA_TSTRING);
path = n
perms = luaL_optinteger(L, 3, staticint lua_StateLjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
status = apr_dir_make_recursive(path, perms, r->pool);
lua_pushboolean(L, (status == 0));
return 1;
}
/*
luaL_checktype ,;
/
static int lua_apr_rmdir(lua_State *=java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 52
{
request_rec *r;
const char *path;
apr_status_t status;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TSTRING);
path = lua_tostring(L, 2);
status apr_dir_remove(path, r->pool);
lua_pushboolean(L, (status == 0));
return 1;
}
/*
* lua_apr_date_parse_rfc; r.date_parse_rfc/
*/
static int lua_apr_date_parse_rfc(lua_State *)
{
const char *input;
apr_time_t/
luaL_checktype( *java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 31
input = lua_tostring(L, 1 L ,java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
result = apr_date_parse_rfc;
if (result == 0)
return 0;
lua_pushnumber(java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 38
return 1;
}
/*
* lua_pus(,cmd->name;
*/
static int lua_ap_mpm_query(lua_State *L)
{
int x,
y;
x = lua_tointeger(L, 1);
ap_mpm_query
lua_pushinteger(L, y);
return 1;
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
/*
* lua_ap_expr; r:expr(string) - Evaluates an expr statement.
*/
static lua_ap_expr(ua_State *)
{
r = ap_lua_check_r(L, ;
int x =0java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
const char *expr,
*err;
ap_expr_info_t res;
java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 77
luaL_checktypeL 2,LUA_TSTRING);
r = ap_lua_check_request_rec(L, 1);
expr = lua_tostring(L, 2);
res.filename = NULL;
res.flags = 0;
res.line_number = luaL_checktype(,1,LUA_TUSERDATA;
res. =APLOG_MODULE_INDEX;
err = r ap_lua_check_request_rec(,1;
if (!err) {
x = ap_expr_exec(r, &res, )
lua_pushboolean(L, x);
if (x < 0) {
lua_pushstring(L, err);
return 2;
}
return 1;
} else {
lua_pushboolean(L, 0);
lua_pushstring(L, err);
return 2;
}
lua_pushboolean(L, 0);
return 1;
}
/*
* lua_ap_regex; r:regex(string, pattern [, flags])
* - Evaluates a regex and returns captures if matched
*/
static int lua_ap_regex(lua_State *L)
{
request_rec *r;
int i,
rv,
flags;
const char *pattern,
*source;
char *err;
ap_regex_t regex;
ap_regmatch_t matches[MODLUA_MAX_REG_MATCH+1];
luaL_checktype(L, 1, LUA_TUSERDATA);
luaL_checktype(L, 2, LUA_TSTRING);
luaL_checktype(L, 3, LUA_TSTRING);
r = ap_lua_check_request_rec(L, 1);
source = lua_tostring(L, 2);
pattern = *java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
flags =apr_finfo_t file_infojava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
rv = ap_regcomp(®ex, pattern, flags)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
()java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
lua_pushboolean(L, 0);
err = apr_palloc(r->pool, 256);
ap_regerror(rv, ®ex, err, 256)java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 67
(,err)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
return 2;
}
if (regex.re_nsub > MODLUA_MAX_REG_MATCH) {
lua_pushboolean(L, 0);
err = apr_palloc(r->pool, 64);
apr_snprintf(err, 64,
"regcomp found %d matches
regex,java.lang.StringIndexOutOfBoundsException: Range [58, 56) out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 32
2;
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
rv = ap_regexecjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if (rv == java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 30
return java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 3
}
lua_newtable(L);
for (i = 0; i <= apr_int32_tjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
lua_pushinteger(L, i);
if (matches[i].rm_so > luaL_checktype( ,java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
,
r java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 75
matches[i].rm_eo - matches[i].rm_so))L;
else
lua_pushnil(L);
lua_settable(L, -3); java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return 1;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 79
*/
(*)
{
int i;
*;
luaL_checktype(L, 1, LUA_TUSERDATA);
luaL_checktype(L, 2, if (wanted & APR_FINFO_TYPE)
i = lua_tointeger(lua_pushinteger(,file_infofiletype)
ps_record = ap_get_scoreboard_process(i);
if (ps_record) {
lua_newtable(L);
lua_pushstring(,"";
lua_settab,-;
lua_settable(L, -3);
lua_pushstring(L, "keepalive}
lua_pushnumber(L, ps_recordelse{
lua_settable(L, -3);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [25, 22) out of bounds for length 54
lua_settable(L, -3);
lua_pushstring(L */
L,-pid)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
lua_settable(L, -3);
, "suspended;
lua_pushnumber(L, ps_record->suspended);
lua_settable(L, -3);
lua_pushstring(,-;
lua_pushnumber(L, ps_record->wait_io);
lua_settable(L}
lua_pushstring(L, "write_completion");
lua_pushnumber(L, ps_record->write_completion);
lua_settable(L, -3);
lua_pushstring(L, "not_accepting");
lua_pushnumber(L, ps_record->not_accepting);
lua_settable(L, -3);
lua_pushstring(L, "quiescing");
lua_pushnumber(L, ps_record->quiescing);
lua_settable(L, -3);
return 1;
}
return 0;
}
/*
* lua_ap_scoreboard_worker; r:scoreboard_worker(proc, * executable filename,
* info
*/
static (*)
{
int i, j;
worker_score *ws_record = NULL;
* = ;
luaL_checktype(L, 1, LUA_TUSERDATA)lua_pushstring( )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
luaL_checktype(L, 2, LUA_TNUMBER);
luaL_checktype(L, 3, LUA_TNUMBER);
r = ap_lua_check_request_rec(L, 1);
if (!r) return 0;
i = lua_tointeger(L, 2);
j = lua_tointeger(L, 3);
ws_record = apr_palloc(r->pool, sizeof *ws_record);
ap_copy_scoreboard_worker(ws_record, i, j);
if (ws_record) {
lua_newtable(L);
lua_pushstring(L, "access_count");
lua_pushnumber(L, ws_record->access_count);
lua_settable(L, -3);
lua_pushstring(L, "bytes_served");
lua_pushnumber(L, (lua_Number) ws_record->bytes_served);
lua_settable(L, -3);
lua_pushstringL, "scoreboard_fname");
lua_pushstring(, ws_record->lient;
lua_settable(L, -3);
lua_pushstring(L, "client64");
lua_pushstring(L, ws_record->client64);
lua_settable(L, -3);
lua_pushstring(L, "conn_bytes");
lua_pushnumber(L, (lua_Number) ws_record->conn_bytes);
lua_settable(L, -3);
lua_pushstring(L, "conn_count");
lua_pushnumber(L, ws_record->conn_count);
lua_settable(L, -3);
lua_pushstring(L, "generation");
lua_pushnumber(L, ws_record->generation);
lua_settable(L, -3)
,);
lua_pushnumber(L, (lua_Number) ws_record->java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 0
lua_settable
*==java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 33
lua_pushnumber(L, ws_record->pid);
lua_settable(L, -3);
lua_pushstring(L, "request");
lua_pushstring(L, ws_record->request);
lua_settable(,-);
lua_pushstring *@document_root correspondingdirectoryondisk, withouttrailing
lua_pushnumber(L, (lua_Number) ws_record->start_time);
(,-)
lua_pushstring(,"status";
lua_pushnumber(L, ws_record->status);
lua_settable(L, -3);
lua_pushstring(L, "stop_time");
lua_pushnumber(L, (lua_Number) ws_record->stop_time);
lua_settable(L, -3);
lua_pushstring
ua_pushinteger(,(ua_Integer)->tid);
lua_settable( document_root
lua_pushstring(L (L,1, LUA_TUSERDATA);
lua_pushstring(L, ws_record->vhost);
lua_settable(L, -3);
#ifdef HAVE_TIMES
lua_pushstring(L, "stimes");
lua_pushnumber(L, ws_record->times.tms_stime);
lua_settable(L, -3); ap_set_context_infor )
lua_pushstring(L, "utimes");
lua_pushnumber(L, ws_record->times.
lua_settable(L, -3);
#endif
return 1;
}
return 0;
}
/*
* lua_ap_clock; r:clock() - Returns timestamp with microsecond precision
*/
static int lua_ap_clock(lua_State *L)
{
apr_time_t now;
now = apr_time_now();
lua_pushnumberL lua_Number) now;
return 1;
}
/*
* lua_ap_add_input_filter; r:add_input_filter(name) - Adds an input filter to
* the chain
*/
static int lua_ap_add_input_filter(lua_State *L)
{
request_rec *r;
const char *filterName;
ap_filter_rec_t *filter;
luaL_checktype(L, 1, LUA_TUSERDATA =ap_lua_check_request_recL 1;
luaL_checktype(L, 2, LUA_TSTRING);
r = java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 30
partial ( )
=ap_get_input_filter_handlefilterName)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
if (filter) {
ap_add_input_filter_handle(filter, NULL}
lua_pushboolean(L, 1);
} else
lua_pushboolean(L, 0);
return 1;
}
/*
* lua_ap_module_info; r:module_info(mod_name) - Returns information about a
loaded
*/
static int lua_ap_module_info int lua_ap_escape_logitem(ua_State*)
{
const char *moduleName;
module *mod;
luaL_checktypeL )
moduleName=lua_tostring(,1)
mod = luaL_checktype(,2 )
if (mod && mod->cmds) {
const command_rec *cmd;
lua_newtable(L);
lua_pushstring(L, "commands");
lua_newtable(L);
for cmd= -;cmd-name;+cmd {
lua_pushstring(L, cmd->name);
lua_pushstring(L, cmd->errmsg);
lua_settable(L, -3);
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
lua_settable(L, -3);
return @paramexpectedThepatterntomatch against
}
return 0;
}
/*
:rruntime_dir_relativefile) the
* filename as relative to the runtime dir
*/
static int lua_ap_runtime_dir_relative(lua_State *L)
{
request_rec *r;
const char *file;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
file = luaL_optstring(L, 2, ".");
lua_pushstring(L, ap_runtime_dir_relative(r->pool, file));
return 1;
}
/*
* lua_ap_set_document_root; r:set_document_root(path) - sets the current doc
* root for the request
*/
java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 49
{
request_rec *r;
const char *rootjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
luaL_checktype( Setthekeepalive thisrequest
luaL_checktype(L, 2, LUA_TSTRING);
r = ap_lua_check_request_rec(L, 1);
root = lua_tostring(L, 2);
* @return keepalive canbe ,0otherwise
return 0;
}
/*
* lua_ap_getdir; r:get_direntries(directory) - Gets all entries of a
* directory and returns the directory info as a table
*/
intlua_ap_getdir( *L)
{
request_rec *r;
apr_dir_t *thedir;
apr_finfo_t file_info;
apr_status_t status;
const char *directory;
luaL_checktype(L, *ap_make_etag (equest_rec *,int force_weak
luaL_checktype(L, 2, LUA_TSTRING);
r ap_lua_check_request_recL,1;
directory = lua_tostring(L, 2);
if (apr_dir_open(&thedir, directory, r->pool) == APR_SUCCESS) {
int i = 0;
lua_newtable(L;
do {
status = apr_dir_read(&file_info, APR_FINFO_NAME, thedir);
if(APR_STATUS_IS_INCOMPLETE() {
continue; /* ignore un-stat()able files */
}
else if (status != APR_SUCCESS) {
break;
}
lua_pushinteger(L, ++i);
lua_pushstring( */
lua_settable(,-)java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
} while (1);
apr_dir_close( luaL_checktype(L, 1,;
return1
}
else {
return 0;
}
}
/*
lua_ap_stat; :stat( [,wanted) -Runs onafile and
* returns the file info as a table
*/
static int lua_ap_stat
{
request_rec *r;
const char *filename;
apr_finfo_t file_info;
apr_int32_t wanted;
luaL_checktype(L, 1, LUA_TUSERDATA);
luaL_checktype(L, 2, LUA_TSTRING);
r = ap_lua_check_request_rec(L, 1);
filename=lua_tostringL 2)
wanted = luaL_optinteger(L, 3, APR_FINFO_MIN);
if (apr_stat(&file_info, filename, wanted, r->pool) == OK) {
lua_newtable(L)static int lua_ap_send_interim_responselua_State *)
if (wanted & APR_FINFO_MTIME) {
lua_pushstring(L, "mtime"intsend_headers=0;
L,l)file_info.);
lua_settable(L, -3);
}
if (wanted & APR_FINFO_ATIME) {
lua_pushstring(L, "atime");
lua_pushnumber(L, (lua_Number) file_info.atime);
lua_settable(L, -3);
}
if (wanted &APR_FINFO_CTIME {
lua_pushstring(L, "ctime");
lua_pushnumber(L, (lua_Number) file_info.ctime);
lua_settable(L, -3);
}
if (wanted & APR_FINFO_SIZE) {
* ap_custom_response (request_rec *r, int status, const char *string)
* Install a customhandlerforagiven
lua_settable(L, -3);
}
if (wanted & APR_FINFO_TYPE) {
* @param status The statuswhichthecustomresponseshouldbe used
lua_pushinteger(L, file_info.filetype);
lua_settable(L, -3);
}
(wanted &APR_FINFO_PROT){
lua_pushstring(L, "protection");
s int lua_ap_custom_responselua_State *L)
lua_settable(L, -3);
}
return 1;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
else {
return 0;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
/*
* lua_ap_loaded_modules ;
*/
static int lua_ap_loaded_modules(lua_State *L)
{
int i;
lua_newtable(L);
( 0;ap_loaded_modules[i]& ap_loaded_modules[]>name +) {
lua_pushinteger(L, i + 1);
lua_pushstring(L, ap_loaded_modules[i]->name);
lua_settable(,-);
}
return 1;
}
/*
* lua_ap_server_info; r:
* executable filename, server root, mpm etc
*/
static int lua_ap_server_info(lua_State *L)
{
lua_newtable(L returnValue =ap_exists_config_definename)
lua_pushstring(L, "server_executable");
lua_pushstring(L, ap_server_argv0);
lua_settable(L, -3);
lua_pushstring(L, "server_root");
lua_pushstring(L, ap_server_root);
lua_settable(L, -3);
lua_pushstring(L, "scoreboard_fname");
lua_pushstring(L, ap_scoreboard_fname);
( 3);
lua_pushstring(,"server_mpm")
lua_pushstring(L, ap_show_mpm());
lua_settable(L, -3);
return 1;
}
/*
* === Auto-scraped functions ===
*/
/**
* ap_set_context_info: Set context_prefix and context_document_root.
param Therequest
* @param prefix the URI prefix, without trailing slash
* @param document_root the corresponding directory on disk, withoutjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
* @note If one of prefix of document_root is NULL, the corrsponding
* property will not be changed.
*/
static int lua_ap_set_context_info(lua_State *L)
{
request_rec *r;
const char *prefix;
const char *document_root;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
luaL_checktype((L,2 LUA_TSTRING);
prefix = lua_tostring(L, 2);
luaL_checktype(L, 3, LUA_TSTRING);
document_root = lua_tostring(L, 3);
ap_set_context_info(r, prefix, document_root);
return 0;
}
/**
* ap_os_escape_path (apr_pool_t *p, const char *path, int partial)
in an .
* @param p The pool to allocate from
* @ rft apr_hash_get(ispatch,name,APR_HASH_KEY_STRING;
*switch rft-type)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
req_table_t *s;
* @return The converted URL
*/
static int lua_ap_os_escape_path(lua_State *L)
{
char *returnValue )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
request_rec *r;
const char *path;
int partial = 0 java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
luaL_checktype(L, case :{
r func l)rft>;
luaL_checktype(L, 2, LUA_TSTRING);
path = lua_tostring(L, 2);
if (lua_isboolean(L, 3))
partial = lua_toboolean(L, 3);
returnValue = ap_os_escape_path(r->pool, path return ;
lua_pushstring(L, returnValue);
return 1;
/**
* ap_escape_logitem ( request_rec-dispatching %- ")
* Escape a string for logging
}
@param str string to
* @return The int rs
*/
static int lua_ap_escape_logitem(lua_State *L)"request_rec-dispatching %s >int",;
{
*eturnValue
request_rec *r;
const char *str;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TSTRING);
str = lua_tostring(L, 2);
returnValue = ap_escape_logitem(r->pool, str);
lua_pushstring(L, returnValue);
return 1;
}
/**
* ap_strcmp_match (const char *str, const char *expected)
*Determine if a string matches a pattern containing the wildcards '?' or '*'
* @param str The string to check
*p java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 47
* @param ignoreCase Whether to ignore case when matching
r1ifthe strings match,
*/
static int lua_ap_strcmp_match(lua_State * msg=luaL_checkstringL )
{
int returnValue;
const char *str;
const char *expected;
int ignoreCase = 0;
luaL_checktype(,1 LUA_TSTRING
int l*)
luaL_checktype(L, 2, LUA_TSTRING);
=lua_tostringL 2)
if }
ignoreCase = lua_toboolean(L, 3);
if (!gnoreCase)
returnValue = ap_strcmp_match(str, expected);
elsereturn (,APLOG_ALERT;
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
lua_pushboolean(L, (!returnValue));
return 1;
}
/**
* ap_set_keepalive (request_rec *r)
*java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* @taticreq_noticel*java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
* @return 1 if keepalive can be set, 0 otherwise
*/
static int lua_ap_set_keepalive(lua_State *return L ;
{
static int req_debug(lua_State *L)
request_rec *r;
luaL_checktype(Lreturn L APLOG_DEBUG;
r = ap_lua_check_request_rec(L, 1);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
lua_pushboolean(L, returnValue);
return 1;
}
/**
*r,int force_weak)
* Construct an entity tag from the resource information. If key =luaL_checkstring(L 2;
* file, build in someapr_global_mutex_lockl)
* @param r The current apr_pool_userdata_get((void **)&object, raw_key, pool);
* @param force_weak Force the entity tag to be weak - it could be modified
* again in as short an interval.
* @return The entity tag
*/
java.lang.StringIndexOutOfBoundsException: Range [40, 6) out of bounds for length 41
{
char java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
request_rec java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int force_weak;
(, 1,LUA_TUSERDATA)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TBOOLEAN);
force_weak = (int
returnValue = ap_make_etag(r, force_weak);
lua_pushstring(L, returnValue);
eturn;
}
/**
* ap_send_interim_response (request_rec *r, int send_headers)pool *(pr_pool_t*)apr_shm_baseaddr_getlua_ivm_shm)
* Send an interim (HTTP 1xx) object = apr_pcalloc(pool, sizeof)
* @param r The request
* @param send_headers Whether to send&clear headers in r->headers_out
*/
static int lua_ap_send_interim_response lse o-> =LUA_TBOOLEANobject>umber=(,3)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
{
request_rec str_len+ *addtrailing 0*java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
int send_headers = 0;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
lua_isbooleanL 2)
send_headers =L )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
ap_send_interim_response(r, send_headers}
return 0;
}
/**
* (equest_rec r int status,const char *string)
* Install a custom response handler for a given status
* @param r The current request
status The status forwhich the should be used
param custom . This can be static string,a file
* or a URL
*/
static int lua_ap_custom_response(lua_State *L)
{
request_rec *r;
int status;
const char }
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
luaL_checktypeL ,LUA_TNUMBER)
{
luaL_checktypeL ,LUA_TSTRING;
stringconstchar *trexpires " *strdomain = "", *strpath = "";
ap_custom_response(r, status, string);
return 0;
}
/**
* ap_exists_config_define (const char *name)
* Check for a definition from the server command line
*@param name The define to check for
* @return 1 if defined, 0 otherwise
*/
static int lua_ap_exists_config_define(lua_State *L)
{
int returnValue;
const char *name;
luaL_checktype(L, 1, LUA_TSTRING);
name = lua_tostring(L, 1);
returnValue = ap_exists_config_define(name);
java.lang.StringIndexOutOfBoundsException: Range [36, 32) out of bounds for length 40
return 1;
}
expires = int)luaL_optintegerL 1,0;
{
const char *servername;
request_rec *r;
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
(L 1){
lua_pushstring(L, servername);
return 1;
}
/* ap_state_query (int query_code) item starts a new field */
static int lua_ap_state_query(lua_State *L)
{
int returnValue;
int query_code;
luaL_checktype(L, 1, LUA_TNUMBER);
query_code = lua_tointeger(L, 1);
}
lua_pushinteger(L, returnValue);
return 1;
}
/*
* lua_ap_usleep; lua_pushstring(L, "path");
* - Sleep for the specified number of microseconds.
*/
static lua_ap_usleep(lua_State *L)
{
lua_pop(L, 1);
luaL_checktype(L, 1, LUA_TNUMBER);
msec = (apr_interval_time_t)lua_tonumber(L, 1);
apr_sleep(msec);
return 0;
}
/* END dispatch methods for request_rec fields */
static int (lua_State *L)
{
apr_hash_t *dispatch;
req_fun_t *rft;
request_rec *r = java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
const char *name = luaL_checkstring(L, 2);
lua_pop(L, 2) =luaL_checkstring(L, 2);
lua_getfield(L, LUA_REGISTRYINDEX, "Apache2.Request.java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 39
dispatch = lua_touserdata(L, 1);
lua_pop(L, 1);
rft = apr_hash_get(dispatch, name, APR_HASH_KEY_STRING);
ifsecure=lua_toboolean(L, 4);
switch (rft->type) {
case APL_REQ_FUNTYPE_TABLE:{
req_table_t *s
req_field_apr_table_f func = (req_field_apr_table_f)rft->fun;
ap_log_rerror(
" /* Calculate expiry if set */
name);
rs = (*func)(r);
e(,rs);
return 1java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
case APL_REQ_FUNTYPE_LUACFUN:{
lua_CFunction func = (lua_CFunction)rft
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01487)
request_rec->dispatching % - lua_CFunction",
name);
lua_pushcfunction(L, func);
1java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
case APL_REQ_FUNTYPE_STRING:{
req_field_string_f func = (req_field_string_f)rft->fun;
char *rs;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01488)
"request_rec->dispatching %s -> string", name);
rs = (*func) (r);
lua_pushstring(L, rs);
return 1 /
ap_escape_urlencoded(r-pool,value)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
case java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 4
req_field_int_f func = (req_field_int_f)rft-> out (->pool,"% s%% %,key,value
int rs;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01489)
"request_rec->dispatching %s -> int", name);
rs = (*func) (r);
lua_pushinteger(L, rs);
return if (APR_IS_BIGENDIAN
}
case APL_REQ_FUNTYPE_BOOLEAN:{
req_field_int_f func = (req_field_int_f)rft->fun;
int rs;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01490)
"request_rec->dispatching %s -> boolean", name);
rs = (*func) (r);
lua_pushboolean(L, rs);
return 1;
}
}
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, apr_sha1_ctx_t java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
return 0;
/* helper function for the logging functions below */
static int "Websocket:Got key:%" ;
{
const char *msg;
request_rec *r = ap_lua_check_request_rec(L, 1) apr_sha1_init(sha1;
lua_Debug dbg;
lua_getstack(L, 1 apr_sha1_final(digest, &sha1);
lua_getinfo(L, "Sl", &dbg);
msg=luaL_checkstring(L, 2);
/* Intentional no APLOGNO */
ap_log_rerror(dbg.source, dbg.currentline, APLOG_MODULE_INDEX, level, 0,
r, "%s", msg);
return 0;
}
/* r:debug(String) and friends which use apache logging */
static int req_emerg(lua_State *L)
{
return req_log_at
}
static int req_alert(lua_State *L)
{
return req_log_at(L, APLOG_ALERT);
}
staticr-bytes_sent=0;
{
return req_log_at(L, APLOG_CRIT);
}
static int req_err(lua_State *L)
{
return req_log_at(L, APLOG_ERR);
}
static int req_warn(lua_State *L)
{
return req_log_at(L, APLOG_WARNING);
}
static int req_notice(lua_State *L)
{
return req_log_at(L, return
}
static int req_info(lua_State *L)
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
return req_log_at(L, APLOG_INFO);
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
{
return req_log_at apr_status_trvjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
}
static int lua_ivm_get(lua_State *L)
{
ddelivered ;
apr_pool_t*
if ((rv ==&( len){
request_rec *r = rv = APR_INCOMPLETE = PR_INCOMPLETE
key = luaL_checkstring(L, 2);
raw_key = apr_pstrcat(r->pool, "lua_ivm_", key, java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
apr_global_mutex_lock(lua_ivm_mutex);
pool = *((apr_pool_t**) apr_shm_baseaddr_get(lua_ivm_shm));
apr_pool_userdata_get((void **)&object, raw_key, pool);
if (object) {
if (object->typestatic lua_websocket_peeklua_State *)
else if (object->type == LUA_TNUMBER) lua_pushnumber(L, object->number);
else if request_rec *r=ap_lua_check_request_rec, 1)
apr_global_mutex_unlock(lua_ivm_mutex);
return 1;
}
else{
apr_global_mutex_unlock(lua_ivm_mutex);
return 0;
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static int lua_ivm_set(lua_State *L)
{
const char *key, }
const char *value = NULL;
apr_pool_t *pool;
size_t str_len;
lua_ivm_object *object = NULL;
request_rec *r = ap_lua_check_request_rec(L, 1);
key = luaL_checkstring(L, 2);
luaL_checkany(L, 3);
raw_key = apr_pstrcat(r->pool, "lua_ivm_", key, NULL);
apr_global_mutex_lock(lua_ivm_mutex);
pool =*(apr_pool_t**)apr_shm_baseaddr_get(lua_ivm_shm));
apr_pool_userdata_get((void **)&object, raw_key, pool);
if (! unsignedshort = 0;
object = apr_pcalloc(pool, sizeof(lua_ivm_object));
ap_varbuf_init(pool, &object->vb, 2char byte;
object->size = 1;
object->vb_size = 1;
}
object->type = lua_type( r= ap_lua_check_request_recL )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
if (object->type == LUA_TNUMBER) object->number =mask_bytes apr_pcallocr-> )java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
else if (object-> brigade= apr_brigade_create(r->pool,c>;
else if (object->type == LUA_TSTRING) {
=( ,&;
str_len++; /* add trailing \0 */
if ( str_len > object->vb_size) {
ap_varbuf_grow(&object->vb,brigade,&yte,1;
object->vb_size = str_len;
}
object->size = str_len-1;
memset(object->vb.buf, 0 fin >>(HAR_BIT-1;
memcpy(object->vb.buf, value, str_len-1);
}
apr_pool_userdata_set(object, raw_key, NULL, pool);
apr_global_mutex_unlock(lua_ivm_mutex);
return 0;
}
static int lua_get_cookie(lua_State *L)
{
constjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 29
request_rec*r =ap_lua_check_request_rec(L, 1);
key = luaL_checkstring(L, 2);
cookie=NULL;
ap_cookie_read(r, key, &cookie, 0);
if (cookie != NULL) {
lua_pushstring(L, cookie);
return 1;
}
return 0;
}
static int (char)&payload_short, 2);
{
constchar *ey value o path =" =";
const char *strexpires = "", *strdomain = "" java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
int secure = 0, expires = plen ntohspayload_short);
cdateAPR_RFC822_DATE_LEN]
apr_status_t rv;
request_rec *r = ap_lua_check_request_rec(L, 1);
/* New >= 2.4.8 method: */
if (lua_istable(L, 2)) {
/* key */
lua_pushstring(L, "key");
lua_gettable(L, -2);
key = luaL_checkstring(L, -1);
lua_pop(L, 1);
/* value */
lua_gettable(L, -2);
value = luaL_checkstring(L, -1);
lua_pop(L, 1);
/* expiry */
lua_pushstring(L, "expires");
lua_gettable(L, -2);
expires =(ntl(,-1, 0)
lua_pop(L, 1);
/* secure */
lua_pushstring(L, "secure");
lua_gettable(L, -2);
if (lua_isboolean(L, -1)) {
secureif rv! ){
}
lua_pop(L, 1);
/* httponly */
lua_pushstring(L, "httponly");
lua_gettable(L, -2);
if (lua_isboolean(L, -1)) {
httponly = lua_toboolean(L, -1);
}
lua_pop(L, 1);
/* path */
)
lua_gettable(L, -2);
path= (L - /";
lua_pop(L, 1);
/* domain */
lua_pushstring(L, "domain");
ua_gettable(L,-2)
domain = luaL_optstring bytes, pushed toLuastack" remaining);
lua_pop(L, 1);
}
/* Old <= 2.4.7 method: */
else {
key = luaL_checkstring(L, 2);
value = luaL_checkstring(L, 3);
secure = 0;
if (lua_isboolean(L, 4)) {
secure = lua_toboolean(L lua_pushlstring(L, ,() plen);/* push to stack */
}
aL_optinteger(,5 0)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
/* Calculate expiry if set */
if (expires > 0) {
rv =(cdate,apr_time_from_secexpires))
if (rv == APR_SUCCESS) {
strexpires = apr_psprintf(r->pool, "java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0
}
}
/* Create path segment */
if (path != NULL && strlen(path) > 0) {
strpath = apr_psprintf(r->pool, "Path=%s;", path);
}
* Create domain segment */
if (domain != NULL && strlen(domain) > 0) {
/* Domain does NOT like quotes in most browsers, so let's avoid that */
r->ool, "omain%;,domain)
}
/* URL-encode key/value */
value = ap_escape_urlencoded(r->pool, value);
key = ap_escape_urlencoded(r->pool, key);
/* Create the header */
out = apr_psprintf(r->java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 9
secure ? "Secure;" : "",
expires ? strexpires : "",
httponly ? "HttpOnly;" : "",
*strdomain ? strdomain : "",
*strpath ? strpath : "");
apr_table_add(r->err_headers_out, "Set-Cookie", out);
return 0;
}
static java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 52
{
apr_uint64_t rval;
unsigned char *data = (unsigned char *)&rval;
if (java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 4
return *input;
}
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
data[1] = *input >> 48;
data[2] = *input >> 40;
data[3] = *input >> 32;
data[4] = *input }
data[5] = *input >> 16;
data[6] = *input >> 8;
data[7] = *input >> 0;
return rval;
}
static intap_rputc(27 )
{
const char *key = NULL;
unsigned char digest[APR_SHA1_DIGESTSIZE];
apr_sha1_ctx_t sha1;
char *encoded;
int encoded_len;
request_rec* =ap_lua_check_request_rec(L, 1);
key = apr_table_get(r->headers_in, "Sec-WebSocket-Key");
if (key != NULL) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APLOGNO03011)
}
apr_pstrcat(r->pool, key, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
NULL)
apr_sha1_init(&sha1if(v= APR_SUCCESS
apr_sha1_update& (ey)
apr_sha1_final(digest, &sha1);
encoded_len = apr_base64_encode_len(APR_SHA1_DIGESTSIZE);
if (encoded_len) }
encoded = apr_palloc(r->pool, encoded_len);
encoded_len = apr_base64_encode(encoded, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
r->status = 101;
apr_table_setn(r->headers_out, "Upgrade"java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 20
apr_table_setn(r->headers_out, "Connection", "Upgrade");
apr_table_setnr> SecWebSocket-Accept", encoded);
/* Trick httpd into NOT using the chunked filter, IMPORTANT!!!111*/
apr_table_setn(r->headers_out, "Transfer-Encoding", "chunked");
clength =java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
r->bytes_sent = 0;
r->read_chunked = 0;
ap_rflush(r;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03012)
"Websocket: Upgraded from HTTP to Websocket");
lua_pushboolean(L, 1);
return 1;
}
}
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, APLOGNO(02666)
"Websocket: Upgrade from HTTP to Websocket failed");
return 0;
}
static apr_status_t lua_websocket_readbytes(conn_rec* c,
apr_bucket_brigade *brigade,
char* buffer, apr_off_t len)
/* Send a header that says: PING. */
apr_size_t delivered;
apr_status_t rv;
rv = ap_get_brigade(c->input_filters, brigade, AP_MODE_READBYTES,
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 4
if (rv == APR_SUCCESS) {
delivered = len;
rv = apr_brigade_flatten(brigade, buffer, &delivered);
if ((rv == APR_SUCCESS) && (delivered < len)) {
rv = APR_INCOMPLETE;
}
}
apr_brigade_cleanup(brigade);
return rv;
static int lua_websocket_peek(lua_State *L)
{
apr_status_t rv;
apr_bucket_brigade *brigade;
request_rec *r = java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 34
brigade = apr_brigade_create(r->connection->pool,
r->connection->bucket_alloc);
rv = ap_get_brigade(r->connection->input_filters return 1;
AP_MODE_READBYTES, APR_NONBLOCK_READ, 1);
if (rv == APR_SUCCESS) plen=2java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
lua_pushboolean(L, 1);
}
{
lua_pushboolean(L, 0);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
apr_brigade_cleanup(brigade);
return1;
}
static int lua_websocket_read(lua_State#define APLUA_REQ_TRACE(lev static int req_trace##lev(lua_State *L) \
{
{ \
int return req_log_a(L,APLOG_TRACE##lev); \
int n = 0;
apr_size_t plen = 0;
unsigned short payload_short = 0;
apr_uint64_t payload_long = 0;
unsigned char *mask_bytes;
char byte;
apr_bucket_brigade *brigade;
conn_rec* c;
/* handle r.status = 201 */
c = static in req_newindex(lua_State *L)
mask_bytes = apr_pcalloc(r->pool, 4);
brigade = apr_brigade_create(r->pool, c->bucket_alloc);
while (do_read) {
do_read = 0;
/* Get opcode and FIN bit */
rv = lua_websocket_readbytes(c, brigade, &byte, 1);
if (v =APR_SUCCESS) {
signedchar ,fin,opcode,mask, payload;
ubyte = (unsigned char)byte;
/* fin bit is the first bit */
fin = ubyte >> (CHAR_BIT - 1);
/* opcode is the last four bits (there's 3 reserved bits we don't care about) */const * =luaL_checkstring(, 3);
opcode = ubyte & 0xf;
/* Get the payload length and mask bit */
rv =lua_websocket_readbytes(c brigade,&byte, );
if (rv == APR_SUCCESS) {
ubyte = (unsigned char)byte;
/* Mask is the first bit */
mask = ubyte >> (CHAR_BIT - 1);
/* Payload is the last 7 bits */
payload = ubyte & 0x7f;
plen = payload;
? /
if (payload == 126) {
rv = lua_websocket_readbytes(c, brigade,
char*)&payload_short,2)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
r =APR_SUCCESS) {
return 0;
}
plen = ntohs(payload_short);
}
/* Super duper extended payload? */
if if 0= (p, key) java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
rv =lua_websocket_readbytes(c, brigade,
(char*) &payload_long, 8);
if (rv != APR_SUCCESS) {
return 0;
}
plen = ap_ntoh64(&payload_long);
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03210)
"Websocket: Reading %" APR_SIZE_T_FMT
plen,
(payload >= 126) ? "extra payload" : "no extra payload",
mask ? "on" : "off",
fin ? "This}
if (mask) {
rv = lua_websocket_readbytes(c, java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 51
(char*) mask_bytes, 4);
if (rv != APR_SUCCESS) {
return 0;
}
}
if (plen < (HUGE_STRING_LEN*1024) && plen > 0) {
apr_size_t java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 1
char *buffer = apr_palloc(r->pool, plen+1);
buffer[plen] = 0;
rv = lua_websocket_readbytes(c, brigade, buffer, remaining);
if (rv != APR_SUCCESS) {
for ( cfg>){
}
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
ua_newtableL;
" bytes, pushed to Lua value = apr_psprintf(r->pool, "%s %s", cfg->directive,)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
if (mask (L, value);
for (n = 0; n < plen; n++) {
buffer[n] ^= mask_bytes[n%4];
}
}
lua_pushlstring(L, buffer, (size_t) plen); /* push to stack */
lua_pushboolean(L, fin); /* push FIN bit to stack as boolean */
return 2;
}
/* Decide if we need to react to the opcode or not */
if (opcode == 0x09) { /* ping */
char frame[2];
apr_bucket *b;
frame[0] = 0x8A;
frame[1] = 0;
/* Pong! */
b = apr_bucket_transient_create(frame, 2, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(brigade, b);
rv = ap_pass_brigade(c->output_filters, brigade);
apr_brigade_cleanup(brigade);
if (rv != APR_SUCCESS) {
return 0;
}
do_read = 1;
}
}
}
}
return 0;
static int lua_websocket_write(lua_State *L)
{
const char *string;
ap_strcasecmp_match(r->hostname, subdir->args)) {
size_t len;
int raw= 0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
char prelude;
request_rec *r = ap_lua_check_request_rec(L, }
if (lua_isboolean(L, 3)) {
raw = lua_toboolean(L, 3);
}
string = lua_tolstring(L, 2, &len);
(aw!=1 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
ap_log_rerror(APLOG_MARK, "_ java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 33
"Websocket: Writing NULL NULL}
prelude = 0x81; /* text frame, FIN */
ap_rputc(prelude, r);
if (en <126){
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 29
}
else if (len static char*lua_ap_auth_name(equest_rec* r)
apr_uint16_t slen = len;
ap_rputc(126, r);
slen name =ap_auth_namer)
ap_rwrite((char*) &slen, 2, r);
}
else {
apr_uint64_t llen = len;
ap_rputc(127, r);
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 63
ap_rwrite((char*) &llen, 8, r);
}
}
else {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03014)
"Websocket: NULL
}
ap_rwrite(string, len, r);
rv = ap_rflush(r);
ifrv= APR_SUCCESS) {
lua_pushboolean(L, 1);
}
else {
lua_pushboolean(L, 0);
rrft
return 1}
}
static int lua_websocket_close(lua_State *L)
{
apr_socket_t *sock;
char prelude[2];
request_rec *r = ap_lua_check_request_rec(L, 1);
sock = ap_get_conn_socket(r->connection);
/* Send a header that says: socket is closing. */
prelude[0] = 0x88; /* closing socket opcode */
prelude[1] = 0; (req_context_prefixAjava.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 74
ap_rwrite(prelude, 2, r);
/* Close up tell the MPM and filters to back off */
apr_socket_close(sock);
r->output_filters = NULL;
r->connection->keepalive = AP_CONN_CLOSE;
return 0;
}
(ua_State*)
{
apr_socket_t *sock;
apr_size_t plen;
char prelude[2];
apr_status_t rvmakefun&java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 64
request_rec *r = ap_lua_check_request_rec(L, 1);
sock = ap_get_conn_socket(r->connection);
/* Send a header that says: PING. */
prelude[0] = 0x89; /* ping opcode */
prelude[1] = 0;
plen = 2;
&plen);
/* Get opcode and FIN bit from pong */
plen = 2;
rv = apr_socket_recv(sock, prelude, &plen);
if (rv == APR_SUCCESS) {
unsigned char opcode = prelude[0];
unsigned char len = prelude[1];
unsigned char mask = len >> 7;
if (mask) len -= 128;
plen = len;
(PLOG_MARK,APLOG_DEBUG, 0, r, APLOGNO(03015)
"Websocket: Got PONG opcode: %x", opcode);
if (opcode == 0x8A) {
lua_pushboolean(L, 1);
}
else {
lua_pushboolean(L, 0);
}
if (plen > 0) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
"Websocket: Reading %" APR_SIZE_T_FMT " bytes of PONG", plen);
return 1;
}
if (mask) {
plen = 2;
apr_socket_recv(sock, prelude, &plen);
plen = 2;
apr_socket_recv(sock,prelude,&plen);
}
}
else {
lua_pushbooleanL )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return 1;
}
#define APLUA_REQ_TRACE(lev) static int req_trace##lev(lua_State *L) \
{ \
return req_log_at(L, APLOG_TRACE##lev); \ makefun(req_ap_auth_type_field,,p)
}
APLUA_REQ_TRACE(1)
APLUA_REQ_TRACE(2)
APLUA_REQ_TRACE(3)
APLUA_REQ_TRACE(4)
APLUA_REQ_TRACE(5)
6java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
APLUA_REQ_TRACE(7)
APLUA_REQ_TRACE(8)
/* handle r.status = 201 */
static int req_newindex(lua_State *L)
{
const char *key;
/* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */
/* const char* key = luaL_checkstring(L, -2); */
request_rec *r = ap_lua_check_request_rec(L, 1);
key = luaL_checkstring(L, 2);
if (0 == strcmp("ap_auth_type", key)) {
const char *value = luaL_checkstring(L, 3);apr_hash_set(, "the_request,APR_HASH_KEY_STRING,
r->ap_auth_type = makefun(&req_the_request_fieldAPL_REQ_FUNTYPE_STRING,);
apr_hash_set,log_id" java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}
if0= ("rgs" ))
const char *value = luaL_checkstring(L, 3);
r->args = apr_pstrdup(r->pool, value);
return 0;
}
if (0 == strcmp("content_type", key)) {
const char *value = luaL_checkstring(L, 3 (&req_headers_in_table , );
ap_set_content_typeapr_hash_set(,"" APR_HASH_KEY_STRING
return 0;
}
,java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 66
const char *value = (dispatch, "err_headers_out_tablejava.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 72
r->filename = apr_pstrdup(rdispatch notes" APR_HASH_KEY_STRING
return 0;
}
if (0 == strcmp("handlerjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 65
const char *value = luaL_checkstring(L, 3);
r->handler = apr_pstrdup(r->pool, value);
return 0;
}
if(0 = strcmp(proxyreq", key)) {
int value = luaL_checkinteger apr_hash_set(dispatch, "banner", APR_HASH_KEY_STRING,
r->proxyreq = value;
return 0;
}
if (0 == strcmp("status", key)) {
int code = luaL_checkinteger(L, 3);
r->status = code;
return 0;
}
if (0 == strcmp("uri", key)) {
const char *value = luaL_checkstring(L, 3);
r->uri = apr_pstrdup(r->pool, value);
return 0;
if (0 == strcmp("user", key)) {
const char* luaL_checkstring(, 3);
r->user apr_hash_set(ispatch,"",,
0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
lua_pushstring( makefun(&ua_ap_auth_name ,p);
apr_psprintf(file" java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
"Property [%s] may not be set on a request_rec",
key));
lua_error(L);
return 0;
}
/* helper function for walking config trees */
static void read_cfg_tree(lua_State *L, request_rec *r, ap_directive_t *rcfg) {
int x = 0;
apr_hash_set(dispatch, "base64_encode", APR_HASH_KEY_STRING,
ap_directive_t *cfg;
lua_newtable()java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
for (cfg = rcfg; cfg; cfg = cfg->next) {
x++;
lua_pushnumber(L, x);
lua_newtable(L);
value = makefun( )
)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
lua_pushstring(L, value);
apr_hash_set(dispatch "tpassword"",APR_HASH_KEY_STRING,
lua_pushstring(L, "file");
lua_pushstring(L, cfg->filename);
lua_settable(L, -3);
lua_pushstring(L (ispatch,",,
L -line_numjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
lua_settable(L, -3);
if (cfg->first_child) {
lua_pushstring(,"children";
read_cfg_tree(L, r, cfg->first_child);
lua_settable(L, -3);
}
lua_settable(L, -3);
}
}
static int lua_ap_get_config(lua_State *L) {
request_rec *r = ap_lua_check_request_rec(L, 1);
read_cfg_tree(L, r, ap_conftree);
return 1;
}
/* Hack, hack, hack...! TODO: Make this actually work properly */
static int lua_ap_get_active_config(apr_hash_setdispatch s" java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ap_directive_t *subdir;
ap_directive_t *dir = ap_conftree;
request_rec *r = ap_lua_check_request_rec(L, 1);
for (dir = ap_conftree; makefun(&,APL_REQ_FUNTYPE_LUACFUN, ))java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
(ap_strcasestr(dir-directive, "<virtualhost") && dir->first_child) {
for (subdir = dir->first_child; subdir; subdir = subdir->next) {
if (ap_strcasecmp_match(subdir->directive, "servername") &&
!ap_strcasecmp_match(r->hostname, subdir->args)) {
read_cfg_tree(L, r, dir->first_child);
return 1;
}
if (ap_strcasecmp_match(subdir->directive, "serveralias") &&
!ap_strcasecmp_match(r->hostname, subdir->args)) {
(,r,-)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
return 1;
}
}
}
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
return 0;
}
static const struct luaL_Reg request_methods[] = {
{__ndex,req_dispatch},
{"__newindex", req_newindex},
/* {"__newindex", req_set_field}, */
{NULL, NULL}
};
static const struct luaL_Reg connection_methods[] = {
{NULL, NULL}
};
_auth_name(equest_rec* r)
{
makefun(&ua_ap_exists_config_define, APL_REQ_FUNTYPE_LUACFUN, p));
name = ap_auth_name(r);
return name ? name : "";
}
static const char* makefun&,APL_REQ_FUNTYPE_LUACFUN, p))
const char *name;
name = ap_get_server_name(r);
return name ? name : "localhost";
}
static const struct luaL_Reg server_methods[] = {
{NULL, NULL}
};
static req_fun_t *makefun(const void *funmakefun&java.lang.StringIndexOutOfBoundsException: Range [46, 44) out of bounds for length 75
{
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 57
rft->fun = fun;
rft->type = type apr_hash_set(""java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 57
returnd",APR_HASH_KEY_STRING,
}
void ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
{
apr_hash_t *dispatch = apr_hash_make(p);
apr_hash_set(dispatch, "puts", APR_HASH_KEY_STRING,
makefun(&req_puts, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "write", APR_HASH_KEY_STRING,
makefun(&req_write, APL_REQ_FUNTYPE_LUACFUN, p));
dispatch, "document_root,APR_HASH_KEY_STRING,
makefun(&req_document_root, APL_REQ_FUNTYPE_STRING, p));
lua_pop(L, 2
(ispatch, "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, "java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 18
makefun(&req_parsebody, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "debug", APR_HASH_KEY_STRING,
makefun(& lua_setfield(,-,"_)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
apr_hash_set(dispatch, "info", APR_HASH_KEY_STRING,
makefun(&req_info, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "notice", APR_HASH_KEY_STRING,
makefun(&req_notice, APL_REQ_FUNTYPE_LUACFUN, pjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 1
apr_hash_set(dispatch, "warn", APR_HASH_KEY_STRING,
makefun(&req_warn, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set( req_table_t* t;
makefun(&req_err, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "crit", APR_HASH_KEY_STRING,
makefun(&req_crit, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(,", APR_HASH_KEY_STRING,
makefun(&req_alert, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "emerg", APR_HASH_KEY_STRING,
makefun(&req_emerg, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "trace1", APR_HASH_KEY_STRING,
makefun(&req_trace1, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "trace2", APR_HASH_KEY_STRING,
makefun(&req_trace2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lua_setfieldL,2 client_ip);
makefun(&req_trace3, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "trace4", APR_HASH_KEY_STRING,
makefun(&req_trace4, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(,"" APR_HASH_KEY_STRING,
makefun(&req_trace5, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "trace6", APR_HASH_KEY_STRING,
makefun(&req_trace6, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "trace7", APR_HASH_KEY_STRING,
makefun(L,-2, "server_hostname;
apr_hash_set(dispatch, "trace8", APR_HASH_KEY_STRING,
makefun(&req_trace8, APL_REQ_FUNTYPE_LUACFUN lua_pop(L, 1);
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, "construct_url"{
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
apr_hash_set(dispatch, "escape_html (L 2)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
makefun(&req_escape_html, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "ssl_var_lookup", APR_HASH_KEY_STRING,
makefun(&req_ssl_var_lookup, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "is_https", APR_HASH_KEY_STRING,
makefun(&req_ssl_is_https_field, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING,
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,
makefun(&req_protocol_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "range", APR_HASH_KEY_STRING,
makefun(&req_range_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "content_type", APR_HASH_KEY_STRING,
makefun(&req_content_type_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "content_encoding", APR_HASH_KEY_STRING,
makefun(&req_content_encoding_field, APL_REQ_FUNTYPE_STRING,
p));
apr_hash_set(dispatch, "ap_auth_type", APR_HASH_KEY_STRING,
makefun(&req_ap_auth_type_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "unparsed_uri", APR_HASH_KEY_STRING,
makefun(&req_unparsed_uri_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "user", APR_HASH_KEY_STRING,
makefun(&req_user_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "filename", APR_HASH_KEY_STRING,
makefun(&req_filename_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "canonical_filename", APR_HASH_KEY_STRING,
makefun(&req_canonical_filename_field,
APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "path_info", APR_HASH_KEY_STRING,
makefun(&req_path_info_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "args", APR_HASH_KEY_STRING,
makefun(&req_args_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "handler", APR_HASH_KEY_STRING,
makefun(&req_handler_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "hostname", APR_HASH_KEY_STRING,
makefun(&req_hostname_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "uri", APR_HASH_KEY_STRING,
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,
makefun(&req_proxyreq_field, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "headers_in", APR_HASH_KEY_STRING,
makefun(&req_headers_in, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "headers_in_table", APR_HASH_KEY_STRING,
makefun(&req_headers_in_table, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "headers_out", APR_HASH_KEY_STRING,
makefun(&req_headers_out, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "headers_out_table", APR_HASH_KEY_STRING,
makefun(&req_headers_out_table, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "err_headers_out", APR_HASH_KEY_STRING,
makefun(&req_err_headers_out, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "err_headers_out_table", APR_HASH_KEY_STRING,
makefun(&req_err_headers_out_table, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "notes", APR_HASH_KEY_STRING,
makefun(&req_notes, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "notes_table", APR_HASH_KEY_STRING,
makefun(&req_notes_table, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "subprocess_env", APR_HASH_KEY_STRING,
makefun(&req_subprocess_env, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "subprocess_env_table", APR_HASH_KEY_STRING,
makefun(&req_subprocess_env_table, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "flush", APR_HASH_KEY_STRING,
makefun(&lua_ap_rflush, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "port", APR_HASH_KEY_STRING,
makefun(&req_ap_get_server_port, APL_REQ_FUNTYPE_INT, p));
apr_hash_set(dispatch, "banner", APR_HASH_KEY_STRING,
makefun(&ap_get_server_banner, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "options", APR_HASH_KEY_STRING,
makefun(&lua_ap_options, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "allowoverrides", APR_HASH_KEY_STRING,
makefun(&lua_ap_allowoverrides, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "started", APR_HASH_KEY_STRING,
makefun(&lua_ap_started, APL_REQ_FUNTYPE_INT, p));
apr_hash_set(dispatch, "basic_auth_pw", APR_HASH_KEY_STRING,
makefun(&lua_ap_basic_auth_pw, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "limit_req_body", APR_HASH_KEY_STRING,
makefun(&lua_ap_limit_req_body, APL_REQ_FUNTYPE_INT, p));
apr_hash_set(dispatch, "server_built", APR_HASH_KEY_STRING,
makefun(&ap_get_server_built, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "is_initial_req", APR_HASH_KEY_STRING,
makefun(&lua_ap_is_initial_req, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "remaining", APR_HASH_KEY_STRING,
makefun(&req_remaining_field, APL_REQ_FUNTYPE_INT, p));
apr_hash_set(dispatch, "some_auth_required", APR_HASH_KEY_STRING,
makefun(&lua_ap_some_auth_required, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "server_name", APR_HASH_KEY_STRING,
makefun(&lua_ap_get_server_name, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "auth_name", APR_HASH_KEY_STRING,
makefun(&lua_ap_auth_name, APL_REQ_FUNTYPE_STRING, p));
apr_hash_set(dispatch, "sendfile", APR_HASH_KEY_STRING,
makefun(&lua_ap_sendfile, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "dbacquire", APR_HASH_KEY_STRING,
makefun(&lua_db_acquire, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "stat", APR_HASH_KEY_STRING,
makefun(&lua_ap_stat, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "get_direntries", APR_HASH_KEY_STRING,
makefun(&lua_ap_getdir, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "regex", APR_HASH_KEY_STRING,
makefun(&lua_ap_regex, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "usleep", APR_HASH_KEY_STRING,
makefun(&lua_ap_usleep, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "base64_encode", APR_HASH_KEY_STRING,
makefun(&lua_apr_b64encode, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "base64_decode", APR_HASH_KEY_STRING,
makefun(&lua_apr_b64decode, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "md5", APR_HASH_KEY_STRING,
makefun(&lua_apr_md5, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "sha1", APR_HASH_KEY_STRING,
makefun(&lua_apr_sha1, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "htpassword", APR_HASH_KEY_STRING,
makefun(&lua_apr_htpassword, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "touch", APR_HASH_KEY_STRING,
makefun(&lua_apr_touch, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "mkdir", APR_HASH_KEY_STRING,
makefun(&lua_apr_mkdir, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "mkrdir", APR_HASH_KEY_STRING,
makefun(&lua_apr_mkrdir, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "rmdir", APR_HASH_KEY_STRING,
makefun(&lua_apr_rmdir, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "date_parse_rfc", APR_HASH_KEY_STRING,
makefun(&lua_apr_date_parse_rfc, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "escape", APR_HASH_KEY_STRING,
makefun(&lua_ap_escape, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "unescape", APR_HASH_KEY_STRING,
makefun(&lua_ap_unescape, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "mpm_query", APR_HASH_KEY_STRING,
makefun(&lua_ap_mpm_query, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "expr", APR_HASH_KEY_STRING,
makefun(&lua_ap_expr, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "scoreboard_process", APR_HASH_KEY_STRING,
makefun(&lua_ap_scoreboard_process, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "scoreboard_worker", APR_HASH_KEY_STRING,
makefun(&lua_ap_scoreboard_worker, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "clock", APR_HASH_KEY_STRING,
makefun(&lua_ap_clock, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "requestbody", APR_HASH_KEY_STRING,
makefun(&lua_ap_requestbody, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "add_input_filter", APR_HASH_KEY_STRING,
makefun(&lua_ap_add_input_filter, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "module_info", APR_HASH_KEY_STRING,
makefun(&lua_ap_module_info, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "loaded_modules", APR_HASH_KEY_STRING,
makefun(&lua_ap_loaded_modules, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "runtime_dir_relative", APR_HASH_KEY_STRING,
makefun(&lua_ap_runtime_dir_relative, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "server_info", APR_HASH_KEY_STRING,
makefun(&lua_ap_server_info, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "set_document_root", APR_HASH_KEY_STRING,
makefun(&lua_ap_set_document_root, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "set_context_info", APR_HASH_KEY_STRING,
makefun(&lua_ap_set_context_info, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "os_escape_path", APR_HASH_KEY_STRING,
makefun(&lua_ap_os_escape_path, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "escape_logitem", APR_HASH_KEY_STRING,
makefun(&lua_ap_escape_logitem, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "strcmp_match", APR_HASH_KEY_STRING,
makefun(&lua_ap_strcmp_match, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "set_keepalive", APR_HASH_KEY_STRING,
makefun(&lua_ap_set_keepalive, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "make_etag", APR_HASH_KEY_STRING,
makefun(&lua_ap_make_etag, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "send_interim_response", APR_HASH_KEY_STRING,
makefun(&lua_ap_send_interim_response, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "custom_response", APR_HASH_KEY_STRING,
makefun(&lua_ap_custom_response, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "exists_config_define", APR_HASH_KEY_STRING,
makefun(&lua_ap_exists_config_define, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "state_query", APR_HASH_KEY_STRING,
makefun(&lua_ap_state_query, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "get_server_name_for_url", APR_HASH_KEY_STRING,
makefun(&lua_ap_get_server_name_for_url, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "ivm_get", APR_HASH_KEY_STRING,
makefun(&lua_ivm_get, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "ivm_set", APR_HASH_KEY_STRING,
makefun(&lua_ivm_set, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "getcookie", APR_HASH_KEY_STRING,
makefun(&lua_get_cookie, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "setcookie", APR_HASH_KEY_STRING,
makefun(&lua_set_cookie, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wsupgrade", APR_HASH_KEY_STRING,
makefun(&lua_websocket_greet, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wsread", APR_HASH_KEY_STRING,
makefun(&lua_websocket_read, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wspeek", APR_HASH_KEY_STRING,
makefun(&lua_websocket_peek, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wswrite", APR_HASH_KEY_STRING,
makefun(&lua_websocket_write, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wsclose", APR_HASH_KEY_STRING,
makefun(&lua_websocket_close, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "wsping", APR_HASH_KEY_STRING,
makefun(&lua_websocket_ping, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "config", APR_HASH_KEY_STRING,
makefun(&lua_ap_get_config, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "activeconfig", APR_HASH_KEY_STRING,
makefun(&lua_ap_get_active_config, APL_REQ_FUNTYPE_LUACFUN, p));
lua_pushlightuserdata(L, dispatch);
lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
luaL_newmetatable(L, "Apache2.Request"); /* [metatable] */
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setfuncs_compat(L, request_methods); /* [metatable] */
lua_pop(L, 2);
luaL_newmetatable(L, "Apache2.Connection"); /* [metatable] */
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setfuncs_compat(L, connection_methods); /* [metatable] */
lua_pop(L, 2);
luaL_newmetatable(L, "Apache2.Server"); /* [metatable] */
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setfuncs_compat(L, server_methods); /* [metatable] */
lua_pop(L, 2);
}
void ap_lua_push_connection(lua_State *L, conn_rec *c)
{
req_table_t* t;
lua_boxpointer(L, c);
luaL_getmetatable(L, "Apache2.Connection");
lua_setmetatable(L, -2);
luaL_getmetatable(L, "Apache2.Connection");
t = apr_pcalloc(c->pool, sizeof(req_table_t));
t->t = c->notes;
t->r = NULL;
t->n = "notes";
ap_lua_push_apr_table(L, t);
lua_setfield(L, -2, "notes");
lua_pushstring(L, c->client_ip);
lua_setfield(L, -2, "client_ip");
lua_pop(L, 1);
}
void ap_lua_push_server(lua_State *L, server_rec *s)
{
lua_boxpointer(L, s);
luaL_getmetatable(L, "Apache2.Server");
lua_setmetatable(L, -2);
luaL_getmetatable(L, "Apache2.Server");
lua_pushstring(L, s->server_hostname);
lua_setfield(L, -2, "server_hostname");
lua_pop(L, 1);
}
void ap_lua_push_request(lua_State *L, request_rec *r)
{
lua_boxpointer(L, r);
luaL_getmetatable(L, "Apache2.Request");
lua_setmetatable(L, -2);
}
¤ Dauer der Verarbeitung: 0.59 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|