Add undocumented IsHeaderRepeatable to redbean

This API is intended to help unblock framework code. It should
ideally be abstracted by redbean which is why it's undocumented.

See #97
This commit is contained in:
Justine Tunney 2021-11-12 19:02:43 -08:00
parent 7064d736e3
commit 98192c1079

View file

@ -5035,6 +5035,21 @@ static int LuaIsHiddenPath(lua_State *L) {
return 1;
}
static int LuaIsHeaderRepeatable(lua_State *L) {
int h;
bool r;
size_t n;
const char *s;
s = luaL_checklstring(L, 1, &n);
if ((h = GetHttpHeader(s, n)) == -1) {
r = kHttpRepeatable[h];
} else {
r = false;
}
lua_pushboolean(L, r);
return 1;
}
static int LuaGetZipPaths(lua_State *L) {
char *path;
uint8_t *zcf;
@ -5359,12 +5374,11 @@ static const luaL_Reg kLuaFuncs[] = {
{"FormatHttpDateTime", LuaFormatHttpDateTime}, //
{"FormatIp", LuaFormatIp}, //
{"GetAssetComment", LuaGetAssetComment}, //
{"GetComment", LuaGetAssetComment}, //
{"GetAssetMode", LuaGetAssetMode}, //
{"GetAssetSize", LuaGetAssetSize}, //
{"GetBody", LuaGetBody}, //
{"GetPayload", LuaGetBody}, //
{"GetClientAddr", LuaGetClientAddr}, //
{"GetComment", LuaGetAssetComment}, //
{"GetCookie", LuaGetCookie}, //
{"GetCryptoHash", LuaGetCryptoHash}, //
{"GetDate", LuaGetDate}, //
@ -5384,6 +5398,7 @@ static const luaL_Reg kLuaFuncs[] = {
{"GetParams", LuaGetParams}, //
{"GetPass", LuaGetPass}, //
{"GetPath", LuaGetPath}, //
{"GetPayload", LuaGetBody}, //
{"GetPort", LuaGetPort}, //
{"GetRandomBytes", LuaGetRandomBytes}, //
{"GetRedbeanVersion", LuaGetRedbeanVersion}, //
@ -5404,6 +5419,7 @@ static const luaL_Reg kLuaFuncs[] = {
{"IsAcceptablePort", LuaIsAcceptablePort}, //
{"IsCompressed", LuaIsCompressed}, //
{"IsDaemon", LuaIsDaemon}, //
{"IsHeaderRepeatable", LuaIsHeaderRepeatable}, //
{"IsHiddenPath", LuaIsHiddenPath}, //
{"IsLoopbackClient", LuaIsLoopbackClient}, //
{"IsLoopbackIp", LuaIsLoopbackIp}, //