Fix bugs and make improvements to redbean

- Abort if .init.lua fails
- Refactor redbean to use new append library
- Use first certificate if SNI routing fails
- Use function/data sections when building Lua
- Don't use self-signed auto-generated cert for client
- Add -D staging dirs to redbean lua module default path
This commit is contained in:
Justine Tunney 2021-08-06 14:12:11 -07:00
parent 55a15c204e
commit aeeb851422
26 changed files with 703 additions and 513 deletions

View file

@ -16,6 +16,8 @@
#include "third_party/lua/lua.h"
#include "third_party/lua/lualib.h"
const char *g_lua_path_default = LUA_PATH_DEFAULT;
/* clang-format off */
/*
@ -728,12 +730,17 @@ static void createclibstable (lua_State *L) {
}
static const char *GetLuaPathDefault(void) {
return g_lua_path_default;
}
LUAMOD_API int luaopen_package (lua_State *L) {
createclibstable(L);
luaL_newlib(L, pk_funcs); /* create 'package' table */
createsearcherstable(L);
/* set paths */
setpath(L, "path", LUA_PATH_VAR, LUA_PATH_DEFAULT);
setpath(L, "path", LUA_PATH_VAR, g_lua_path_default);
setpath(L, "cpath", LUA_CPATH_VAR, LUA_CPATH_DEFAULT);
/* store config information */
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"