From 98d81e701a3e6c75b932ac75c872ae0e3f4d84f4 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Mon, 14 Apr 2025 14:03:08 -0500 Subject: config change, local support, overall fixes --- src/net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/net.c') diff --git a/src/net.c b/src/net.c index 38e70ff..9089f49 100644 --- a/src/net.c +++ b/src/net.c @@ -556,7 +556,7 @@ int l_srequest(lua_State* L){ int l_request(lua_State* L){ const char* host = luaL_checkstring(L, 1); - int sock = get_host((char*)host, lua_tostring(L, 2)); + int sock = get_host((char*)host, (char*)lua_tostring(L, 2)); char* path = "/"; if(lua_gettop(L) >= 3) @@ -809,6 +809,7 @@ void* handle_client(void *_arg){ luaL_loadbuffer(L, wowa->c, wowa->len, "fun"); int func = lua_gettop(L); + lua_assign_upvalues(L, func); //lua_pushvalue(L, func); // push function call lua_pushvalue(L, res_idx); //push methods related to dealing with the request @@ -816,6 +817,7 @@ void* handle_client(void *_arg){ //call the function if(lua_pcall(L, 2, 0, 0) != 0){ + printf("(net thread) %s\n", lua_tostring(L, -1)); //send an error message if send has not been called if(client_fd >= 0) net_error(client_fd, 500); @@ -941,7 +943,7 @@ int start_serv(lua_State* L, int port){ lua_getglobal(L, "_G"); //time_start(copy) - luaI_deepcopy(L, args->L, SKIP_GC); + luaI_copyvars(L, args->L); //time_end("copy", copy) lua_settop(L, old_top); -- cgit v1.2.3