Compare commits
8 Commits
10303a70b1
...
11df378496
Author | SHA1 | Date | |
---|---|---|---|
11df378496 | |||
a9e4f098e2 | |||
9a1458a3b8 | |||
8d9c9599e9 | |||
e51f801c00 | |||
7076993529 | |||
ccae9e7fb5 | |||
a0c6eb0bc7 |
@ -235,7 +235,7 @@
|
||||
|
||||
Methods:
|
||||
|
||||
* `print(...)`: print parameters via lua `tostring` method as ERROR in Virtual Request context
|
||||
* `error(...)` and `print(...)`: print parameters via lua `tostring` method as ERROR in Virtual Request context
|
||||
* `warning(...)`: print parameters via lua `tostring` method as WARNING in Virtual Request context
|
||||
* `info(...)`: print parameters via lua `tostring` method as INFO in Virtual Request context
|
||||
* `debug(...)`: print parameters via lua `tostring` method as DEBUG in Virtual Request context
|
||||
|
@ -149,7 +149,7 @@ LI_API void li_lua_environment_use_globals(liLuaState *LL); /* +1 */
|
||||
LI_API void li_lua_environment_restore_globals(lua_State *L); /* -1 */
|
||||
|
||||
/* joinWith " " (map tostring parameter[from..to]) */
|
||||
LI_API GString* li_lua_print_get_string(lua_State *L, int from, int to);
|
||||
LI_API GString* li_lua_print_get_string(lua_State *L, liServer *srv, liVRequest *vr, int from, int to);
|
||||
|
||||
/* pairs() for a GHashTable GString -> GString:
|
||||
* Don't modify the hashtable while iterating:
|
||||
|
@ -54,14 +54,14 @@
|
||||
#define VR_GERROR(vr, error, fmt, ...) _GERROR(vr->wrk->srv, vr->wrk, &vr->log_context, error, fmt, __VA_ARGS__)
|
||||
|
||||
/* vr may be NULL; if vr is NULL, srv must NOT be NULL */
|
||||
#define _VR_SEGFAULT(srv, vr, fmt, ...) _SEGFAULT(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_ERROR(srv, vr, fmt, ...) _ERROR(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_WARNING(srv, vr, fmt, ...) _WARNING(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_INFO(srv, vr, fmt, ...) _INFO(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_DEBUG(srv, vr, fmt, ...) _DEBUG(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_BACKEND(srv, vr, fmt, ...) _BACKEND(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, fmt, __VA_ARGS__)
|
||||
#define _VR_BACKEND_LINES(srv, vr, txt, fmt, ...) _BACKEND_LINES(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, txt, fmt, __VA_ARGS__)
|
||||
#define _VR_GERROR(srv, vr, error, fmt, ...) _GERROR(srv, NULL != vr ? vr->wrk : NULL, &vr->log_context, error, fmt, __VA_ARGS__)
|
||||
#define _VR_SEGFAULT(srv, vr, fmt, ...) _SEGFAULT(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_ERROR(srv, vr, fmt, ...) _ERROR(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_WARNING(srv, vr, fmt, ...) _WARNING(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_INFO(srv, vr, fmt, ...) _INFO(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_DEBUG(srv, vr, fmt, ...) _DEBUG(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_BACKEND(srv, vr, fmt, ...) _BACKEND(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, fmt, __VA_ARGS__)
|
||||
#define _VR_BACKEND_LINES(srv, vr, txt, fmt, ...) _BACKEND_LINES(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, txt, fmt, __VA_ARGS__)
|
||||
#define _VR_GERROR(srv, vr, error, fmt, ...) _GERROR(srv, NULL != vr ? vr->wrk : NULL, NULL != vr ? &vr->log_context : NULL, error, fmt, __VA_ARGS__)
|
||||
|
||||
#define SEGFAULT(srv, fmt, ...) _SEGFAULT(srv, NULL, NULL, fmt, __VA_ARGS__)
|
||||
#define ERROR(srv, fmt, ...) _ERROR(srv, NULL, NULL, fmt, __VA_ARGS__)
|
||||
|
45
meson.build
45
meson.build
@ -14,6 +14,9 @@ libexec_dir = get_option('prefix') / get_option('libexecdir')
|
||||
modules_dir = get_option('prefix') / get_option('libdir') / (meson.project_name() + '-' + meson.project_version())
|
||||
lua_dir = get_option('prefix') / get_option('datadir') / 'lighttpd2/lua'
|
||||
|
||||
search_includes = include_directories(get_option('search-inc'))
|
||||
search_libs = get_option('search-lib')
|
||||
|
||||
compiler = meson.get_compiler('c')
|
||||
dep_not_found = dependency('', required: false)
|
||||
|
||||
@ -61,14 +64,18 @@ dep_gthread = dependency('gthread-2.0', version: '>=2.16')
|
||||
dep_gmodule = dependency('gmodule-2.0', version: '>=2.16')
|
||||
|
||||
# find libev manually
|
||||
debug('libs:', search_libs)
|
||||
dep_ev = compiler.find_library(
|
||||
'ev',
|
||||
has_headers: 'ev.h',
|
||||
dirs: search_libs,
|
||||
header_include_directories: search_includes,
|
||||
)
|
||||
if not compiler.has_function(
|
||||
'ev_time',
|
||||
prefix: '#include <ev.h>',
|
||||
dependencies: dep_ev,
|
||||
include_directories: search_includes,
|
||||
)
|
||||
error('Missing ev_time() in libev')
|
||||
endif
|
||||
@ -111,16 +118,22 @@ else
|
||||
endif
|
||||
|
||||
if get_option('bzip2')
|
||||
opt_dep_bzip2 = compiler.find_library(
|
||||
'bz2',
|
||||
has_headers: 'bzlib.h',
|
||||
)
|
||||
if not compiler.has_function(
|
||||
'BZ2_bzCompressInit',
|
||||
prefix: '#include <bzlib.h>',
|
||||
dependencies: opt_dep_bzip2,
|
||||
)
|
||||
error('Found libbz2, but missing BZ2_bzCompressInit()')
|
||||
opt_dep_bzip2 = dependency('bzip2', required: false)
|
||||
if not opt_dep_bzip2.found()
|
||||
opt_dep_bzip2 = compiler.find_library(
|
||||
'bz2',
|
||||
has_headers: 'bzlib.h',
|
||||
dirs: search_libs,
|
||||
header_include_directories: search_includes,
|
||||
)
|
||||
if not compiler.has_function(
|
||||
'BZ2_bzCompressInit',
|
||||
prefix: '#include <bzlib.h>',
|
||||
dependencies: opt_dep_bzip2,
|
||||
include_directories: search_includes,
|
||||
)
|
||||
error('Found libbz2, but missing BZ2_bzCompressInit()')
|
||||
endif
|
||||
endif
|
||||
conf_data.set10('HAVE_BZIP', true)
|
||||
else
|
||||
@ -223,12 +236,15 @@ lib_crypt = compiler.find_library(
|
||||
'crypt',
|
||||
required: false,
|
||||
has_headers: 'crypt.h',
|
||||
dirs: search_libs,
|
||||
header_include_directories: search_includes,
|
||||
)
|
||||
if lib_crypt.found()
|
||||
if compiler.has_function(
|
||||
'crypt_r',
|
||||
prefix: '#include <crypt.h>',
|
||||
dependencies: lib_crypt,
|
||||
include_directories: search_includes,
|
||||
)
|
||||
conf_data.set10('HAVE_CRYPT_H', true)
|
||||
conf_data.set10('HAVE_CRYPT_R', true)
|
||||
@ -240,7 +256,11 @@ else
|
||||
endif
|
||||
|
||||
# need libm for fmod in throttle.c
|
||||
lib_m = compiler.find_library('m')
|
||||
lib_m = compiler.find_library(
|
||||
'm',
|
||||
dirs: search_libs,
|
||||
header_include_directories: search_includes,
|
||||
)
|
||||
|
||||
# IPv6 support is mandatory by default
|
||||
if get_option('ipv6')
|
||||
@ -270,11 +290,14 @@ if target_machine.system() == 'freebsd'
|
||||
lib_kvm = compiler.find_library(
|
||||
'kvm',
|
||||
has_headers: 'kvm.h',
|
||||
dirs: search_libs,
|
||||
header_include_directories: search_includes,
|
||||
)
|
||||
if not compiler.has_function(
|
||||
'kvm_open',
|
||||
prefix: '#include <kvm.h>',
|
||||
dependencies: lib_kvm,
|
||||
include_directories: search_includes,
|
||||
)
|
||||
error('Found libkvm, but missing kvm_open')
|
||||
endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
option('lua', type : 'boolean', value : true, description : 'Build with lua (5.1); extends core and other modules, and builds mod_lua')
|
||||
option('lua', type : 'boolean', value : true, description : 'Build with lua; extends core and other modules, and builds mod_lua')
|
||||
option('ipv6', type : 'boolean', value : true, description : 'Build with IPv6 support')
|
||||
option('config-parser', type : 'boolean', value : true, description : 'Build with standard config parser')
|
||||
option('unwind', type : 'boolean', value : true, description : 'Build with (lib)unwind support in asserts to print backtraces')
|
||||
@ -10,3 +10,6 @@ option('deflate', type : 'boolean', value : true, description : 'Build mod_defla
|
||||
option('extra-warnings', type : 'boolean', value : true, description : 'Build with extra warnings enabled')
|
||||
# option('static', type : 'boolean', value : false, description : 'Build static lighttpd with all modules included')
|
||||
option('profiler', type : 'boolean', value : false, description : 'Build with memory profiler')
|
||||
|
||||
option('search-lib', type : 'array', value : [], description: 'Search libs in additional paths')
|
||||
option('search-inc', type : 'array', value : [], description: 'Search includes in additional paths')
|
||||
|
@ -12,7 +12,7 @@ src_angel_shared = [
|
||||
lib_shared_angel = library(
|
||||
'lighttpd2-sharedangel-' + meson.project_version(),
|
||||
src_angel_shared,
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: [
|
||||
main_deps,
|
||||
],
|
||||
@ -23,7 +23,7 @@ lib_shared_angel = library(
|
||||
bin_angel = executable(
|
||||
'lighttpd2',
|
||||
'angel_main.c',
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: [
|
||||
main_deps,
|
||||
],
|
||||
|
@ -27,7 +27,7 @@ endif
|
||||
lib_common = library(
|
||||
'lighttpd2-common-' + meson.project_version(),
|
||||
src_common,
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: [
|
||||
main_deps,
|
||||
opt_dep_unwind,
|
||||
|
@ -27,7 +27,7 @@ int li_lua_fixindex(lua_State *L, int ndx) {
|
||||
return ndx;
|
||||
}
|
||||
|
||||
static int traceback (lua_State *L) {
|
||||
static int traceback(lua_State *L) {
|
||||
if (!lua_isstring(L, 1)) /* 'message' not a string? */
|
||||
return 1; /* keep it intact */
|
||||
lua_getglobal(L, "debug");
|
||||
@ -190,7 +190,7 @@ void li_lua_environment_restore(liLuaState *LL) /* -1 (expects previous metatabl
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, LL->li_env_ref); /* +1 */
|
||||
lua_pushvalue(L, -2); /* +1 */
|
||||
lua_setmetatable(L, -2); /* -1 restore prev mt for LI_ENV */
|
||||
lua_pop(L, 1); /* -2 */
|
||||
lua_pop(L, 2); /* -2 */
|
||||
}
|
||||
|
||||
void li_lua_environment_use_globals(liLuaState *LL) /* +1 */ {
|
||||
@ -205,44 +205,70 @@ void li_lua_environment_restore_globals(lua_State *L) /* -1 */ {
|
||||
li_lua_set_globals(L); /* -1 */
|
||||
}
|
||||
|
||||
GString* li_lua_print_get_string(lua_State *L, int from, int to) {
|
||||
int i, n = lua_gettop(L);
|
||||
/* resulting object on top of the stack might eighter be the lua string (owning the returned memory) or an error */
|
||||
static const char *li_lua_tolstring(lua_State *L, liServer *srv, liVRequest *vr, int idx, size_t *len) { /* +1 */
|
||||
int errfunc;
|
||||
|
||||
switch (lua_type(L, idx)) {
|
||||
case LUA_TBOOLEAN:
|
||||
lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
|
||||
break;
|
||||
case LUA_TNIL:
|
||||
lua_pushlstring(L, CONST_STR_LEN("nil"));
|
||||
break;
|
||||
case LUA_TSTRING:
|
||||
case LUA_TNUMBER:
|
||||
lua_pushvalue(L, idx);
|
||||
break;
|
||||
default:
|
||||
idx = li_lua_fixindex(L, idx);
|
||||
lua_pushcfunction(L, traceback); /* +1 */
|
||||
errfunc = lua_gettop(L);
|
||||
lua_getglobal(L, "tostring"); /* +1 */
|
||||
lua_pushvalue(L, idx); /* +1 object to convert to string */
|
||||
|
||||
if (lua_pcall(L, 1, 1, errfunc)) { /* -2 (func + args), +1 result */
|
||||
_VR_ERROR(srv, vr, "li_lua_tolstring failed: %s", lua_tostring(L, -1));
|
||||
|
||||
if (len) *len = 0;
|
||||
return NULL;
|
||||
}
|
||||
lua_remove(L, errfunc); /* -1 */
|
||||
}
|
||||
|
||||
return lua_tolstring(L, -1, len);
|
||||
}
|
||||
|
||||
GString* li_lua_print_get_string(lua_State *L, liServer *srv, liVRequest *vr, int from, int to) {
|
||||
int i;
|
||||
GString *buf = g_string_sized_new(0);
|
||||
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i = from; i <= to; i++) {
|
||||
const char *s;
|
||||
size_t len;
|
||||
|
||||
lua_pushvalue(L, n+1);
|
||||
lua_pushvalue(L, i);
|
||||
if (0 != lua_pcall(L, 1, 1, 0)) goto failed;
|
||||
s = lua_tolstring(L, -1, &len);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (NULL == s) goto failed;
|
||||
if (0 == len) continue;
|
||||
if (buf->len > 0) {
|
||||
g_string_append_c(buf, ' ');
|
||||
li_g_string_append_len(buf, s, len);
|
||||
} else {
|
||||
li_g_string_append_len(buf, s, len);
|
||||
if (NULL == (s = li_lua_tolstring(L, srv, vr, i, &len))) { /* +1 */
|
||||
s = "<failed tostring>";
|
||||
len = 17;
|
||||
}
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
return buf;
|
||||
|
||||
failed:
|
||||
g_string_free(buf, TRUE);
|
||||
lua_pushliteral(L, "lua_print_get_string: Couldn't convert parameter to string");
|
||||
lua_error(L);
|
||||
return NULL; /* should be unreachable */
|
||||
if (len > 0) {
|
||||
if (buf->len > 0) {
|
||||
g_string_append_c(buf, ' ');
|
||||
li_g_string_append_len(buf, s, len);
|
||||
} else {
|
||||
li_g_string_append_len(buf, s, len);
|
||||
}
|
||||
}
|
||||
lua_pop(L, 1); /* -1 */
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int li_lua_error(lua_State *L) {
|
||||
liServer *srv = lua_touserdata(L, lua_upvalueindex(1));
|
||||
liWorker *wrk = lua_touserdata(L, lua_upvalueindex(2));
|
||||
GString *buf = li_lua_print_get_string(L, 1, lua_gettop(L));
|
||||
GString *buf = li_lua_print_get_string(L, srv, NULL, 1, lua_gettop(L));
|
||||
|
||||
_ERROR(srv, wrk, NULL, "(lua): %s", buf->str);
|
||||
|
||||
@ -254,7 +280,7 @@ static int li_lua_error(lua_State *L) {
|
||||
static int li_lua_warning(lua_State *L) {
|
||||
liServer *srv = lua_touserdata(L, lua_upvalueindex(1));
|
||||
liWorker *wrk = lua_touserdata(L, lua_upvalueindex(2));
|
||||
GString *buf = li_lua_print_get_string(L, 1, lua_gettop(L));
|
||||
GString *buf = li_lua_print_get_string(L, srv, NULL, 1, lua_gettop(L));
|
||||
|
||||
_WARNING(srv, wrk, NULL, "(lua): %s", buf->str);
|
||||
|
||||
@ -266,7 +292,7 @@ static int li_lua_warning(lua_State *L) {
|
||||
static int li_lua_info(lua_State *L) {
|
||||
liServer *srv = lua_touserdata(L, lua_upvalueindex(1));
|
||||
liWorker *wrk = lua_touserdata(L, lua_upvalueindex(2));
|
||||
GString *buf = li_lua_print_get_string(L, 1, lua_gettop(L));
|
||||
GString *buf = li_lua_print_get_string(L, srv, NULL, 1, lua_gettop(L));
|
||||
|
||||
_INFO(srv, wrk, NULL, "(lua): %s", buf->str);
|
||||
|
||||
@ -278,7 +304,7 @@ static int li_lua_info(lua_State *L) {
|
||||
static int li_lua_debug(lua_State *L) {
|
||||
liServer *srv = lua_touserdata(L, lua_upvalueindex(1));
|
||||
liWorker *wrk = lua_touserdata(L, lua_upvalueindex(2));
|
||||
GString *buf = li_lua_print_get_string(L, 1, lua_gettop(L));
|
||||
GString *buf = li_lua_print_get_string(L, srv, NULL, 1, lua_gettop(L));
|
||||
|
||||
_DEBUG(srv, wrk, NULL, "(lua): %s", buf->str);
|
||||
|
||||
|
@ -73,7 +73,7 @@ endif
|
||||
lib_shared = library(
|
||||
'lighttpd2-shared-' + meson.project_version(),
|
||||
src_shared,
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: [
|
||||
main_deps,
|
||||
opt_dep_lua,
|
||||
@ -86,7 +86,7 @@ lib_shared = library(
|
||||
bin_worker = executable(
|
||||
'lighttpd2-worker',
|
||||
'lighttpd_worker.c',
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: [
|
||||
main_deps,
|
||||
opt_dep_lua,
|
||||
|
@ -152,7 +152,7 @@ static int lua_vrequest_error(lua_State *L) {
|
||||
GString *buf;
|
||||
vr = li_lua_get_vrequest(L, 1);
|
||||
|
||||
buf = li_lua_print_get_string(L, 2, lua_gettop(L));
|
||||
buf = li_lua_print_get_string(L, vr->wrk->srv, vr, 2, lua_gettop(L));
|
||||
|
||||
VR_ERROR(vr, "(lua): %s", buf->str);
|
||||
|
||||
@ -166,7 +166,7 @@ static int lua_vrequest_warning(lua_State *L) {
|
||||
GString *buf;
|
||||
vr = li_lua_get_vrequest(L, 1);
|
||||
|
||||
buf = li_lua_print_get_string(L, 2, lua_gettop(L));
|
||||
buf = li_lua_print_get_string(L, vr->wrk->srv, vr, 2, lua_gettop(L));
|
||||
|
||||
VR_WARNING(vr, "(lua): %s", buf->str);
|
||||
|
||||
@ -180,7 +180,7 @@ static int lua_vrequest_info(lua_State *L) {
|
||||
GString *buf;
|
||||
vr = li_lua_get_vrequest(L, 1);
|
||||
|
||||
buf = li_lua_print_get_string(L, 2, lua_gettop(L));
|
||||
buf = li_lua_print_get_string(L, vr->wrk->srv, vr, 2, lua_gettop(L));
|
||||
|
||||
VR_INFO(vr, "(lua): %s", buf->str);
|
||||
|
||||
@ -194,7 +194,7 @@ static int lua_vrequest_debug(lua_State *L) {
|
||||
GString *buf;
|
||||
vr = li_lua_get_vrequest(L, 1);
|
||||
|
||||
buf = li_lua_print_get_string(L, 2, lua_gettop(L));
|
||||
buf = li_lua_print_get_string(L, vr->wrk->srv, vr, 2, lua_gettop(L));
|
||||
|
||||
VR_DEBUG(vr, "(lua): %s", buf->str);
|
||||
|
||||
@ -319,6 +319,7 @@ static const luaL_Reg vrequest_mt[] = {
|
||||
{ "__newindex", lua_vrequest_newindex },
|
||||
|
||||
{ "print", lua_vrequest_error },
|
||||
{ "error", lua_vrequest_error },
|
||||
{ "warning", lua_vrequest_warning },
|
||||
{ "info", lua_vrequest_info },
|
||||
{ "debug", lua_vrequest_debug },
|
||||
|
@ -102,7 +102,7 @@ foreach name, def: modules
|
||||
def['sources'],
|
||||
dependencies: main_deps + mod_deps,
|
||||
c_args: def.get('c_args', []),
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
install: true,
|
||||
install_dir: modules_dir,
|
||||
)
|
||||
|
@ -627,7 +627,7 @@ static const liPluginSetup setups[] = {
|
||||
|
||||
typedef struct {
|
||||
liMemcachedRequest *req;
|
||||
int result_ref; /* table if vr_ref == NULL, callback function otherwise */
|
||||
int result_ref; /* table if vr_ref != NULL, callback function otherwise */
|
||||
liJobRef *vr_ref;
|
||||
lua_State *L;
|
||||
} mc_lua_request;
|
||||
|
@ -29,7 +29,7 @@ foreach name, def: unittests
|
||||
test_bin = executable(
|
||||
def['binary'],
|
||||
def['sources'],
|
||||
include_directories: inc_dir,
|
||||
include_directories: [inc_dir] + search_includes,
|
||||
dependencies: main_deps + def.get('dependencies', []),
|
||||
link_with: [
|
||||
lib_shared,
|
||||
|
@ -8,7 +8,14 @@ LUA_STATE_ENV_INFO = """
|
||||
-- globals should be reset after loading
|
||||
info = "global info"
|
||||
|
||||
-- tostring(custom_obj) should throw an error, but log functions should handle it
|
||||
local custom_obj = {["data"] = "test string"}
|
||||
setmetatable(custom_obj, {["__tostring"] = function(obj) return nil .. obj["data"] end})
|
||||
|
||||
print("bar", "custom_obj=", custom_obj)
|
||||
|
||||
local function extract_info(vr)
|
||||
vr:error("extract_info: info=" .. (info or ""), "nil=", nil, "custom_obj=", custom_obj)
|
||||
-- simple globals should be "per handler" (and request)
|
||||
info = (info or "") .. "handler global"
|
||||
-- special `REQ` allows request-global state across handlers
|
||||
@ -16,6 +23,7 @@ local function extract_info(vr)
|
||||
end
|
||||
|
||||
local function show_info(vr)
|
||||
lighty.error("show_info: info=" .. (info or "") .. "; REQ.info=" .. (REQ.info or ""))
|
||||
if vr:handle_direct() then
|
||||
vr.resp.status = 200
|
||||
vr.resp.headers["Content-Type"] = "text/plain"
|
||||
|
Loading…
x
Reference in New Issue
Block a user