mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 15:03:34 +00:00
Add ProgramMaxPayloadSize() API to Redbean
This way we don't have to use the flag and can configure it using .init.lua instead.
This commit is contained in:
parent
2528536cff
commit
f8520e10b2
2 changed files with 22 additions and 1 deletions
|
@ -1081,6 +1081,20 @@ FUNCTIONS
|
||||||
operating system to choose a port, which may be revealed later on
|
operating system to choose a port, which may be revealed later on
|
||||||
by GetServerAddr or the -z flag to stdout.
|
by GetServerAddr or the -z flag to stdout.
|
||||||
|
|
||||||
|
ProgramMaxPayloadSize(int64)
|
||||||
|
Sets the maximum HTTP message payload size in bytes. The
|
||||||
|
default is very conservatively set to 65536 so this is
|
||||||
|
something many people will want to increase. This limit is
|
||||||
|
enforced at the transport layer, before any Lua code is
|
||||||
|
called, because right now redbean stores and forewards
|
||||||
|
messages. (Use the UNIX API for raw socket streaming.) Setting
|
||||||
|
this to a very high value can be useful if you're less
|
||||||
|
concerned about rogue clients and would rather have your Lua
|
||||||
|
code be granted more control to bounce unreasonable messages.
|
||||||
|
If a value less than 1450 is supplied, it'll automatically be
|
||||||
|
increased to 1450, since that's the size of ethernet frames.
|
||||||
|
This function can only be called from .init.lua.
|
||||||
|
|
||||||
ProgramPrivateKey(pem:str)
|
ProgramPrivateKey(pem:str)
|
||||||
Same as the -K flag if called from .init.lua, e.g.
|
Same as the -K flag if called from .init.lua, e.g.
|
||||||
ProgramPrivateKey(LoadAsset("/.sign.key")) for zip loading or
|
ProgramPrivateKey(LoadAsset("/.sign.key")) for zip loading or
|
||||||
|
|
|
@ -4592,6 +4592,11 @@ static int LuaProgramGid(lua_State *L) {
|
||||||
return LuaProgramInt(L, ProgramGid);
|
return LuaProgramInt(L, ProgramGid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int LuaProgramMaxPayloadSize(lua_State *L) {
|
||||||
|
OnlyCallFromInitLua(L, "ProgramMaxPayloadSize");
|
||||||
|
return LuaProgramInt(L, ProgramMaxPayloadSize);
|
||||||
|
}
|
||||||
|
|
||||||
static int LuaGetClientFd(lua_State *L) {
|
static int LuaGetClientFd(lua_State *L) {
|
||||||
OnlyCallDuringConnection(L, "GetClientFd");
|
OnlyCallDuringConnection(L, "GetClientFd");
|
||||||
lua_pushinteger(L, client);
|
lua_pushinteger(L, client);
|
||||||
|
@ -4954,17 +4959,18 @@ static const char *const kDontAutoComplete[] = {
|
||||||
"HasParam", //
|
"HasParam", //
|
||||||
"IsClientUsingSsl", //
|
"IsClientUsingSsl", //
|
||||||
"LaunchBrowser", //
|
"LaunchBrowser", //
|
||||||
|
"LuaProgramSslRequired", // TODO
|
||||||
"ProgramAddr", // TODO
|
"ProgramAddr", // TODO
|
||||||
"ProgramBrand", //
|
"ProgramBrand", //
|
||||||
"ProgramCertificate", // TODO
|
"ProgramCertificate", // TODO
|
||||||
"ProgramGid", //
|
"ProgramGid", //
|
||||||
"ProgramLogPath", // TODO
|
"ProgramLogPath", // TODO
|
||||||
|
"ProgramMaxPayloadSize", // TODO
|
||||||
"ProgramPidPath", // TODO
|
"ProgramPidPath", // TODO
|
||||||
"ProgramPort", // TODO
|
"ProgramPort", // TODO
|
||||||
"ProgramPrivateKey", // TODO
|
"ProgramPrivateKey", // TODO
|
||||||
"ProgramSslCiphersuite", // TODO
|
"ProgramSslCiphersuite", // TODO
|
||||||
"ProgramSslClientVerify", // TODO
|
"ProgramSslClientVerify", // TODO
|
||||||
"LuaProgramSslRequired", // TODO
|
|
||||||
"ProgramSslCompression", //
|
"ProgramSslCompression", //
|
||||||
"ProgramSslTicketLifetime", //
|
"ProgramSslTicketLifetime", //
|
||||||
"ProgramTimeout", // TODO
|
"ProgramTimeout", // TODO
|
||||||
|
@ -5095,6 +5101,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
||||||
{"ProgramLogBodies", LuaProgramLogBodies}, //
|
{"ProgramLogBodies", LuaProgramLogBodies}, //
|
||||||
{"ProgramLogMessages", LuaProgramLogMessages}, //
|
{"ProgramLogMessages", LuaProgramLogMessages}, //
|
||||||
{"ProgramLogPath", LuaProgramLogPath}, //
|
{"ProgramLogPath", LuaProgramLogPath}, //
|
||||||
|
{"ProgramMaxPayloadSize", LuaProgramMaxPayloadSize}, //
|
||||||
{"ProgramPidPath", LuaProgramPidPath}, //
|
{"ProgramPidPath", LuaProgramPidPath}, //
|
||||||
{"ProgramPort", LuaProgramPort}, //
|
{"ProgramPort", LuaProgramPort}, //
|
||||||
{"ProgramRedirect", LuaProgramRedirect}, //
|
{"ProgramRedirect", LuaProgramRedirect}, //
|
||||||
|
|
Loading…
Reference in a new issue