mod_lua.c revision 9704354e1cdddd5d367daef753ab621926095480
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi * Licensed to the Apache Software Foundation (ASF) under one or more
c79e39ad568d9af854765f64049534044ef6c034nd * contributor license agreements. See the NOTICE file distributed with
d3e250aab242db84d14060985b5db675a731d548nd * this work for additional information regarding copyright ownership.
c79e39ad568d9af854765f64049534044ef6c034nd * The ASF licenses this file to You under the Apache License, Version 2.0
c79e39ad568d9af854765f64049534044ef6c034nd * (the "License"); you may not use this file except in compliance with
c79e39ad568d9af854765f64049534044ef6c034nd * the License. You may obtain a copy of the License at
4a56677aad9b66a36f3dc9fddbca8dc1230ad471rbowen * Unless required by applicable law or agreed to in writing, software
4a56677aad9b66a36f3dc9fddbca8dc1230ad471rbowen * distributed under the License is distributed on an "AS IS" BASIS,
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c79e39ad568d9af854765f64049534044ef6c034nd * See the License for the specific language governing permissions and
c79e39ad568d9af854765f64049534044ef6c034nd * limitations under the License.
#include "mod_lua.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "lua_apr.h"
#include "lua_config.h"
const char *lua_response;
ap_lua_init(L, p);
ap_lua_load_request_lmodule(L, p);
return OK;
return DECLINED;
r->filename);
if (!r->header_only) {
lua_State *L;
&lua_module);
&lua_module);
d->function_name);
d->spec);
return HTTP_INTERNAL_SERVER_ERROR;
d->function_name,
return HTTP_INTERNAL_SERVER_ERROR;
ap_lua_run_lua_request(L, r);
report_lua_error(L, r);
return OK;
&lua_module);
&lua_module);
matches, 0)) {
return OK;
return DECLINED;
int rc;
lua_State *L;
&lua_module);
&lua_module);
if (hook_specs) {
return HTTP_INTERNAL_SERVER_ERROR;
return HTTP_INTERNAL_SERVER_ERROR;
ap_lua_run_lua_request(L, r);
ap_lua_run_lua_request(L, r);
t = lua_gettop(L);
lua_settop(L, t);
report_lua_error(L, r);
return HTTP_INTERNAL_SERVER_ERROR;
return rc;
return DECLINED;
apr_size_t i = 0;
while (i < bufsiz) {
char ch;
typedef struct cr_ctx
const char *endstr;
} cr_ctx;
static const char *lf =
return lf;
apr_size_t i = 0;
*plen = 0;
return NULL;
typedef struct hack_section_baton
const char *name;
const char *arg)
if (!hook_specs) {
sizeof(ap_lua_mapped_handler_spec *));
return NULL;
void *mconfig,
const char *line)
const char *function;
const char *word;
char *tmp;
int rv;
if (function) {
/* This lua State is used only to compile the input strings -> bytecode, so we don't need anything extra. */
if (rv != 0) {
return errstr;
luaL_Buffer b;
luaL_pushresult(&b);
if (!*current) {
return NULL;
void *_cfg,
const char *file,
const char *function)
if (!hook_specs) {
sizeof(ap_lua_mapped_handler_spec *));
return NULL;
if (lookup) {
return DECLINED;
const char *file,
const char *function)
const char *line)
line);
const char *file,
const char *function)
function);
const char *line)
const char *file,
const char *function)
const char *line)
line);
const char *file,
const char *function)
function);
const char *line)
line);
const char *file,
const char *function)
function);
const char *line)
line);
const char *file,
const char *function)
const char *line)
line);
const char *file,
const char *function)
function);
const char *line)
line);
const char *file,
const char *function)
function);
const char *line)
char *fixed_filename;
return NULL;
const char *arg)
const char *arg)
const char *arg)
arg);
return NULL;
const char *max)
if (min)
if (max)
scope);
return NULL;
const char *function)
const char *function_name;
return NULL;
const char *root)
&lua_module);
return NULL;
"Add a directory to lua's package.cpath"),
NULL,
NULL,
NULL,
NULL,
{NULL}
return cfg;
return OK;
return cfg;
ap_lua_push_request(L, r);
return OK;
/* http_request.h hooks */