Browse Source

[mod_magnet] interface to http_response_send_file

st = lighty.c.stat("/path/to/file")
if (st and st.is_file) then
  return st["http-response-send-file"]
end

calls http_response_send_file(), providing similar behavior as
mod_staticfile, including handling HTTP conditional requests
master
Glenn Strauss 5 months ago
parent
commit
0ba74e2381
  1. 7
      src/mod_magnet.c

7
src/mod_magnet.c

@ -450,6 +450,13 @@ static int magnet_stat_field(lua_State *L) {
lua_pushnil(L);
return 1;
}
case 'h': { /* http-response-send-file */
if (0 != strcmp(k.ptr, "http-response-send-file")) break;
request_st * const r = magnet_get_request(L);
http_response_send_file(r, &sce->name, sce);
lua_pushinteger(L, r->http_status);
return 1;
}
case 'i': /* is_* */
if (k.len < 4) break;
switch (k.ptr[3]) {

Loading…
Cancel
Save