diff --git a/APIs/std.lua b/APIs/std.lua index 4c8aaad..d4d76fd 100644 --- a/APIs/std.lua +++ b/APIs/std.lua @@ -105,7 +105,7 @@ function std.ws.write_bytes(arr) std.ws_b(HTTP_REQUEST.id,arr) end function std.ws.enable() - return HTTP_REQUEST.query ~= nil and HTTP_REQUEST.query["__web_socket__"] == "1" + return HTTP_REQUEST ~= nil and HTTP_REQUEST.request["__web_socket__"] == "1" end function std.ws.close(code) std.ws_close(HTTP_REQUEST.id,code) diff --git a/lib/ulib/ulib.c b/lib/ulib/ulib.c index 86b636b..46e9775 100644 --- a/lib/ulib/ulib.c +++ b/lib/ulib/ulib.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include #include @@ -118,6 +120,15 @@ static int l_waitpid(lua_State* L) int status; waitpid(pid, &status, 0); lua_pushnumber(L, status); + return 1; +} +static int l_kill(lua_State* L) +{ + int pid = luaL_checknumber(L,1); + if(pid == -1) pid = getpid(); + int status = kill(pid, SIGKILL); + lua_pushnumber(L, status); + return 1; } static int l_setuid(lua_State* L) { @@ -610,6 +621,7 @@ static const struct luaL_Reg _lib [] = { {"setuid", l_setuid}, {"setgid", l_setgid}, {"fork", l_fork}, + {"kill", l_kill}, {"waitpid", l_waitpid}, {"chown",l_chown}, {"delete", l_delete},