[mod_magnet] expose r->keep_alive to lua scripts

lighty.r.req_item.keep_alive

Allow lua scripts to set to 0 or -1.  Setting to -1 might be used when
rejecting authentication, and this value will cause lighttpd to delay
the 401 Unauthorized response if the server feature is enabled (default)
  server.feature-flags += ("auth.delay-invalid-creds" => "enable")
master
Glenn Strauss 9 months ago
parent 2e04e3b109
commit 360dc73f33

@ -1580,6 +1580,10 @@ magnet_req_item_get (lua_State *L)
lua_pushcclosure(L, magnet_return_upvalue2, 2);
return 1;
}
if (0 == memcmp(k, "keep_alive", 10)) {
lua_pushinteger(L, (lua_Integer)r->keep_alive);
return 1;
}
break;
case 11:
if (0 == memcmp(k, "http_status", 11)) {
@ -1614,6 +1618,12 @@ magnet_req_item_set (lua_State *L)
request_st * const r = **(request_st ***)lua_touserdata(L, 1);
switch (klen) {
case 10:
if (0 == memcmp(k, "keep_alive", 10)) {
if (v == 0 || v == -1) r->keep_alive = v;
return 0;
}
break;
default:
break;
}

Loading…
Cancel
Save