Update GetStatus to return status code set by redbean itself (outside of Lua code)

This commit is contained in:
Paul Kulchenko 2022-07-22 07:43:49 -07:00
parent e7957287da
commit cd319f7958

View file

@ -3365,7 +3365,7 @@ static int LuaSetStatus(lua_State *L) {
static int LuaGetStatus(lua_State *L) { static int LuaGetStatus(lua_State *L) {
OnlyCallDuringRequest(L, "GetStatus"); OnlyCallDuringRequest(L, "GetStatus");
if (!luaheaderp) { if (!statuscode) {
lua_pushnil(L); lua_pushnil(L);
} else { } else {
lua_pushinteger(L, statuscode); lua_pushinteger(L, statuscode);
@ -6360,8 +6360,9 @@ static void InitRequest(void) {
msgsize = 0; msgsize = 0;
loops.n = 0; loops.n = 0;
generator = 0; generator = 0;
luaheaderp = 0;
isyielding = 0; isyielding = 0;
luaheaderp = 0;
statuscode = 0;
contentlength = 0; contentlength = 0;
referrerpolicy = 0; referrerpolicy = 0;
gotcachecontrol = 0; gotcachecontrol = 0;